@@ -903,8 +903,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
903
903
fn_span : Span ,
904
904
mergeable_succ : bool ,
905
905
) -> 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 } ;
908
907
909
908
// Create the callee. This is a fn ptr or zero-sized and hence a kind of scalar.
910
909
let callee = self . codegen_operand ( bx, func) ;
@@ -968,10 +967,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
968
967
969
968
if matches ! ( intrinsic, ty:: IntrinsicDef { name: sym:: caller_location, .. } )
970
969
{
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) ;
975
971
976
972
assert_eq ! ( llargs, [ ] ) ;
977
973
if let ReturnDest :: IndirectOperand ( tmp, _) = ret_dest {
@@ -981,8 +977,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
981
977
return helper. funclet_br ( self , bx, target. unwrap ( ) , mergeable_succ) ;
982
978
}
983
979
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
+ ) {
986
983
Ok ( ( ) ) => {
987
984
if let ReturnDest :: IndirectOperand ( dst, _) = ret_dest {
988
985
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> {
998
995
Err ( instance) => {
999
996
if intrinsic. must_be_overridden {
1000
997
span_bug ! (
1001
- span ,
998
+ fn_span ,
1002
999
"intrinsic {} must be overridden by codegen backend, but isn't" ,
1003
1000
intrinsic. name,
1004
1001
) ;
@@ -1110,7 +1107,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1110
1107
// Make sure that we've actually unwrapped the rcvr down
1111
1108
// to a pointer or ref to `dyn* Trait`.
1112
1109
if !op. layout . ty . builtin_deref ( true ) . unwrap ( ) . is_dyn_star ( ) {
1113
- span_bug ! ( span , "can't codegen a virtual call on {:#?}" , op) ;
1110
+ span_bug ! ( fn_span , "can't codegen a virtual call on {:#?}" , op) ;
1114
1111
}
1115
1112
let place = op. deref ( bx. cx ( ) ) ;
1116
1113
let data_place = place. project_field ( bx, 0 ) ;
@@ -1126,7 +1123,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1126
1123
continue ;
1127
1124
}
1128
1125
_ => {
1129
- span_bug ! ( span , "can't codegen a virtual call on {:#?}" , op) ;
1126
+ span_bug ! ( fn_span , "can't codegen a virtual call on {:#?}" , op) ;
1130
1127
}
1131
1128
}
1132
1129
}
@@ -1169,8 +1166,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1169
1166
mir_args + 1 ,
1170
1167
"#[track_caller] fn's must have 1 more argument in their ABI than in their MIR: {instance:?} {fn_span:?} {fn_abi:?}" ,
1171
1168
) ;
1172
- let location =
1173
- self . get_caller_location ( bx, mir:: SourceInfo { span : fn_span, ..source_info } ) ;
1169
+ let location = self . get_caller_location ( bx, source_info) ;
1174
1170
debug ! (
1175
1171
"codegen_call_terminator({:?}): location={:?} (fn_span {:?})" ,
1176
1172
terminator, location, fn_span
@@ -1183,7 +1179,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1183
1179
let fn_ptr = match ( instance, llfn) {
1184
1180
( Some ( instance) , None ) => bx. get_fn_addr ( instance) ,
1185
1181
( _, Some ( llfn) ) => llfn,
1186
- _ => span_bug ! ( span , "no instance or llfn for call" ) ,
1182
+ _ => span_bug ! ( fn_span , "no instance or llfn for call" ) ,
1187
1183
} ;
1188
1184
helper. do_call (
1189
1185
self ,
0 commit comments