|
11 | 11 |
|
12 | 12 | use std::ffi::{CStr, CString}; |
13 | 13 |
|
14 | | -use rustc::hir::{self, CodegenFnAttrFlags}; |
| 14 | +use rustc::hir::CodegenFnAttrFlags; |
15 | 15 | use rustc::hir::def_id::{DefId, LOCAL_CRATE}; |
16 | | -use rustc::hir::itemlikevisit::ItemLikeVisitor; |
17 | 16 | use rustc::session::Session; |
18 | 17 | use rustc::session::config::Sanitizer; |
19 | 18 | use rustc::ty::TyCtxt; |
@@ -222,37 +221,9 @@ pub fn provide(providers: &mut Providers) { |
222 | 221 | } |
223 | 222 | }; |
224 | 223 |
|
225 | | - providers.wasm_custom_sections = |tcx, cnum| { |
226 | | - assert_eq!(cnum, LOCAL_CRATE); |
227 | | - let mut finder = WasmSectionFinder { tcx, list: Vec::new() }; |
228 | | - tcx.hir.krate().visit_all_item_likes(&mut finder); |
229 | | - Lrc::new(finder.list) |
230 | | - }; |
231 | | - |
232 | 224 | provide_extern(providers); |
233 | 225 | } |
234 | 226 |
|
235 | | -struct WasmSectionFinder<'a, 'tcx: 'a> { |
236 | | - tcx: TyCtxt<'a, 'tcx, 'tcx>, |
237 | | - list: Vec<DefId>, |
238 | | -} |
239 | | - |
240 | | -impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for WasmSectionFinder<'a, 'tcx> { |
241 | | - fn visit_item(&mut self, i: &'tcx hir::Item) { |
242 | | - match i.node { |
243 | | - hir::ItemConst(..) => {} |
244 | | - _ => return, |
245 | | - } |
246 | | - if i.attrs.iter().any(|i| i.check_name("wasm_custom_section")) { |
247 | | - self.list.push(self.tcx.hir.local_def_id(i.id)); |
248 | | - } |
249 | | - } |
250 | | - |
251 | | - fn visit_trait_item(&mut self, _: &'tcx hir::TraitItem) {} |
252 | | - |
253 | | - fn visit_impl_item(&mut self, _: &'tcx hir::ImplItem) {} |
254 | | -} |
255 | | - |
256 | 227 | pub fn provide_extern(providers: &mut Providers) { |
257 | 228 | providers.wasm_import_module_map = |tcx, cnum| { |
258 | 229 | let mut ret = FxHashMap(); |
|
0 commit comments