+ 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,
+ }
+ });
+ }
+
+ Arc::new(syms)
+ }