]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_typeck/src/check_unused.rs
Rollup merge of #87646 - JohnTitor:fix-parser-ice, r=oli-obk
[rust.git] / compiler / rustc_typeck / src / check_unused.rs
index 836bed2a156354e43a1c9ca863169fe460d565de..7e5cc771b3199a20ee75774b7f6f53a2858f916d 100644 (file)
@@ -116,6 +116,8 @@ fn unused_crates_lint(tcx: TyCtxt<'_>) {
         crates_to_lint: &mut crates_to_lint,
     });
 
+    let extern_prelude = &tcx.resolutions(()).extern_prelude;
+
     for extern_crate in &crates_to_lint {
         let def_id = extern_crate.def_id.expect_local();
         let id = tcx.hir().local_def_id_to_hir_id(def_id);
@@ -155,7 +157,7 @@ fn unused_crates_lint(tcx: TyCtxt<'_>) {
         // If the extern crate isn't in the extern prelude,
         // there is no way it can be written as an `use`.
         let orig_name = extern_crate.orig_name.unwrap_or(item.ident.name);
-        if !tcx.extern_prelude.get(&orig_name).map_or(false, |from_item| !from_item) {
+        if !extern_prelude.get(&orig_name).map_or(false, |from_item| !from_item) {
             continue;
         }