@@ -474,9 +474,10 @@ fn fn_abi_new_uncached<'tcx>(
474
474
let ( caller_location, determined_fn_def_id, is_virtual_call) = if let Some ( instance) = instance
475
475
{
476
476
let is_virtual_call = matches ! ( instance. def, ty:: InstanceKind :: Virtual ( ..) ) ;
477
+ let is_tls_shim_call = matches ! ( instance. def, ty:: InstanceKind :: ThreadLocalShim ( _) ) ;
477
478
(
478
479
instance. def . requires_caller_location ( tcx) . then ( || tcx. caller_location_ty ( ) ) ,
479
- if is_virtual_call { None } else { Some ( instance. def_id ( ) ) } ,
480
+ if is_virtual_call || is_tls_shim_call { None } else { Some ( instance. def_id ( ) ) } ,
480
481
is_virtual_call,
481
482
)
482
483
} else {
@@ -556,6 +557,7 @@ fn fn_abi_new_uncached<'tcx>(
556
557
c_variadic : sig. c_variadic ,
557
558
fixed_count : inputs. len ( ) as u32 ,
558
559
conv,
560
+ // FIXME return false for tls shim
559
561
can_unwind : fn_can_unwind (
560
562
tcx,
561
563
// Since `#[rustc_nounwind]` can change unwinding, we cannot infer unwinding by `fn_def_id` for a virtual call.
@@ -568,8 +570,9 @@ fn fn_abi_new_uncached<'tcx>(
568
570
& mut fn_abi,
569
571
sig. abi ,
570
572
// If this is a virtual call, we cannot pass the `fn_def_id`, as it might call other
571
- // functions from vtable. Internally, `deduced_param_attrs` attempts to infer attributes by
572
- // visit the function body.
573
+ // functions from vtable. And for a tls shim, passing the `fn_def_id` would refer to
574
+ // the underlying static. Internally, `deduced_param_attrs` attempts to infer attributes
575
+ // by visit the function body.
573
576
determined_fn_def_id,
574
577
) ;
575
578
debug ! ( "fn_abi_new_uncached = {:?}" , fn_abi) ;
0 commit comments