Skip to content

Commit 6104053

Browse files
committed
remove ignore_innermost
1 parent cef2b26 commit 6104053

25 files changed

+310
-36
lines changed

compiler/rustc_resolve/src/ident.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -725,12 +725,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
725725
// Found another solution, if the first one was "weak", report an error.
726726
let (res, innermost_res) = (binding.res(), innermost_binding.res());
727727

728-
// don't report ambiguity errors when we have a glob resolution with a
729-
// non-glob innermost resolution.
730-
let ignore_innermost_result = flags.contains(Flags::GLOB_MODULE)
731-
&& innermost_flags.contains(Flags::NON_GLOB_MODULE);
732-
733-
if res != innermost_res && !ignore_innermost_result {
728+
if res != innermost_res {
734729
let is_builtin = |res| {
735730
matches!(res, Res::NonMacroAttr(NonMacroAttrKind::Builtin(..)))
736731
};

tests/ui/imports/import-after-macro-expand-10.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//@ check-pass
2-
31
mod b {
42
pub mod http {
53
pub struct HeaderMap;
@@ -14,4 +12,5 @@ use crate::b::*;
1412

1513
fn main() {
1614
let h: crate::b::HeaderMap = HeaderMap;
15+
//~^ ERROR ambiguous
1716
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
error[E0659]: `HeaderMap` is ambiguous
2+
--> $DIR/import-after-macro-expand-10.rs:14:22
3+
|
4+
LL | let h: crate::b::HeaderMap = HeaderMap;
5+
| ^^^^^^^^^ ambiguous name
6+
|
7+
= note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution
8+
note: `HeaderMap` could refer to the struct defined here
9+
--> $DIR/import-after-macro-expand-10.rs:8:5
10+
|
11+
LL | pub struct HeaderMap;
12+
| ^^^^^^^^^^^^^^^^^^^^^
13+
= help: use `self::HeaderMap` to refer to this struct unambiguously
14+
note: `HeaderMap` could also refer to the struct imported here
15+
--> $DIR/import-after-macro-expand-10.rs:6:13
16+
|
17+
LL | pub use self::http::*;
18+
| ^^^^^^^^^^^^^
19+
= help: use `self::HeaderMap` to refer to this struct unambiguously
20+
21+
error: aborting due to 1 previous error
22+
23+
For more information about this error, try `rustc --explain E0659`.

tests/ui/imports/import-after-macro-expand-11.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//@ check-pass
2-
31
#[derive(Debug)]
42
struct H;
53

@@ -14,6 +12,7 @@ mod p {
1412

1513
fn f() {
1614
let h: crate::p::H = H;
15+
//~^ ERROR ambiguous
1716
}
1817
}
1918
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
error[E0659]: `H` is ambiguous
2+
--> $DIR/import-after-macro-expand-11.rs:14:29
3+
|
4+
LL | let h: crate::p::H = H;
5+
| ^ ambiguous name
6+
|
7+
= note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution
8+
note: `H` could refer to the struct defined here
9+
--> $DIR/import-after-macro-expand-11.rs:8:5
10+
|
11+
LL | struct H;
12+
| ^^^^^^^^^
13+
= help: use `self::H` to refer to this struct unambiguously
14+
note: `H` could also refer to the struct imported here
15+
--> $DIR/import-after-macro-expand-11.rs:5:9
16+
|
17+
LL | use super::*;
18+
| ^^^^^^^^
19+
= help: use `self::H` to refer to this struct unambiguously
20+
21+
error: aborting due to 1 previous error
22+
23+
For more information about this error, try `rustc --explain E0659`.

tests/ui/imports/import-after-macro-expand-13.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@ check-pass
21
// similar as `import-after-macro-expand-6.rs`
32

43
use crate::a::HeaderMap;
@@ -19,4 +18,5 @@ mod a {
1918

2019
fn main() {
2120
let h: crate::b::HeaderMap = HeaderMap;
21+
//~^ ERROR ambiguous
2222
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
error[E0659]: `HeaderMap` is ambiguous
2+
--> $DIR/import-after-macro-expand-13.rs:20:22
3+
|
4+
LL | let h: crate::b::HeaderMap = HeaderMap;
5+
| ^^^^^^^^^ ambiguous name
6+
|
7+
= note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution
8+
note: `HeaderMap` could refer to the struct defined here
9+
--> $DIR/import-after-macro-expand-13.rs:12:5
10+
|
11+
LL | pub struct HeaderMap;
12+
| ^^^^^^^^^^^^^^^^^^^^^
13+
= help: use `self::HeaderMap` to refer to this struct unambiguously
14+
note: `HeaderMap` could also refer to the struct imported here
15+
--> $DIR/import-after-macro-expand-13.rs:10:13
16+
|
17+
LL | pub use self::http::*;
18+
| ^^^^^^^^^^^^^
19+
= help: use `self::HeaderMap` to refer to this struct unambiguously
20+
21+
error: aborting due to 1 previous error
22+
23+
For more information about this error, try `rustc --explain E0659`.

tests/ui/imports/import-after-macro-expand-14.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
//@ check-pass
2-
31
use crate::a::HeaderMap;
42

53
mod b {
@@ -19,4 +17,5 @@ mod a {
1917

2018
fn main() {
2119
let h: crate::b::HeaderMap = HeaderMap;
20+
//~^ ERROR ambiguous
2221
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
error[E0659]: `HeaderMap` is ambiguous
2+
--> $DIR/import-after-macro-expand-14.rs:19:22
3+
|
4+
LL | let h: crate::b::HeaderMap = HeaderMap;
5+
| ^^^^^^^^^ ambiguous name
6+
|
7+
= note: ambiguous because of a conflict between a macro-expanded name and a less macro-expanded name from outer scope during import or macro resolution
8+
note: `HeaderMap` could refer to the struct defined here
9+
--> $DIR/import-after-macro-expand-14.rs:11:5
10+
|
11+
LL | pub struct HeaderMap;
12+
| ^^^^^^^^^^^^^^^^^^^^^
13+
= help: use `self::HeaderMap` to refer to this struct unambiguously
14+
note: `HeaderMap` could also refer to the struct imported here
15+
--> $DIR/import-after-macro-expand-14.rs:9:13
16+
|
17+
LL | pub use self::http::*;
18+
| ^^^^^^^^^^^^^
19+
= help: use `self::HeaderMap` to refer to this struct unambiguously
20+
21+
error: aborting due to 1 previous error
22+
23+
For more information about this error, try `rustc --explain E0659`.

tests/ui/imports/import-after-macro-expand-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//@ check-pass
21
// https://github.com/rust-lang/rust/issues/56593#issuecomment-1133174514
32

43
use thing::*;
@@ -13,6 +12,7 @@ mod tests {
1312

1413
fn test_thing() {
1514
let thing: crate::Thing = Thing::Foo;
15+
//~^ ERROR ambiguous
1616
}
1717
}
1818

0 commit comments

Comments
 (0)