@@ -15,7 +15,11 @@ use rustc_hir::Attribute;
15
15
use rustc_middle:: ty:: TyCtxt ;
16
16
use stable_mir:: {
17
17
CrateDef , ItemKind ,
18
- mir:: { MirVisitor , mono:: Instance , visit:: Location } ,
18
+ mir:: {
19
+ MirVisitor ,
20
+ mono:: { Instance , InstanceKind } ,
21
+ visit:: Location ,
22
+ } ,
19
23
rustc_internal:: internal,
20
24
ty:: Ty ,
21
25
} ;
@@ -62,7 +66,10 @@ struct Reachability {
62
66
63
67
impl Reachability {
64
68
fn add_instance ( & mut self , instance : Instance ) {
65
- if self . instances . insert ( instance) {
69
+ if self . instances . insert ( instance)
70
+ && instance. has_body ( )
71
+ && matches ! ( instance. kind, InstanceKind :: Item )
72
+ {
66
73
// recurse if this is the first time of insertion
67
74
if let Some ( body) = instance. body ( ) {
68
75
self . visit_body ( & body) ;
@@ -92,7 +99,7 @@ fn print_tag_std_attrs_through_internal_apis(tcx: TyCtxt<'_>, instance: &Instanc
92
99
} ) ;
93
100
for attr in tool_attrs {
94
101
println ! (
95
- "{fn_name:?} ({span:?}) => {attr:?}\n " ,
102
+ "{fn_name:?} ({span:?})\n => {attr:?}\n " ,
96
103
fn_name = instance. name( ) ,
97
104
span = instance. def. span( ) . diagnostic( ) ,
98
105
attr = rustc_hir_pretty:: attribute_to_string( & tcx, attr)
0 commit comments