File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -311,16 +311,18 @@ impl<'tcx> Instance<'tcx> {
311311 ) -> Option < Instance < ' tcx > > {
312312 debug ! ( "resolve(def_id={:?}, substs={:?})" , def_id, substs) ;
313313 Instance :: resolve ( tcx, param_env, def_id, substs) . map ( |resolved| {
314- let resolved_def = resolved. def_id ( ) ;
315- let codegen_attrs = tcx. codegen_fn_attrs ( resolved_def) ;
316- if codegen_attrs. flags . contains ( CodegenFnAttrFlags :: TRACK_CALLER ) {
317- debug ! ( " => fn pointer created for function with #[track_caller]" ) ;
318- Instance {
319- def : InstanceDef :: ReifyShim ( resolved_def) ,
320- substs,
321- }
322- } else {
323- resolved
314+ let has_track_caller = |def| tcx. codegen_fn_attrs ( def) . flags
315+ . contains ( CodegenFnAttrFlags :: TRACK_CALLER ) ;
316+
317+ match resolved. def {
318+ InstanceDef :: Item ( def_id) if has_track_caller ( def_id) => {
319+ debug ! ( " => fn pointer created for function with #[track_caller]" ) ;
320+ Instance {
321+ def : InstanceDef :: ReifyShim ( def_id) ,
322+ substs,
323+ }
324+ } ,
325+ _ => resolved,
324326 }
325327 } )
326328 }
You can’t perform that action at this time.
0 commit comments