File tree 2 files changed +12
-0
lines changed
2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -1186,6 +1186,13 @@ struct RootCollector<'a, 'tcx> {
1186
1186
1187
1187
impl < ' v > RootCollector < ' _ , ' v > {
1188
1188
fn process_item ( & mut self , id : hir:: ItemId ) {
1189
+ let def_id = id. owner_id . def_id ;
1190
+ let ( live_symbols, _) = self . tcx . live_symbols_and_ignored_derived_traits ( ( ) ) ;
1191
+ if !live_symbols. contains ( & def_id) && !self . tcx . sess . link_dead_code ( ) {
1192
+ // This is dead code; ignore it.
1193
+ return ;
1194
+ }
1195
+
1189
1196
match self . tcx . def_kind ( id. owner_id ) {
1190
1197
DefKind :: Enum | DefKind :: Struct | DefKind :: Union => {
1191
1198
let item = self . tcx . hir ( ) . item ( id) ;
Original file line number Diff line number Diff line change @@ -623,6 +623,11 @@ fn create_and_seed_worklist<'tcx>(
623
623
check_foreign_item ( tcx, & mut worklist, id) ;
624
624
}
625
625
626
+ if let Some ( static_) = tcx. proc_macro_decls_static ( ( ) ) {
627
+ // We assume this is always used if present.
628
+ worklist. push ( static_) ;
629
+ }
630
+
626
631
( worklist, struct_constructors)
627
632
}
628
633
You can’t perform that action at this time.
0 commit comments