about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-28 17:30:25 +0000
committerbors <bors@rust-lang.org>2024-02-28 17:30:25 +0000
commitbf9c7a64ad222b85397573668b39e6d1ab9f4a72 (patch)
treecd3aee95c3217a5a47dc1e3501a22bc3956fc4e5 /compiler/rustc_resolve/src
parentd377991bad40c0d5c79bfa58465295751e8542fe (diff)
parent1b08d1a92cd8586768338ea9dc776054e747861a (diff)
downloadrust-bf9c7a64ad222b85397573668b39e6d1ab9f4a72.tar.gz
rust-bf9c7a64ad222b85397573668b39e6d1ab9f4a72.zip
Auto merge of #121741 - GuillaumeGomez:rollup-msrsrnk, r=GuillaumeGomez
Rollup of 12 pull requests

Successful merges:

 - #120051 (Add `display` method to `OsStr`)
 - #121226 (Fix issues in suggesting importing extern crate paths)
 - #121423 (Remove the `UntranslatableDiagnosticTrivial` lint.)
 - #121527 (unix_sigpipe: Simple fixes and improvements in tests)
 - #121572 (Add test case for primitive links in alias js)
 - #121661 (Changing some attributes to only_local.)
 - #121680 (Fix link generation for foreign macro in jump to definition feature)
 - #121686 (Adjust printing for RPITITs)
 - #121691 (handle unavailable creation time as `io::ErrorKind::Unsupported`)
 - #121695 (Split rustc_type_ir to avoid rustc_ast from depending on it)
 - #121698 (CFI: Fix typo in test file names)
 - #121702 (Process alias-relate obligations in CoerceUnsized loop)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_resolve/src')
-rw-r--r--compiler/rustc_resolve/src/diagnostics.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs
index 96025a26de7..eaf6dca457c 100644
--- a/compiler/rustc_resolve/src/diagnostics.rs
+++ b/compiler/rustc_resolve/src/diagnostics.rs
@@ -1294,10 +1294,20 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
                     let mut path_segments = path_segments.clone();
                     path_segments.push(ast::PathSegment::from_ident(ident));
 
+                    let alias_import = if let NameBindingKind::Import { import, .. } =
+                        name_binding.kind
+                        && let ImportKind::ExternCrate { source: Some(_), .. } = import.kind
+                        && import.parent_scope.expansion == parent_scope.expansion
+                    {
+                        true
+                    } else {
+                        false
+                    };
+
                     let is_extern_crate_that_also_appears_in_prelude =
                         name_binding.is_extern_crate() && lookup_ident.span.at_least_rust_2018();
 
-                    if !is_extern_crate_that_also_appears_in_prelude {
+                    if !is_extern_crate_that_also_appears_in_prelude || alias_import {
                         // add the module to the lookup
                         if seen_modules.insert(module.def_id()) {
                             if via_import { &mut worklist_via_import } else { &mut worklist }