9797extern crate rustc_middle;
9898
9999use rustc_hir:: def_id:: { CrateNum , LOCAL_CRATE } ;
100- use rustc_hir:: Node ;
101100use rustc_middle:: middle:: codegen_fn_attrs:: CodegenFnAttrFlags ;
102101use rustc_middle:: mir:: mono:: { InstantiationMode , MonoItem } ;
103102use rustc_middle:: ty:: query:: Providers ;
@@ -168,17 +167,14 @@ fn compute_symbol_name<'tcx>(
168167
169168 debug ! ( "symbol_name(def_id={:?}, substs={:?})" , def_id, substs) ;
170169
171- // FIXME(eddyb) Precompute a custom symbol name based on attributes.
172- let is_foreign = if let Some ( def_id) = def_id. as_local ( ) {
170+ if let Some ( def_id) = def_id. as_local ( ) {
173171 if tcx. proc_macro_decls_static ( ( ) ) == Some ( def_id) {
174172 let stable_crate_id = tcx. sess . local_stable_crate_id ( ) ;
175173 return tcx. sess . generate_proc_macro_decls_symbol ( stable_crate_id) ;
176174 }
177- matches ! ( tcx. hir( ) . get_by_def_id( def_id) , Node :: ForeignItem ( _) )
178- } else {
179- tcx. is_foreign_item ( def_id)
180- } ;
175+ }
181176
177+ // FIXME(eddyb) Precompute a custom symbol name based on attributes.
182178 let attrs = tcx. codegen_fn_attrs ( def_id) ;
183179
184180 // Foreign items by default use no mangling for their symbol name. There's a
@@ -197,7 +193,7 @@ fn compute_symbol_name<'tcx>(
197193 // show up in the `wasm-import-name` custom attribute in LLVM IR.
198194 //
199195 // [1]: https://bugs.llvm.org/show_bug.cgi?id=44316
200- if is_foreign
196+ if tcx . is_foreign_item ( def_id )
201197 && ( !tcx. sess . target . is_like_wasm
202198 || !tcx. wasm_import_module_map ( def_id. krate ) . contains_key ( & def_id) )
203199 {
0 commit comments