Skip to content

Commit 5300385

Browse files
authored
Rollup merge of #161302 - KevinA-cpu:regression-test-147208, r=khyperia
Add regression test for inconsistent import resolution from issue 147208 closes #147208
2 parents 44f1ad0 + 1675872 commit 5300385

4 files changed

Lines changed: 82 additions & 0 deletions
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//@ edition: 2024
2+
3+
// Regression test for issue https://github.com/rust-lang/rust/issues/147208
4+
// Fix by https://github.com/rust-lang/rust/pull/149681
5+
6+
use foo::bar::E::*;
7+
//~^ ERROR cannot find module or crate `foo` in this scope
8+
use foo::bar::test_use::io as std_io;
9+
//~^ ERROR cannot find module or crate `foo` in this scope
10+
//~| ERROR unresolved import `foo::bar::test_use::io`
11+
fn main() {
12+
Foo(());
13+
//~^ ERROR cannot find function, tuple struct or tuple variant `Foo` in this scope
14+
{
15+
use ::std::io as std_io;
16+
use std_io::stdout;
17+
}
18+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
error[E0433]: cannot find module or crate `foo` in this scope
2+
--> $DIR/ice-inconsistent-resolution-with-import-separators-issue-147208.rs:6:5
3+
|
4+
LL | use foo::bar::E::*;
5+
| ^^^ use of unresolved module or unlinked crate `foo`
6+
|
7+
= help: you might be missing a crate named `foo`
8+
9+
error[E0433]: cannot find module or crate `foo` in this scope
10+
--> $DIR/ice-inconsistent-resolution-with-import-separators-issue-147208.rs:8:5
11+
|
12+
LL | use foo::bar::test_use::io as std_io;
13+
| ^^^ use of unresolved module or unlinked crate `foo`
14+
|
15+
= help: you might be missing a crate named `foo`
16+
17+
error[E0432]: unresolved import `foo::bar::test_use::io`
18+
--> $DIR/ice-inconsistent-resolution-with-import-separators-issue-147208.rs:8:5
19+
|
20+
LL | use foo::bar::test_use::io as std_io;
21+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
22+
23+
error[E0425]: cannot find function, tuple struct or tuple variant `Foo` in this scope
24+
--> $DIR/ice-inconsistent-resolution-with-import-separators-issue-147208.rs:12:5
25+
|
26+
LL | Foo(());
27+
| ^^^ not found in this scope
28+
29+
error: aborting due to 4 previous errors
30+
31+
Some errors have detailed explanations: E0425, E0432, E0433.
32+
For more information about an error, try `rustc --explain E0425`.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@ edition: 2024
2+
3+
// Regression test for issue https://github.com/rust-lang/rust/issues/147208
4+
// Fix by https://github.com/rust-lang/rust/pull/149681
5+
6+
use bar::foo;
7+
//~^ ERROR unresolved import `bar`
8+
use foo::bar;
9+
fn main() {
10+
mod bar;
11+
//~^ ERROR cannot declare a file module inside a block unless it has a path attribute
12+
use bar::foo;
13+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error: cannot declare a file module inside a block unless it has a path attribute
2+
--> $DIR/ice-inconsistent-resolution-with-mod-issue-147208.rs:10:5
3+
|
4+
LL | mod bar;
5+
| ^^^^^^^^
6+
|
7+
= note: file modules are usually placed outside of blocks, at the top level of the file
8+
9+
error[E0432]: unresolved import `bar`
10+
--> $DIR/ice-inconsistent-resolution-with-mod-issue-147208.rs:6:5
11+
|
12+
LL | use bar::foo;
13+
| ^^^ use of unresolved module or unlinked crate `bar`
14+
|
15+
= help: you might be missing a crate named `bar`
16+
17+
error: aborting due to 2 previous errors
18+
19+
For more information about this error, try `rustc --explain E0432`.

0 commit comments

Comments
 (0)