Skip to content

Commit 93da4f8

Browse files
Export the plugin registrar from proc-macro crates (and not much else)
1 parent ea9f613 commit 93da4f8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/librustc_trans/back/symbol_export.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ impl ExportedSymbols {
6060
local_crate.push(("main".to_string(), SymbolExportLevel::C));
6161
}
6262

63+
if let Some(id) = scx.sess().derive_registrar_fn.get() {
64+
let svh = &scx.link_meta().crate_hash;
65+
let def_id = scx.tcx().map.local_def_id(id);
66+
let idx = def_id.index;
67+
let registrar = scx.sess().generate_derive_registrar_symbol(svh, idx);
68+
local_crate.push((registrar, SymbolExportLevel::C));
69+
}
70+
6371
if scx.sess().crate_types.borrow().contains(&config::CrateTypeDylib) {
6472
local_crate.push((scx.metadata_symbol_name(),
6573
SymbolExportLevel::Rust));
@@ -135,8 +143,8 @@ pub fn crate_export_threshold(crate_type: config::CrateType)
135143
match crate_type {
136144
config::CrateTypeExecutable |
137145
config::CrateTypeStaticlib |
138-
config::CrateTypeCdylib => SymbolExportLevel::C,
139146
config::CrateTypeProcMacro |
147+
config::CrateTypeCdylib => SymbolExportLevel::C,
140148
config::CrateTypeRlib |
141149
config::CrateTypeMetadata |
142150
config::CrateTypeDylib => SymbolExportLevel::Rust,

0 commit comments

Comments
 (0)