@@ -903,8 +903,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
903903 fn_span : Span ,
904904 mergeable_succ : bool ,
905905 ) -> MergingSucc {
906- let source_info = terminator. source_info ;
907- let span = source_info. span ;
906+ let source_info = mir:: SourceInfo { span : fn_span, ..terminator. source_info } ;
908907
909908 // Create the callee. This is a fn ptr or zero-sized and hence a kind of scalar.
910909 let callee = self . codegen_operand ( bx, func) ;
@@ -968,10 +967,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
968967
969968 if matches ! ( intrinsic, ty:: IntrinsicDef { name: sym:: caller_location, .. } )
970969 {
971- let location = self . get_caller_location (
972- bx,
973- mir:: SourceInfo { span : fn_span, ..source_info } ,
974- ) ;
970+ let location = self . get_caller_location ( bx, source_info) ;
975971
976972 assert_eq ! ( llargs, [ ] ) ;
977973 if let ReturnDest :: IndirectOperand ( tmp, _) = ret_dest {
@@ -981,8 +977,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
981977 return helper. funclet_br ( self , bx, target. unwrap ( ) , mergeable_succ) ;
982978 }
983979
984- match Self :: codegen_intrinsic_call ( bx, instance, fn_abi, & args, dest, span)
985- {
980+ match Self :: codegen_intrinsic_call (
981+ bx, instance, fn_abi, & args, dest, fn_span,
982+ ) {
986983 Ok ( ( ) ) => {
987984 if let ReturnDest :: IndirectOperand ( dst, _) = ret_dest {
988985 self . store_return ( bx, ret_dest, & fn_abi. ret , dst. val . llval ) ;
@@ -998,7 +995,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
998995 Err ( instance) => {
999996 if intrinsic. must_be_overridden {
1000997 span_bug ! (
1001- span ,
998+ fn_span ,
1002999 "intrinsic {} must be overridden by codegen backend, but isn't" ,
10031000 intrinsic. name,
10041001 ) ;
@@ -1113,7 +1110,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
11131110 // Make sure that we've actually unwrapped the rcvr down
11141111 // to a pointer or ref to `dyn* Trait`.
11151112 if !op. layout . ty . builtin_deref ( true ) . unwrap ( ) . is_dyn_star ( ) {
1116- span_bug ! ( span , "can't codegen a virtual call on {:#?}" , op) ;
1113+ span_bug ! ( fn_span , "can't codegen a virtual call on {:#?}" , op) ;
11171114 }
11181115 let place = op. deref ( bx. cx ( ) ) ;
11191116 let data_place = place. project_field ( bx, 0 ) ;
@@ -1129,7 +1126,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
11291126 continue ;
11301127 }
11311128 _ => {
1132- span_bug ! ( span , "can't codegen a virtual call on {:#?}" , op) ;
1129+ span_bug ! ( fn_span , "can't codegen a virtual call on {:#?}" , op) ;
11331130 }
11341131 }
11351132 }
@@ -1179,8 +1176,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
11791176 mir_args + 1 ,
11801177 "#[track_caller] fn's must have 1 more argument in their ABI than in their MIR: {instance:?} {fn_span:?} {fn_abi:?}" ,
11811178 ) ;
1182- let location =
1183- self . get_caller_location ( bx, mir:: SourceInfo { span : fn_span, ..source_info } ) ;
1179+ let location = self . get_caller_location ( bx, source_info) ;
11841180 debug ! (
11851181 "codegen_call_terminator({:?}): location={:?} (fn_span {:?})" ,
11861182 terminator, location, fn_span
@@ -1199,9 +1195,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
11991195 let fn_ptr = match ( instance, llfn) {
12001196 ( Some ( instance) , None ) => bx. get_fn_addr ( instance) ,
12011197 ( _, Some ( llfn) ) => llfn,
1202- _ => span_bug ! ( span , "no instance or llfn for call" ) ,
1198+ _ => span_bug ! ( fn_span , "no instance or llfn for call" ) ,
12031199 } ;
1204- self . set_debug_loc ( bx, mir :: SourceInfo { span : fn_span , .. source_info } ) ;
1200+ self . set_debug_loc ( bx, source_info) ;
12051201 helper. do_call (
12061202 self ,
12071203 bx,
0 commit comments