Skip to content

Commit 03f384f

Browse files
Fix export level of plugin and procmacro registrars.
1 parent 3e454df commit 03f384f

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

src/librustc_metadata/cstore_impl.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,9 @@ provide! { <'tcx> tcx, def_id, other, cdata,
257257
let cnum = cdata.cnum;
258258
assert!(cnum != LOCAL_CRATE);
259259

260-
// If this crate is a plugin and/or a custom derive crate, then
261-
// we're not even going to link those in so we skip those crates.
262-
if cdata.root.plugin_registrar_fn.is_some() ||
263-
cdata.root.macro_derive_registrar.is_some() {
260+
// If this crate is a custom derive crate, then we're not even going to
261+
// link those in so we skip those crates.
262+
if cdata.root.macro_derive_registrar.is_some() {
264263
return Arc::new(Vec::new())
265264
}
266265

src/librustc_trans/back/symbol_export.rs

+11-9
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)