@@ -4,12 +4,10 @@ use std::ffi::CString;
44
55use cstr:: cstr;
66use rustc_codegen_ssa:: traits:: * ;
7- use rustc_data_structures:: fx:: FxHashMap ;
87use rustc_data_structures:: small_c_str:: SmallCStr ;
98use rustc_hir:: def_id:: DefId ;
109use rustc_middle:: middle:: codegen_fn_attrs:: CodegenFnAttrFlags ;
1110use rustc_middle:: ty:: layout:: HasTyCtxt ;
12- use rustc_middle:: ty:: query:: Providers ;
1311use rustc_middle:: ty:: { self , TyCtxt } ;
1412use rustc_session:: config:: { OptLevel , SanitizerSet } ;
1513use rustc_session:: Session ;
@@ -339,35 +337,6 @@ pub fn from_fn_attrs(cx: &CodegenCx<'ll, 'tcx>, llfn: &'ll Value, instance: ty::
339337 }
340338}
341339
342- pub fn provide_both ( providers : & mut Providers ) {
343- providers. wasm_import_module_map = |tcx, cnum| {
344- // Build up a map from DefId to a `NativeLib` structure, where
345- // `NativeLib` internally contains information about
346- // `#[link(wasm_import_module = "...")]` for example.
347- let native_libs = tcx. native_libraries ( cnum) ;
348-
349- let def_id_to_native_lib = native_libs
350- . iter ( )
351- . filter_map ( |lib| lib. foreign_module . map ( |id| ( id, lib) ) )
352- . collect :: < FxHashMap < _ , _ > > ( ) ;
353-
354- let mut ret = FxHashMap :: default ( ) ;
355- for ( def_id, lib) in tcx. foreign_modules ( cnum) . iter ( ) {
356- let module = def_id_to_native_lib. get ( & def_id) . and_then ( |s| s. wasm_import_module ) ;
357- let module = match module {
358- Some ( s) => s,
359- None => continue ,
360- } ;
361- ret. extend ( lib. foreign_items . iter ( ) . map ( |id| {
362- assert_eq ! ( id. krate, cnum) ;
363- ( * id, module. to_string ( ) )
364- } ) ) ;
365- }
366-
367- ret
368- } ;
369- }
370-
371340fn wasm_import_module ( tcx : TyCtxt < ' _ > , id : DefId ) -> Option < CString > {
372341 tcx. wasm_import_module_map ( id. krate ) . get ( & id) . map ( |s| CString :: new ( & s[ ..] ) . unwrap ( ) )
373342}
0 commit comments