]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_metadata/cstore_impl.rs
Auto merge of #65838 - estebank:resilient-recovery, r=Centril
[rust.git] / src / librustc_metadata / cstore_impl.rs
index 2e6ed1d187a68ed58a09e9eb27893bb24acf3968..c5f830c0d042054d04a4d8769bf9f429d2bb887a 100644 (file)
@@ -9,7 +9,6 @@
 use rustc::middle::cstore::{CrateSource, CrateStore, DepKind, EncodedMetadata, NativeLibraryKind};
 use rustc::middle::exported_symbols::ExportedSymbol;
 use rustc::middle::stability::DeprecationEntry;
-use rustc::middle::dependency_format::Linkage;
 use rustc::hir::def;
 use rustc::hir;
 use rustc::session::{CrateDisambiguator, Session};
@@ -235,26 +234,11 @@ fn into_args(self) -> (DefId, DefId) { (self.0.as_def_id(), self.1) }
     used_crate_source => { Lrc::new(cdata.source.clone()) }
 
     exported_symbols => {
-        let mut syms = cdata.exported_symbols(tcx);
-
-        // When linked into a dylib crates don't export their generic symbols,
-        // so if that's happening then we can't load upstream monomorphizations
-        // from this crate.
-        let formats = tcx.dependency_formats(LOCAL_CRATE);
-        let remove_generics = formats.iter().any(|(_ty, list)| {
-            match list.get(def_id.krate.as_usize() - 1) {
-                Some(Linkage::IncludedFromDylib) | Some(Linkage::Dynamic) => true,
-                _ => false,
-            }
-        });
-        if remove_generics {
-            syms.retain(|(sym, _threshold)| {
-                match sym {
-                    ExportedSymbol::Generic(..) => false,
-                    _ => return true,
-                }
-            });
-        }
+        let syms = cdata.exported_symbols(tcx);
+
+        // FIXME rust-lang/rust#64319, rust-lang/rust#64872: We want
+        // to block export of generics from dylibs, but we must fix
+        // rust-lang/rust#65890 before we can do that robustly.
 
         Arc::new(syms)
     }
@@ -440,7 +424,7 @@ pub fn load_macro_untracked(&self, id: DefId, sess: &Session) -> LoadedMacro {
         let source_file = sess.parse_sess.source_map().new_source_file(source_name, def.body);
         let local_span = Span::with_root_ctxt(source_file.start_pos, source_file.end_pos);
         let (body, mut errors) = source_file_to_stream(&sess.parse_sess, source_file, None);
-        emit_unclosed_delims(&mut errors, &sess.diagnostic());
+        emit_unclosed_delims(&mut errors, &sess.parse_sess);
 
         // Mark the attrs as used
         let attrs = data.get_item_attrs(id.index, sess);