diff --git a/tests/ui/resolve/ice-inconsistent-resolution-with-import-separators-issue-147208.rs b/tests/ui/resolve/ice-inconsistent-resolution-with-import-separators-issue-147208.rs new file mode 100644 index 0000000000000..e6c76aaa4f1f2 --- /dev/null +++ b/tests/ui/resolve/ice-inconsistent-resolution-with-import-separators-issue-147208.rs @@ -0,0 +1,18 @@ +//@ edition: 2024 + +// Regression test for issue https://github.com/rust-lang/rust/issues/147208 +// Fix by https://github.com/rust-lang/rust/pull/149681 + +use foo::bar::E::*; + //~^ ERROR cannot find module or crate `foo` in this scope +use foo::bar::test_use::io as std_io; + //~^ ERROR cannot find module or crate `foo` in this scope + //~| ERROR unresolved import `foo::bar::test_use::io` +fn main() { + Foo(()); + //~^ ERROR cannot find function, tuple struct or tuple variant `Foo` in this scope + { + use ::std::io as std_io; + use std_io::stdout; + } +} diff --git a/tests/ui/resolve/ice-inconsistent-resolution-with-import-separators-issue-147208.stderr b/tests/ui/resolve/ice-inconsistent-resolution-with-import-separators-issue-147208.stderr new file mode 100644 index 0000000000000..a7c6dc95cee70 --- /dev/null +++ b/tests/ui/resolve/ice-inconsistent-resolution-with-import-separators-issue-147208.stderr @@ -0,0 +1,32 @@ +error[E0433]: cannot find module or crate `foo` in this scope + --> $DIR/ice-inconsistent-resolution-with-import-separators-issue-147208.rs:6:5 + | +LL | use foo::bar::E::*; + | ^^^ use of unresolved module or unlinked crate `foo` + | + = help: you might be missing a crate named `foo` + +error[E0433]: cannot find module or crate `foo` in this scope + --> $DIR/ice-inconsistent-resolution-with-import-separators-issue-147208.rs:8:5 + | +LL | use foo::bar::test_use::io as std_io; + | ^^^ use of unresolved module or unlinked crate `foo` + | + = help: you might be missing a crate named `foo` + +error[E0432]: unresolved import `foo::bar::test_use::io` + --> $DIR/ice-inconsistent-resolution-with-import-separators-issue-147208.rs:8:5 + | +LL | use foo::bar::test_use::io as std_io; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0425]: cannot find function, tuple struct or tuple variant `Foo` in this scope + --> $DIR/ice-inconsistent-resolution-with-import-separators-issue-147208.rs:12:5 + | +LL | Foo(()); + | ^^^ not found in this scope + +error: aborting due to 4 previous errors + +Some errors have detailed explanations: E0425, E0432, E0433. +For more information about an error, try `rustc --explain E0425`. diff --git a/tests/ui/resolve/ice-inconsistent-resolution-with-mod-issue-147208.rs b/tests/ui/resolve/ice-inconsistent-resolution-with-mod-issue-147208.rs new file mode 100644 index 0000000000000..2797497da80c0 --- /dev/null +++ b/tests/ui/resolve/ice-inconsistent-resolution-with-mod-issue-147208.rs @@ -0,0 +1,13 @@ +//@ edition: 2024 + +// Regression test for issue https://github.com/rust-lang/rust/issues/147208 +// Fix by https://github.com/rust-lang/rust/pull/149681 + +use bar::foo; + //~^ ERROR unresolved import `bar` +use foo::bar; +fn main() { + mod bar; + //~^ ERROR cannot declare a file module inside a block unless it has a path attribute + use bar::foo; +} diff --git a/tests/ui/resolve/ice-inconsistent-resolution-with-mod-issue-147208.stderr b/tests/ui/resolve/ice-inconsistent-resolution-with-mod-issue-147208.stderr new file mode 100644 index 0000000000000..e5d293630cdfa --- /dev/null +++ b/tests/ui/resolve/ice-inconsistent-resolution-with-mod-issue-147208.stderr @@ -0,0 +1,19 @@ +error: cannot declare a file module inside a block unless it has a path attribute + --> $DIR/ice-inconsistent-resolution-with-mod-issue-147208.rs:10:5 + | +LL | mod bar; + | ^^^^^^^^ + | + = note: file modules are usually placed outside of blocks, at the top level of the file + +error[E0432]: unresolved import `bar` + --> $DIR/ice-inconsistent-resolution-with-mod-issue-147208.rs:6:5 + | +LL | use bar::foo; + | ^^^ use of unresolved module or unlinked crate `bar` + | + = help: you might be missing a crate named `bar` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0432`.