@@ -463,8 +463,7 @@ fn check_bare_fn<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
463463 regionck:: regionck_fn ( & fcx, fn_id, fn_span, decl, body) ;
464464 writeback:: resolve_type_vars_in_fn ( & fcx, decl, body) ;
465465 }
466- _ => ccx. tcx . sess . impossible_case ( body. span ,
467- "check_bare_fn: function type expected" )
466+ _ => span_bug ! ( body. span, "check_bare_fn: function type expected" )
468467 }
469468}
470469
@@ -946,7 +945,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
946945 hir:: ImplItemKind :: Const ( ..) => {
947946 let impl_const = match ty_impl_item {
948947 ty:: ConstTraitItem ( ref cti) => cti,
949- _ => tcx . sess . span_bug ( impl_item. span , "non-const impl-item for const" )
948+ _ => span_bug ! ( impl_item. span, "non-const impl-item for const" )
950949 } ;
951950
952951 // Find associated const definition.
@@ -969,7 +968,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
969968
970969 let impl_method = match ty_impl_item {
971970 ty:: MethodTraitItem ( ref mti) => mti,
972- _ => tcx . sess . span_bug ( impl_item. span , "non-method impl-item for method" )
971+ _ => span_bug ! ( impl_item. span, "non-method impl-item for method" )
973972 } ;
974973
975974 if let & ty:: MethodTraitItem ( ref trait_method) = ty_trait_item {
@@ -990,7 +989,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
990989 hir:: ImplItemKind :: Type ( _) => {
991990 let impl_type = match ty_impl_item {
992991 ty:: TypeTraitItem ( ref tti) => tti,
993- _ => tcx . sess . span_bug ( impl_item. span , "non-type impl-item for type" )
992+ _ => span_bug ! ( impl_item. span, "non-type impl-item for type" )
994993 } ;
995994
996995 if let & ty:: TypeTraitItem ( ref at) = ty_trait_item {
@@ -1567,8 +1566,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
15671566 match self . inh . tables . borrow ( ) . node_types . get ( & ex. id ) {
15681567 Some ( & t) => t,
15691568 None => {
1570- self . tcx ( ) . sess . bug ( & format ! ( "no type for expr in fcx {}" ,
1571- self . tag( ) ) ) ;
1569+ bug ! ( "no type for expr in fcx {}" , self . tag( ) ) ;
15721570 }
15731571 }
15741572 }
@@ -1593,10 +1591,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
15931591 Some ( & t) => t,
15941592 None if self . err_count_since_creation ( ) != 0 => self . tcx ( ) . types . err ,
15951593 None => {
1596- self . tcx ( ) . sess . bug (
1597- & format ! ( "no type for node {}: {} in fcx {}" ,
1598- id, self . tcx( ) . map. node_to_string( id) ,
1599- self . tag( ) ) ) ;
1594+ bug ! ( "no type for node {}: {} in fcx {}" ,
1595+ id, self . tcx( ) . map. node_to_string( id) ,
1596+ self . tag( ) ) ;
16001597 }
16011598 }
16021599 }
@@ -2386,8 +2383,7 @@ fn check_method_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
23862383 fty. sig . 0 . output
23872384 }
23882385 _ => {
2389- fcx. tcx ( ) . sess . span_bug ( callee_expr. span ,
2390- "method without bare fn type" ) ;
2386+ span_bug ! ( callee_expr. span, "method without bare fn type" ) ;
23912387 }
23922388 }
23932389 }
@@ -3139,7 +3135,7 @@ fn check_expr_with_expectation_and_lvalue_pref<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
31393135 let tcx = fcx. ccx . tcx ;
31403136 let substs = match adt_ty. sty {
31413137 ty:: TyStruct ( _, substs) | ty:: TyEnum ( _, substs) => substs,
3142- _ => tcx . sess . span_bug ( span, "non-ADT passed to check_expr_struct_fields" )
3138+ _ => span_bug ! ( span, "non-ADT passed to check_expr_struct_fields" )
31433139 } ;
31443140
31453141 let mut remaining_fields = FnvHashMap ( ) ;
@@ -3400,8 +3396,7 @@ fn check_expr_with_expectation_and_lvalue_pref<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
34003396 depth : path. segments . len ( )
34013397 }
34023398 } else {
3403- tcx. sess . span_bug ( expr. span ,
3404- & format ! ( "unbound path {:?}" , expr) )
3399+ span_bug ! ( expr. span, "unbound path {:?}" , expr)
34053400 } ;
34063401
34073402 if let Some ( ( opt_ty, segments, def) ) =
@@ -4224,7 +4219,7 @@ fn type_scheme_and_predicates_for_def<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
42244219 Def :: Label ( ..) |
42254220 Def :: SelfTy ( ..) |
42264221 Def :: Err => {
4227- fcx . ccx . tcx . sess . span_bug ( sp, & format ! ( "expected value, found {:?}" , defn) ) ;
4222+ span_bug ! ( sp, "expected value, found {:?}" , defn) ;
42284223 }
42294224 }
42304225}
@@ -4485,11 +4480,10 @@ pub fn instantiate_path<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
44854480
44864481 let impl_ty = fcx. instantiate_type_scheme ( span, & substs, & impl_scheme. ty ) ;
44874482 if fcx. mk_subty ( false , TypeOrigin :: Misc ( span) , self_ty, impl_ty) . is_err ( ) {
4488- fcx. tcx ( ) . sess . span_bug ( span,
4489- & format ! (
4483+ span_bug ! ( span,
44904484 "instantiate_path: (UFCS) {:?} was a subtype of {:?} but now is not?" ,
44914485 self_ty,
4492- impl_ty) ) ;
4486+ impl_ty) ;
44934487 }
44944488 }
44954489
0 commit comments