diff options
| author | Michael Woerister <michaelwoerister@posteo> | 2018-02-28 17:40:25 +0100 |
|---|---|---|
| committer | Michael Woerister <michaelwoerister@posteo> | 2018-03-06 09:58:47 +0100 |
| commit | 9f6d55463889bd019913e71c8a235beed8f29f45 (patch) | |
| tree | da78ba09f08110941a150dc59bbb0ab73b7e24fc /src | |
| parent | 8bc005c8bb26f8d84066a096780c765ba431d721 (diff) | |
| download | rust-9f6d55463889bd019913e71c8a235beed8f29f45.tar.gz rust-9f6d55463889bd019913e71c8a235beed8f29f45.zip | |
Fix export level of plugin and procmacro registrars.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_metadata/cstore_impl.rs | 7 | ||||
| -rw-r--r-- | src/librustc_trans/back/symbol_export.rs | 20 |
2 files changed, 14 insertions, 13 deletions
diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index 0a2270571f3..0b50f5c4496 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -256,10 +256,9 @@ provide! { <'tcx> tcx, def_id, other, cdata, let cnum = cdata.cnum; assert!(cnum != LOCAL_CRATE); - // If this crate is a plugin and/or a custom derive crate, then - // we're not even going to link those in so we skip those crates. - if cdata.root.plugin_registrar_fn.is_some() || - cdata.root.macro_derive_registrar.is_some() { + // If this crate is a custom derive crate, then we're not even going to + // link those in so we skip those crates. + if cdata.root.macro_derive_registrar.is_some() { return Arc::new(Vec::new()) } diff --git a/src/librustc_trans/back/symbol_export.rs b/src/librustc_trans/back/symbol_export.rs index 0873c1632f5..7d7665749a7 100644 --- a/src/librustc_trans/back/symbol_export.rs +++ b/src/librustc_trans/back/symbol_export.rs @@ -119,7 +119,7 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let special_runtime_crate = tcx.is_panic_runtime(LOCAL_CRATE) || tcx.is_compiler_builtins(LOCAL_CRATE); - let mut reachable_non_generics: DefIdSet = tcx.reachable_set(LOCAL_CRATE).0 + let reachable_non_generics: DefIdSet = tcx.reachable_set(LOCAL_CRATE).0 .iter() .filter_map(|&node_id| { // 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>, }) .collect(); - if let Some(id) = tcx.sess.derive_registrar_fn.get() { - reachable_non_generics.insert(tcx.hir.local_def_id(id)); - } - - if let Some(id) = tcx.sess.plugin_registrar_fn.get() { - reachable_non_generics.insert(tcx.hir.local_def_id(id)); - } - let mut symbols: Vec<_> = reachable_non_generics .iter() .map(|&def_id| { @@ -211,6 +203,16 @@ fn exported_symbols_provider_local<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, }) .collect(); + if let Some(id) = tcx.sess.derive_registrar_fn.get() { + let def_id = tcx.hir.local_def_id(id); + symbols.push((ExportedSymbol::NonGeneric(def_id), SymbolExportLevel::C)); + } + + if let Some(id) = tcx.sess.plugin_registrar_fn.get() { + let def_id = tcx.hir.local_def_id(id); + symbols.push((ExportedSymbol::NonGeneric(def_id), SymbolExportLevel::C)); + } + if let Some(_) = *tcx.sess.entry_fn.borrow() { let symbol_name = "main".to_string(); let exported_symbol = ExportedSymbol::NoDefId(SymbolName::new(&symbol_name)); |
