@@ -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
) ;
@@ -1113,7 +1110,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1113
1110
// Make sure that we've actually unwrapped the rcvr down
1114
1111
// to a pointer or ref to `dyn* Trait`.
1115
1112
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) ;
1117
1114
}
1118
1115
let place = op. deref ( bx. cx ( ) ) ;
1119
1116
let data_place = place. project_field ( bx, 0 ) ;
@@ -1129,7 +1126,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1129
1126
continue ;
1130
1127
}
1131
1128
_ => {
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) ;
1133
1130
}
1134
1131
}
1135
1132
}
@@ -1179,8 +1176,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1179
1176
mir_args + 1 ,
1180
1177
"#[track_caller] fn's must have 1 more argument in their ABI than in their MIR: {instance:?} {fn_span:?} {fn_abi:?}" ,
1181
1178
) ;
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) ;
1184
1180
debug ! (
1185
1181
"codegen_call_terminator({:?}): location={:?} (fn_span {:?})" ,
1186
1182
terminator, location, fn_span
@@ -1199,9 +1195,9 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1199
1195
let fn_ptr = match ( instance, llfn) {
1200
1196
( Some ( instance) , None ) => bx. get_fn_addr ( instance) ,
1201
1197
( _, Some ( llfn) ) => llfn,
1202
- _ => span_bug ! ( span , "no instance or llfn for call" ) ,
1198
+ _ => span_bug ! ( fn_span , "no instance or llfn for call" ) ,
1203
1199
} ;
1204
- self . set_debug_loc ( bx, mir :: SourceInfo { span : fn_span , .. source_info } ) ;
1200
+ self . set_debug_loc ( bx, source_info) ;
1205
1201
helper. do_call (
1206
1202
self ,
1207
1203
bx,
0 commit comments