@@ -119,7 +119,7 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
119119 let special_runtime_crate = tcx. is_panic_runtime ( LOCAL_CRATE ) ||
120120 tcx. is_compiler_builtins ( LOCAL_CRATE ) ;
121121
122- let mut reachable_non_generics: DefIdSet = tcx. reachable_set ( LOCAL_CRATE ) . 0
122+ let reachable_non_generics: DefIdSet = tcx. reachable_set ( LOCAL_CRATE ) . 0
123123 . iter ( )
124124 . filter_map ( |& node_id| {
125125 // We want to ignore some FFI functions that are not exposed from
@@ -174,14 +174,6 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
174174 } )
175175 . collect ( ) ;
176176
177- if let Some ( id) = tcx. sess . derive_registrar_fn . get ( ) {
178- reachable_non_generics. insert ( tcx. hir . local_def_id ( id) ) ;
179- }
180-
181- if let Some ( id) = tcx. sess . plugin_registrar_fn . get ( ) {
182- reachable_non_generics. insert ( tcx. hir . local_def_id ( id) ) ;
183- }
184-
185177 let mut symbols: Vec < _ > = reachable_non_generics
186178 . iter ( )
187179 . map ( |& def_id| {
@@ -211,6 +203,16 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
211203 } )
212204 . collect ( ) ;
213205
206+ if let Some ( id) = tcx. sess . derive_registrar_fn . get ( ) {
207+ let def_id = tcx. hir . local_def_id ( id) ;
208+ symbols. push ( ( ExportedSymbol :: NonGeneric ( def_id) , SymbolExportLevel :: C ) ) ;
209+ }
210+
211+ if let Some ( id) = tcx. sess . plugin_registrar_fn . get ( ) {
212+ let def_id = tcx. hir . local_def_id ( id) ;
213+ symbols. push ( ( ExportedSymbol :: NonGeneric ( def_id) , SymbolExportLevel :: C ) ) ;
214+ }
215+
214216 if let Some ( _) = * tcx. sess . entry_fn . borrow ( ) {
215217 let symbol_name = "main" . to_string ( ) ;
216218 let exported_symbol = ExportedSymbol :: NoDefId ( SymbolName :: new ( & symbol_name) ) ;
0 commit comments