summaryrefslogtreecommitdiffstats
path: root/tests/ui/imports
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
commitd1b2d29528b7794b41e66fc2136e395a02f8529b (patch)
treea4a17504b260206dec3cf55b2dca82929a348ac2 /tests/ui/imports
parentReleasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz
rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--tests/ui/imports/ambiguous-1.rs30
-rw-r--r--tests/ui/imports/ambiguous-1.stderr36
-rw-r--r--tests/ui/imports/ambiguous-10.rs19
-rw-r--r--tests/ui/imports/ambiguous-10.stderr25
-rw-r--r--tests/ui/imports/ambiguous-11.rs14
-rw-r--r--tests/ui/imports/ambiguous-11.stderr23
-rw-r--r--tests/ui/imports/ambiguous-12.rs25
-rw-r--r--tests/ui/imports/ambiguous-12.stderr25
-rw-r--r--tests/ui/imports/ambiguous-13.rs22
-rw-r--r--tests/ui/imports/ambiguous-13.stderr25
-rw-r--r--tests/ui/imports/ambiguous-14.rs26
-rw-r--r--tests/ui/imports/ambiguous-14.stderr25
-rw-r--r--tests/ui/imports/ambiguous-15.rs27
-rw-r--r--tests/ui/imports/ambiguous-15.stderr25
-rw-r--r--tests/ui/imports/ambiguous-16.rs27
-rw-r--r--tests/ui/imports/ambiguous-16.stderr25
-rw-r--r--tests/ui/imports/ambiguous-17.rs29
-rw-r--r--tests/ui/imports/ambiguous-17.stderr35
-rw-r--r--tests/ui/imports/ambiguous-2.rs9
-rw-r--r--tests/ui/imports/ambiguous-3.rs21
-rw-r--r--tests/ui/imports/ambiguous-3.stderr25
-rw-r--r--tests/ui/imports/ambiguous-4-extern.rs26
-rw-r--r--tests/ui/imports/ambiguous-4-extern.stderr35
-rw-r--r--tests/ui/imports/ambiguous-4.rs9
-rw-r--r--tests/ui/imports/ambiguous-5.rs24
-rw-r--r--tests/ui/imports/ambiguous-5.stderr25
-rw-r--r--tests/ui/imports/ambiguous-6.rs20
-rw-r--r--tests/ui/imports/ambiguous-6.stderr25
-rw-r--r--tests/ui/imports/ambiguous-7.rs18
-rw-r--r--tests/ui/imports/ambiguous-7.stderr23
-rw-r--r--tests/ui/imports/ambiguous-8.rs14
-rw-r--r--tests/ui/imports/ambiguous-8.stderr23
-rw-r--r--tests/ui/imports/ambiguous-9.rs29
-rw-r--r--tests/ui/imports/ambiguous-9.stderr65
-rw-r--r--tests/ui/imports/auxiliary/ambiguous-11-extern.rs6
-rw-r--r--tests/ui/imports/auxiliary/ambiguous-8-extern.rs12
-rw-r--r--tests/ui/imports/auxiliary/extern-with-ambiguous-1-extern.rs4
-rw-r--r--tests/ui/imports/auxiliary/extern-with-ambiguous-2-extern.rs9
-rw-r--r--tests/ui/imports/auxiliary/extern-with-ambiguous-3-extern.rs14
-rw-r--r--tests/ui/imports/duplicate.rs2
-rw-r--r--tests/ui/imports/duplicate.stderr37
-rw-r--r--tests/ui/imports/extern-with-ambiguous-1.rs19
-rw-r--r--tests/ui/imports/extern-with-ambiguous-1.stderr23
-rw-r--r--tests/ui/imports/extern-with-ambiguous-2.rs16
-rw-r--r--tests/ui/imports/extern-with-ambiguous-3.rs17
-rw-r--r--tests/ui/imports/import-after-macro-expand-1.rs19
-rw-r--r--tests/ui/imports/import-after-macro-expand-2.rs27
-rw-r--r--tests/ui/imports/import-after-macro-expand-3.rs24
-rw-r--r--tests/ui/imports/import-after-macro-expand-4.rs30
-rw-r--r--tests/ui/imports/import-after-macro-expand-4.stderr53
-rw-r--r--tests/ui/imports/import-after-macro-expand-5.rs31
-rw-r--r--tests/ui/imports/import-after-macro-expand-6.rs24
-rw-r--r--tests/ui/imports/import-after-macro-expand-7.rs21
-rw-r--r--tests/ui/imports/import-after-macro-expand-8.rs22
-rw-r--r--tests/ui/imports/issue-113953.rs6
-rw-r--r--tests/ui/imports/issue-113953.stderr9
-rw-r--r--tests/ui/imports/issue-81413.rs23
-rw-r--r--tests/ui/imports/issue-81413.stderr11
-rw-r--r--tests/ui/imports/resolve-other-libc.rs14
-rw-r--r--tests/ui/imports/resolve-other-libc.stderr8
60 files changed, 1328 insertions, 7 deletions
diff --git a/tests/ui/imports/ambiguous-1.rs b/tests/ui/imports/ambiguous-1.rs
new file mode 100644
index 000000000..2c9815864
--- /dev/null
+++ b/tests/ui/imports/ambiguous-1.rs
@@ -0,0 +1,30 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/112743#issuecomment-1601986883
+
+macro_rules! m {
+ () => {
+ pub fn id() {}
+ };
+}
+
+mod openssl {
+ pub use self::evp::*;
+ //~^ WARNING ambiguous glob re-exports
+ pub use self::handwritten::*;
+
+ mod evp {
+ m!();
+ }
+
+ mod handwritten {
+ m!();
+ }
+}
+
+pub use openssl::*;
+
+fn main() {
+ id();
+ //~^ WARNING `id` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
diff --git a/tests/ui/imports/ambiguous-1.stderr b/tests/ui/imports/ambiguous-1.stderr
new file mode 100644
index 000000000..61b3077c3
--- /dev/null
+++ b/tests/ui/imports/ambiguous-1.stderr
@@ -0,0 +1,36 @@
+warning: ambiguous glob re-exports
+ --> $DIR/ambiguous-1.rs:11:13
+ |
+LL | pub use self::evp::*;
+ | ^^^^^^^^^^^^ the name `id` in the value namespace is first re-exported here
+LL |
+LL | pub use self::handwritten::*;
+ | -------------------- but the name `id` in the value namespace is also re-exported here
+ |
+ = note: `#[warn(ambiguous_glob_reexports)]` on by default
+
+warning: `id` is ambiguous
+ --> $DIR/ambiguous-1.rs:27:5
+ |
+LL | id();
+ | ^^ ambiguous name
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `id` could refer to the function imported here
+ --> $DIR/ambiguous-1.rs:11:13
+ |
+LL | pub use self::evp::*;
+ | ^^^^^^^^^^^^
+ = help: consider adding an explicit import of `id` to disambiguate
+note: `id` could also refer to the function imported here
+ --> $DIR/ambiguous-1.rs:13:13
+ |
+LL | pub use self::handwritten::*;
+ | ^^^^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `id` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/imports/ambiguous-10.rs b/tests/ui/imports/ambiguous-10.rs
new file mode 100644
index 000000000..5078b734b
--- /dev/null
+++ b/tests/ui/imports/ambiguous-10.rs
@@ -0,0 +1,19 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1637022296
+
+mod a {
+ pub enum Token {}
+}
+
+mod b {
+ use crate::a::*;
+ #[derive(Debug)]
+ pub enum Token {}
+}
+
+use crate::a::*;
+use crate::b::*;
+fn c(_: Token) {}
+//~^ WARNING `Token` is ambiguous
+//~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+fn main() { }
diff --git a/tests/ui/imports/ambiguous-10.stderr b/tests/ui/imports/ambiguous-10.stderr
new file mode 100644
index 000000000..704af616b
--- /dev/null
+++ b/tests/ui/imports/ambiguous-10.stderr
@@ -0,0 +1,25 @@
+warning: `Token` is ambiguous
+ --> $DIR/ambiguous-10.rs:16:9
+ |
+LL | fn c(_: Token) {}
+ | ^^^^^ ambiguous name
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `Token` could refer to the enum imported here
+ --> $DIR/ambiguous-10.rs:14:5
+ |
+LL | use crate::a::*;
+ | ^^^^^^^^^^^
+ = help: consider adding an explicit import of `Token` to disambiguate
+note: `Token` could also refer to the enum imported here
+ --> $DIR/ambiguous-10.rs:15:5
+ |
+LL | use crate::b::*;
+ | ^^^^^^^^^^^
+ = help: consider adding an explicit import of `Token` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/imports/ambiguous-11.rs b/tests/ui/imports/ambiguous-11.rs
new file mode 100644
index 000000000..0565b9d22
--- /dev/null
+++ b/tests/ui/imports/ambiguous-11.rs
@@ -0,0 +1,14 @@
+// aux-build: ambiguous-11-extern.rs
+
+extern crate ambiguous_11_extern;
+
+mod s {
+ pub trait Error {}
+}
+
+use s::*;
+use ambiguous_11_extern::*;
+fn a<E: Error>(_: E) {}
+//~^ ERROR `Error` is ambiguous
+
+fn main() {}
diff --git a/tests/ui/imports/ambiguous-11.stderr b/tests/ui/imports/ambiguous-11.stderr
new file mode 100644
index 000000000..765d6afa8
--- /dev/null
+++ b/tests/ui/imports/ambiguous-11.stderr
@@ -0,0 +1,23 @@
+error[E0659]: `Error` is ambiguous
+ --> $DIR/ambiguous-11.rs:11:9
+ |
+LL | fn a<E: Error>(_: E) {}
+ | ^^^^^ ambiguous name
+ |
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `Error` could refer to the trait imported here
+ --> $DIR/ambiguous-11.rs:9:5
+ |
+LL | use s::*;
+ | ^^^^
+ = help: consider adding an explicit import of `Error` to disambiguate
+note: `Error` could also refer to the enum imported here
+ --> $DIR/ambiguous-11.rs:10:5
+ |
+LL | use ambiguous_11_extern::*;
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `Error` to disambiguate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/tests/ui/imports/ambiguous-12.rs b/tests/ui/imports/ambiguous-12.rs
new file mode 100644
index 000000000..6259c1357
--- /dev/null
+++ b/tests/ui/imports/ambiguous-12.rs
@@ -0,0 +1,25 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1637022296
+
+macro_rules! m {
+ () => {
+ pub fn b() {}
+ };
+}
+
+pub mod ciphertext {
+ m!();
+}
+pub mod public {
+ use crate::ciphertext::*;
+ m!();
+}
+
+use crate::ciphertext::*;
+use crate::public::*;
+
+fn main() {
+ b();
+ //~^ WARNING `b` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
diff --git a/tests/ui/imports/ambiguous-12.stderr b/tests/ui/imports/ambiguous-12.stderr
new file mode 100644
index 000000000..4725c3884
--- /dev/null
+++ b/tests/ui/imports/ambiguous-12.stderr
@@ -0,0 +1,25 @@
+warning: `b` is ambiguous
+ --> $DIR/ambiguous-12.rs:22:5
+ |
+LL | b();
+ | ^ ambiguous name
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `b` could refer to the function imported here
+ --> $DIR/ambiguous-12.rs:18:5
+ |
+LL | use crate::ciphertext::*;
+ | ^^^^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `b` to disambiguate
+note: `b` could also refer to the function imported here
+ --> $DIR/ambiguous-12.rs:19:5
+ |
+LL | use crate::public::*;
+ | ^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `b` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/imports/ambiguous-13.rs b/tests/ui/imports/ambiguous-13.rs
new file mode 100644
index 000000000..82f933c49
--- /dev/null
+++ b/tests/ui/imports/ambiguous-13.rs
@@ -0,0 +1,22 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1637022296
+
+pub mod object {
+ #[derive(Debug)]
+ pub struct Rect;
+}
+
+pub mod content {
+ use crate::object::*;
+
+ #[derive(Debug)]
+ pub struct Rect;
+}
+
+use crate::object::*;
+use crate::content::*;
+
+fn a(_: Rect) {}
+//~^ WARNING `Rect` is ambiguous
+//~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+fn main() { }
diff --git a/tests/ui/imports/ambiguous-13.stderr b/tests/ui/imports/ambiguous-13.stderr
new file mode 100644
index 000000000..3e78100b6
--- /dev/null
+++ b/tests/ui/imports/ambiguous-13.stderr
@@ -0,0 +1,25 @@
+warning: `Rect` is ambiguous
+ --> $DIR/ambiguous-13.rs:19:9
+ |
+LL | fn a(_: Rect) {}
+ | ^^^^ ambiguous name
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `Rect` could refer to the struct imported here
+ --> $DIR/ambiguous-13.rs:16:5
+ |
+LL | use crate::object::*;
+ | ^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `Rect` to disambiguate
+note: `Rect` could also refer to the struct imported here
+ --> $DIR/ambiguous-13.rs:17:5
+ |
+LL | use crate::content::*;
+ | ^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `Rect` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/imports/ambiguous-14.rs b/tests/ui/imports/ambiguous-14.rs
new file mode 100644
index 000000000..5e880b48c
--- /dev/null
+++ b/tests/ui/imports/ambiguous-14.rs
@@ -0,0 +1,26 @@
+// check-pass
+// https://github.com/rust-lang/rust/issues/98467
+
+mod a {
+ pub fn foo() {}
+}
+
+mod b {
+ pub fn foo() {}
+}
+
+mod f {
+ pub use a::*;
+ pub use b::*;
+}
+
+mod g {
+ pub use a::*;
+ pub use f::*;
+}
+
+fn main() {
+ g::foo();
+ //~^ WARNING `foo` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
diff --git a/tests/ui/imports/ambiguous-14.stderr b/tests/ui/imports/ambiguous-14.stderr
new file mode 100644
index 000000000..bece58536
--- /dev/null
+++ b/tests/ui/imports/ambiguous-14.stderr
@@ -0,0 +1,25 @@
+warning: `foo` is ambiguous
+ --> $DIR/ambiguous-14.rs:23:8
+ |
+LL | g::foo();
+ | ^^^ ambiguous name
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `foo` could refer to the function imported here
+ --> $DIR/ambiguous-14.rs:13:13
+ |
+LL | pub use a::*;
+ | ^^^^
+ = help: consider adding an explicit import of `foo` to disambiguate
+note: `foo` could also refer to the function imported here
+ --> $DIR/ambiguous-14.rs:14:13
+ |
+LL | pub use b::*;
+ | ^^^^
+ = help: consider adding an explicit import of `foo` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/imports/ambiguous-15.rs b/tests/ui/imports/ambiguous-15.rs
new file mode 100644
index 000000000..8c75c393a
--- /dev/null
+++ b/tests/ui/imports/ambiguous-15.rs
@@ -0,0 +1,27 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1638206152
+
+mod t2 {
+ #[derive(Debug)]
+ pub enum Error {}
+
+ mod s {
+ pub use std::fmt::*;
+ pub trait Error: Sized {}
+ }
+
+ use self::s::*;
+}
+
+pub use t2::*;
+
+mod t3 {
+ pub trait Error {}
+}
+
+use self::t3::*;
+fn a<E: Error>(_: E) {}
+//~^ WARNING `Error` is ambiguous
+//~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+fn main() {}
diff --git a/tests/ui/imports/ambiguous-15.stderr b/tests/ui/imports/ambiguous-15.stderr
new file mode 100644
index 000000000..838256752
--- /dev/null
+++ b/tests/ui/imports/ambiguous-15.stderr
@@ -0,0 +1,25 @@
+warning: `Error` is ambiguous
+ --> $DIR/ambiguous-15.rs:23:9
+ |
+LL | fn a<E: Error>(_: E) {}
+ | ^^^^^ ambiguous name
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `Error` could refer to the trait imported here
+ --> $DIR/ambiguous-15.rs:22:5
+ |
+LL | use self::t3::*;
+ | ^^^^^^^^^^^
+ = help: consider adding an explicit import of `Error` to disambiguate
+note: `Error` could also refer to the enum imported here
+ --> $DIR/ambiguous-15.rs:16:9
+ |
+LL | pub use t2::*;
+ | ^^^^^
+ = help: consider adding an explicit import of `Error` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/imports/ambiguous-16.rs b/tests/ui/imports/ambiguous-16.rs
new file mode 100644
index 000000000..e51e30e3e
--- /dev/null
+++ b/tests/ui/imports/ambiguous-16.rs
@@ -0,0 +1,27 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113099
+
+mod framing {
+ mod public_message {
+ use super::*;
+
+ #[derive(Debug)]
+ pub struct ConfirmedTranscriptHashInput;
+ }
+
+ mod public_message_in {
+ use super::*;
+
+ #[derive(Debug)]
+ pub struct ConfirmedTranscriptHashInput;
+ }
+
+ pub use self::public_message::*;
+ pub use self::public_message_in::*;
+}
+
+use crate::framing::ConfirmedTranscriptHashInput;
+//~^ WARNING `ConfirmedTranscriptHashInput` is ambiguous
+//~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+
+fn main() { }
diff --git a/tests/ui/imports/ambiguous-16.stderr b/tests/ui/imports/ambiguous-16.stderr
new file mode 100644
index 000000000..7366cabc4
--- /dev/null
+++ b/tests/ui/imports/ambiguous-16.stderr
@@ -0,0 +1,25 @@
+warning: `ConfirmedTranscriptHashInput` is ambiguous
+ --> $DIR/ambiguous-16.rs:23:21
+ |
+LL | use crate::framing::ConfirmedTranscriptHashInput;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ambiguous name
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `ConfirmedTranscriptHashInput` could refer to the struct imported here
+ --> $DIR/ambiguous-16.rs:19:13
+ |
+LL | pub use self::public_message::*;
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `ConfirmedTranscriptHashInput` to disambiguate
+note: `ConfirmedTranscriptHashInput` could also refer to the struct imported here
+ --> $DIR/ambiguous-16.rs:20:13
+ |
+LL | pub use self::public_message_in::*;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `ConfirmedTranscriptHashInput` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/imports/ambiguous-17.rs b/tests/ui/imports/ambiguous-17.rs
new file mode 100644
index 000000000..7d01404ce
--- /dev/null
+++ b/tests/ui/imports/ambiguous-17.rs
@@ -0,0 +1,29 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1638206152
+
+pub use evp::*; //~ WARNING ambiguous glob re-exports
+pub use handwritten::*;
+
+macro_rules! m {
+ () => {
+ pub fn id() {}
+ };
+}
+mod evp {
+ use *;
+ m!();
+}
+
+mod handwritten {
+ pub use handwritten::evp::*;
+ mod evp {
+ use *;
+ m!();
+ }
+}
+
+fn main() {
+ id();
+ //~^ WARNING `id` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
diff --git a/tests/ui/imports/ambiguous-17.stderr b/tests/ui/imports/ambiguous-17.stderr
new file mode 100644
index 000000000..55bc01095
--- /dev/null
+++ b/tests/ui/imports/ambiguous-17.stderr
@@ -0,0 +1,35 @@
+warning: ambiguous glob re-exports
+ --> $DIR/ambiguous-17.rs:4:9
+ |
+LL | pub use evp::*;
+ | ^^^^^^ the name `id` in the value namespace is first re-exported here
+LL | pub use handwritten::*;
+ | -------------- but the name `id` in the value namespace is also re-exported here
+ |
+ = note: `#[warn(ambiguous_glob_reexports)]` on by default
+
+warning: `id` is ambiguous
+ --> $DIR/ambiguous-17.rs:26:5
+ |
+LL | id();
+ | ^^ ambiguous name
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `id` could refer to the function imported here
+ --> $DIR/ambiguous-17.rs:4:9
+ |
+LL | pub use evp::*;
+ | ^^^^^^
+ = help: consider adding an explicit import of `id` to disambiguate
+note: `id` could also refer to the function imported here
+ --> $DIR/ambiguous-17.rs:5:9
+ |
+LL | pub use handwritten::*;
+ | ^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `id` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/imports/ambiguous-2.rs b/tests/ui/imports/ambiguous-2.rs
new file mode 100644
index 000000000..7b38f3006
--- /dev/null
+++ b/tests/ui/imports/ambiguous-2.rs
@@ -0,0 +1,9 @@
+// check-pass
+// aux-build: ../ambiguous-1.rs
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1633574396
+
+extern crate ambiguous_1;
+
+fn main() {
+ ambiguous_1::id();
+}
diff --git a/tests/ui/imports/ambiguous-3.rs b/tests/ui/imports/ambiguous-3.rs
new file mode 100644
index 000000000..61a5b6b83
--- /dev/null
+++ b/tests/ui/imports/ambiguous-3.rs
@@ -0,0 +1,21 @@
+// check-pass
+// https://github.com/rust-lang/rust/issues/47525
+
+fn main() {
+ use a::*;
+ x();
+ //~^ WARNING `x` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
+
+mod a {
+ mod b {
+ pub fn x() { println!(module_path!()); }
+ }
+ mod c {
+ pub fn x() { println!(module_path!()); }
+ }
+
+ pub use self::b::*;
+ pub use self::c::*;
+}
diff --git a/tests/ui/imports/ambiguous-3.stderr b/tests/ui/imports/ambiguous-3.stderr
new file mode 100644
index 000000000..f019f6d89
--- /dev/null
+++ b/tests/ui/imports/ambiguous-3.stderr
@@ -0,0 +1,25 @@
+warning: `x` is ambiguous
+ --> $DIR/ambiguous-3.rs:6:5
+ |
+LL | x();
+ | ^ ambiguous name
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `x` could refer to the function imported here
+ --> $DIR/ambiguous-3.rs:19:13
+ |
+LL | pub use self::b::*;
+ | ^^^^^^^^^^
+ = help: consider adding an explicit import of `x` to disambiguate
+note: `x` could also refer to the function imported here
+ --> $DIR/ambiguous-3.rs:20:13
+ |
+LL | pub use self::c::*;
+ | ^^^^^^^^^^
+ = help: consider adding an explicit import of `x` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/imports/ambiguous-4-extern.rs b/tests/ui/imports/ambiguous-4-extern.rs
new file mode 100644
index 000000000..02546768e
--- /dev/null
+++ b/tests/ui/imports/ambiguous-4-extern.rs
@@ -0,0 +1,26 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/112743#issuecomment-1601986883
+
+macro_rules! m {
+ () => {
+ pub fn id() {}
+ };
+}
+
+pub use evp::*; //~ WARNING ambiguous glob re-exports
+pub use handwritten::*;
+
+mod evp {
+ use *;
+ m! {}
+}
+mod handwritten {
+ use *;
+ m! {}
+}
+
+fn main() {
+ id();
+ //~^ WARNING `id` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
diff --git a/tests/ui/imports/ambiguous-4-extern.stderr b/tests/ui/imports/ambiguous-4-extern.stderr
new file mode 100644
index 000000000..001197321
--- /dev/null
+++ b/tests/ui/imports/ambiguous-4-extern.stderr
@@ -0,0 +1,35 @@
+warning: ambiguous glob re-exports
+ --> $DIR/ambiguous-4-extern.rs:10:9
+ |
+LL | pub use evp::*;
+ | ^^^^^^ the name `id` in the value namespace is first re-exported here
+LL | pub use handwritten::*;
+ | -------------- but the name `id` in the value namespace is also re-exported here
+ |
+ = note: `#[warn(ambiguous_glob_reexports)]` on by default
+
+warning: `id` is ambiguous
+ --> $DIR/ambiguous-4-extern.rs:23:5
+ |
+LL | id();
+ | ^^ ambiguous name
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `id` could refer to the function imported here
+ --> $DIR/ambiguous-4-extern.rs:10:9
+ |
+LL | pub use evp::*;
+ | ^^^^^^
+ = help: consider adding an explicit import of `id` to disambiguate
+note: `id` could also refer to the function imported here
+ --> $DIR/ambiguous-4-extern.rs:11:9
+ |
+LL | pub use handwritten::*;
+ | ^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `id` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/imports/ambiguous-4.rs b/tests/ui/imports/ambiguous-4.rs
new file mode 100644
index 000000000..24ae33784
--- /dev/null
+++ b/tests/ui/imports/ambiguous-4.rs
@@ -0,0 +1,9 @@
+// build-pass
+// aux-build: ../ambiguous-4-extern.rs
+
+extern crate ambiguous_4_extern;
+
+fn main() {
+ ambiguous_4_extern::id();
+ // `warning_ambiguous` had been lost at metadata.
+}
diff --git a/tests/ui/imports/ambiguous-5.rs b/tests/ui/imports/ambiguous-5.rs
new file mode 100644
index 000000000..56092246a
--- /dev/null
+++ b/tests/ui/imports/ambiguous-5.rs
@@ -0,0 +1,24 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1637022296
+
+mod a {
+ pub struct Class(u16);
+}
+
+use a::Class;
+
+mod gpos {
+ use super::gsubgpos::*;
+ use super::*;
+ struct MarkRecord(Class);
+ //~^ WARNING `Class` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
+
+mod gsubgpos {
+ use super::*;
+ #[derive(Clone)]
+ pub struct Class;
+}
+
+fn main() { }
diff --git a/tests/ui/imports/ambiguous-5.stderr b/tests/ui/imports/ambiguous-5.stderr
new file mode 100644
index 000000000..4bc35f86d
--- /dev/null
+++ b/tests/ui/imports/ambiguous-5.stderr
@@ -0,0 +1,25 @@
+warning: `Class` is ambiguous
+ --> $DIR/ambiguous-5.rs:13:23
+ |
+LL | struct MarkRecord(Class);
+ | ^^^^^ ambiguous name
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `Class` could refer to the struct imported here
+ --> $DIR/ambiguous-5.rs:12:9
+ |
+LL | use super::*;
+ | ^^^^^^^^
+ = help: consider adding an explicit import of `Class` to disambiguate
+note: `Class` could also refer to the struct imported here
+ --> $DIR/ambiguous-5.rs:11:9
+ |
+LL | use super::gsubgpos::*;
+ | ^^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `Class` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/imports/ambiguous-6.rs b/tests/ui/imports/ambiguous-6.rs
new file mode 100644
index 000000000..ba2623bf4
--- /dev/null
+++ b/tests/ui/imports/ambiguous-6.rs
@@ -0,0 +1,20 @@
+// check-pass
+// edition: 2021
+// https://github.com/rust-lang/rust/issues/112713
+
+pub fn foo() -> u32 {
+ use sub::*;
+ C
+ //~^ WARNING `C` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
+
+mod sub {
+ mod mod1 { pub const C: u32 = 1; }
+ mod mod2 { pub const C: u32 = 2; }
+
+ pub use mod1::*;
+ pub use mod2::*;
+}
+
+fn main() {}
diff --git a/tests/ui/imports/ambiguous-6.stderr b/tests/ui/imports/ambiguous-6.stderr
new file mode 100644
index 000000000..d7871a0b8
--- /dev/null
+++ b/tests/ui/imports/ambiguous-6.stderr
@@ -0,0 +1,25 @@
+warning: `C` is ambiguous
+ --> $DIR/ambiguous-6.rs:7:5
+ |
+LL | C
+ | ^ ambiguous name
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `C` could refer to the constant imported here
+ --> $DIR/ambiguous-6.rs:16:13
+ |
+LL | pub use mod1::*;
+ | ^^^^^^^
+ = help: consider adding an explicit import of `C` to disambiguate
+note: `C` could also refer to the constant imported here
+ --> $DIR/ambiguous-6.rs:17:13
+ |
+LL | pub use mod2::*;
+ | ^^^^^^^
+ = help: consider adding an explicit import of `C` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/imports/ambiguous-7.rs b/tests/ui/imports/ambiguous-7.rs
new file mode 100644
index 000000000..5148ff4cc
--- /dev/null
+++ b/tests/ui/imports/ambiguous-7.rs
@@ -0,0 +1,18 @@
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1638206152
+
+mod t2 {
+ #[derive(Debug)]
+ pub enum Error {}
+}
+
+pub use t2::*;
+
+mod t3 {
+ pub trait Error {}
+}
+
+use self::t3::*;
+fn a<E: Error>(_: E) {}
+//~^ ERROR `Error` is ambiguous
+
+fn main() {}
diff --git a/tests/ui/imports/ambiguous-7.stderr b/tests/ui/imports/ambiguous-7.stderr
new file mode 100644
index 000000000..2c6b56c61
--- /dev/null
+++ b/tests/ui/imports/ambiguous-7.stderr
@@ -0,0 +1,23 @@
+error[E0659]: `Error` is ambiguous
+ --> $DIR/ambiguous-7.rs:15:9
+ |
+LL | fn a<E: Error>(_: E) {}
+ | ^^^^^ ambiguous name
+ |
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `Error` could refer to the trait imported here
+ --> $DIR/ambiguous-7.rs:14:5
+ |
+LL | use self::t3::*;
+ | ^^^^^^^^^^^
+ = help: consider adding an explicit import of `Error` to disambiguate
+note: `Error` could also refer to the enum imported here
+ --> $DIR/ambiguous-7.rs:8:9
+ |
+LL | pub use t2::*;
+ | ^^^^^
+ = help: consider adding an explicit import of `Error` to disambiguate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/tests/ui/imports/ambiguous-8.rs b/tests/ui/imports/ambiguous-8.rs
new file mode 100644
index 000000000..d44cd9587
--- /dev/null
+++ b/tests/ui/imports/ambiguous-8.rs
@@ -0,0 +1,14 @@
+// aux-build: ambiguous-8-extern.rs
+
+extern crate ambiguous_8_extern;
+
+mod s {
+ pub trait Error {}
+}
+
+use s::*;
+use ambiguous_8_extern::*;
+fn a<E: Error>(_: E) {}
+//~^ ERROR `Error` is ambiguous
+
+fn main() {}
diff --git a/tests/ui/imports/ambiguous-8.stderr b/tests/ui/imports/ambiguous-8.stderr
new file mode 100644
index 000000000..32056fba6
--- /dev/null
+++ b/tests/ui/imports/ambiguous-8.stderr
@@ -0,0 +1,23 @@
+error[E0659]: `Error` is ambiguous
+ --> $DIR/ambiguous-8.rs:11:9
+ |
+LL | fn a<E: Error>(_: E) {}
+ | ^^^^^ ambiguous name
+ |
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `Error` could refer to the trait imported here
+ --> $DIR/ambiguous-8.rs:9:5
+ |
+LL | use s::*;
+ | ^^^^
+ = help: consider adding an explicit import of `Error` to disambiguate
+note: `Error` could also refer to the enum imported here
+ --> $DIR/ambiguous-8.rs:10:5
+ |
+LL | use ambiguous_8_extern::*;
+ | ^^^^^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `Error` to disambiguate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/tests/ui/imports/ambiguous-9.rs b/tests/ui/imports/ambiguous-9.rs
new file mode 100644
index 000000000..9da2467ad
--- /dev/null
+++ b/tests/ui/imports/ambiguous-9.rs
@@ -0,0 +1,29 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1638206152
+
+pub mod dsl {
+ mod range {
+ pub fn date_range() {}
+ }
+ pub use self::range::*; //~ WARNING ambiguous glob re-exports
+ use super::prelude::*;
+}
+
+pub mod prelude {
+ mod t {
+ pub fn date_range() {}
+ }
+ pub use self::t::*; //~ WARNING ambiguous glob re-exports
+ pub use super::dsl::*;
+}
+
+use dsl::*;
+use prelude::*;
+
+fn main() {
+ date_range();
+ //~^ WARNING `date_range` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ //~| WARNING `date_range` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+}
diff --git a/tests/ui/imports/ambiguous-9.stderr b/tests/ui/imports/ambiguous-9.stderr
new file mode 100644
index 000000000..6c7d79174
--- /dev/null
+++ b/tests/ui/imports/ambiguous-9.stderr
@@ -0,0 +1,65 @@
+warning: ambiguous glob re-exports
+ --> $DIR/ambiguous-9.rs:8:13
+ |
+LL | pub use self::range::*;
+ | ^^^^^^^^^^^^^^ the name `date_range` in the value namespace is first re-exported here
+LL | use super::prelude::*;
+ | ----------------- but the name `date_range` in the value namespace is also re-exported here
+ |
+ = note: `#[warn(ambiguous_glob_reexports)]` on by default
+
+warning: `date_range` is ambiguous
+ --> $DIR/ambiguous-9.rs:24:5
+ |
+LL | date_range();
+ | ^^^^^^^^^^ ambiguous name
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `date_range` could refer to the function imported here
+ --> $DIR/ambiguous-9.rs:8:13
+ |
+LL | pub use self::range::*;
+ | ^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `date_range` to disambiguate
+note: `date_range` could also refer to the function imported here
+ --> $DIR/ambiguous-9.rs:9:9
+ |
+LL | use super::prelude::*;
+ | ^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `date_range` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+warning: ambiguous glob re-exports
+ --> $DIR/ambiguous-9.rs:16:13
+ |
+LL | pub use self::t::*;
+ | ^^^^^^^^^^ the name `date_range` in the value namespace is first re-exported here
+LL | pub use super::dsl::*;
+ | ------------- but the name `date_range` in the value namespace is also re-exported here
+
+warning: `date_range` is ambiguous
+ --> $DIR/ambiguous-9.rs:24:5
+ |
+LL | date_range();
+ | ^^^^^^^^^^ ambiguous name
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `date_range` could refer to the function imported here
+ --> $DIR/ambiguous-9.rs:20:5
+ |
+LL | use dsl::*;
+ | ^^^^^^
+ = help: consider adding an explicit import of `date_range` to disambiguate
+note: `date_range` could also refer to the function imported here
+ --> $DIR/ambiguous-9.rs:21:5
+ |
+LL | use prelude::*;
+ | ^^^^^^^^^^
+ = help: consider adding an explicit import of `date_range` to disambiguate
+
+warning: 4 warnings emitted
+
diff --git a/tests/ui/imports/auxiliary/ambiguous-11-extern.rs b/tests/ui/imports/auxiliary/ambiguous-11-extern.rs
new file mode 100644
index 000000000..e679bc3dc
--- /dev/null
+++ b/tests/ui/imports/auxiliary/ambiguous-11-extern.rs
@@ -0,0 +1,6 @@
+mod t2 {
+ #[derive(Debug)]
+ pub enum Error {}
+}
+
+pub use t2::*;
diff --git a/tests/ui/imports/auxiliary/ambiguous-8-extern.rs b/tests/ui/imports/auxiliary/ambiguous-8-extern.rs
new file mode 100644
index 000000000..c7bf1bae0
--- /dev/null
+++ b/tests/ui/imports/auxiliary/ambiguous-8-extern.rs
@@ -0,0 +1,12 @@
+mod t2 {
+ #[derive(Debug)]
+ pub enum Error {}
+
+ mod t {
+ pub trait Error: Sized {}
+ }
+
+ use self::t::*;
+}
+
+pub use t2::*;
diff --git a/tests/ui/imports/auxiliary/extern-with-ambiguous-1-extern.rs b/tests/ui/imports/auxiliary/extern-with-ambiguous-1-extern.rs
new file mode 100644
index 000000000..5cd102122
--- /dev/null
+++ b/tests/ui/imports/auxiliary/extern-with-ambiguous-1-extern.rs
@@ -0,0 +1,4 @@
+mod a {
+ pub mod error {}
+}
+pub use a::*;
diff --git a/tests/ui/imports/auxiliary/extern-with-ambiguous-2-extern.rs b/tests/ui/imports/auxiliary/extern-with-ambiguous-2-extern.rs
new file mode 100644
index 000000000..378996768
--- /dev/null
+++ b/tests/ui/imports/auxiliary/extern-with-ambiguous-2-extern.rs
@@ -0,0 +1,9 @@
+mod a {
+ pub mod error {}
+}
+pub use a::*;
+
+mod b {
+ pub mod error {}
+}
+pub use b::*;
diff --git a/tests/ui/imports/auxiliary/extern-with-ambiguous-3-extern.rs b/tests/ui/imports/auxiliary/extern-with-ambiguous-3-extern.rs
new file mode 100644
index 000000000..ad4e04804
--- /dev/null
+++ b/tests/ui/imports/auxiliary/extern-with-ambiguous-3-extern.rs
@@ -0,0 +1,14 @@
+mod a {
+ pub mod error {}
+}
+pub use a::*;
+
+mod b {
+ pub mod error {}
+}
+pub use b::*;
+
+mod c {
+ pub mod error {}
+}
+pub use c::*;
diff --git a/tests/ui/imports/duplicate.rs b/tests/ui/imports/duplicate.rs
index db6538969..0c5a376da 100644
--- a/tests/ui/imports/duplicate.rs
+++ b/tests/ui/imports/duplicate.rs
@@ -34,6 +34,8 @@ fn main() {
e::foo();
f::foo(); //~ ERROR `foo` is ambiguous
g::foo();
+ //~^ WARNING `foo` is ambiguous
+ //~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
}
mod ambiguous_module_errors {
diff --git a/tests/ui/imports/duplicate.stderr b/tests/ui/imports/duplicate.stderr
index 997a2741b..d7a7dfce9 100644
--- a/tests/ui/imports/duplicate.stderr
+++ b/tests/ui/imports/duplicate.stderr
@@ -9,20 +9,20 @@ LL | use a::foo;
= note: `foo` must be defined only once in the value namespace of this module
error[E0659]: `foo` is ambiguous
- --> $DIR/duplicate.rs:46:15
+ --> $DIR/duplicate.rs:48:15
|
LL | use self::foo::bar;
| ^^^ ambiguous name
|
= note: ambiguous because of multiple glob imports of a name in the same module
note: `foo` could refer to the module imported here
- --> $DIR/duplicate.rs:43:9
+ --> $DIR/duplicate.rs:45:9
|
LL | use self::m1::*;
| ^^^^^^^^^^^
= help: consider adding an explicit import of `foo` to disambiguate
note: `foo` could also refer to the module imported here
- --> $DIR/duplicate.rs:44:9
+ --> $DIR/duplicate.rs:46:9
|
LL | use self::m2::*;
| ^^^^^^^^^^^
@@ -49,26 +49,49 @@ LL | pub use b::*;
= help: consider adding an explicit import of `foo` to disambiguate
error[E0659]: `foo` is ambiguous
- --> $DIR/duplicate.rs:49:9
+ --> $DIR/duplicate.rs:51:9
|
LL | foo::bar();
| ^^^ ambiguous name
|
= note: ambiguous because of multiple glob imports of a name in the same module
note: `foo` could refer to the module imported here
- --> $DIR/duplicate.rs:43:9
+ --> $DIR/duplicate.rs:45:9
|
LL | use self::m1::*;
| ^^^^^^^^^^^
= help: consider adding an explicit import of `foo` to disambiguate
note: `foo` could also refer to the module imported here
- --> $DIR/duplicate.rs:44:9
+ --> $DIR/duplicate.rs:46:9
|
LL | use self::m2::*;
| ^^^^^^^^^^^
= help: consider adding an explicit import of `foo` to disambiguate
-error: aborting due to 4 previous errors
+warning: `foo` is ambiguous
+ --> $DIR/duplicate.rs:36:8
+ |
+LL | g::foo();
+ | ^^^ ambiguous name
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #114095 <https://github.com/rust-lang/rust/issues/114095>
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `foo` could refer to the function imported here
+ --> $DIR/duplicate.rs:24:13
+ |
+LL | pub use a::*;
+ | ^^^^
+ = help: consider adding an explicit import of `foo` to disambiguate
+note: `foo` could also refer to the function imported here
+ --> $DIR/duplicate.rs:25:13
+ |
+LL | pub use b::*;
+ | ^^^^
+ = help: consider adding an explicit import of `foo` to disambiguate
+ = note: `#[warn(ambiguous_glob_imports)]` on by default
+
+error: aborting due to 4 previous errors; 1 warning emitted
Some errors have detailed explanations: E0252, E0659.
For more information about an error, try `rustc --explain E0252`.
diff --git a/tests/ui/imports/extern-with-ambiguous-1.rs b/tests/ui/imports/extern-with-ambiguous-1.rs
new file mode 100644
index 000000000..42c3c2068
--- /dev/null
+++ b/tests/ui/imports/extern-with-ambiguous-1.rs
@@ -0,0 +1,19 @@
+// edition: 2021
+// aux-build: extern-with-ambiguous-1-extern.rs
+
+// `extern-with-ambiguous-1-extern.rs` doesn't has
+// ambiguous, just for compare.
+
+extern crate extern_with_ambiguous_1_extern;
+
+mod s {
+ pub mod error {
+ use extern_with_ambiguous_1_extern::*;
+ }
+}
+use s::*;
+use extern_with_ambiguous_1_extern::*;
+use error::*;
+//~^ ERROR `error` is ambiguous
+
+fn main() {}
diff --git a/tests/ui/imports/extern-with-ambiguous-1.stderr b/tests/ui/imports/extern-with-ambiguous-1.stderr
new file mode 100644
index 000000000..dca2b4ebe
--- /dev/null
+++ b/tests/ui/imports/extern-with-ambiguous-1.stderr
@@ -0,0 +1,23 @@
+error[E0659]: `error` is ambiguous
+ --> $DIR/extern-with-ambiguous-1.rs:16:5
+ |
+LL | use error::*;
+ | ^^^^^ ambiguous name
+ |
+ = note: ambiguous because of multiple glob imports of a name in the same module
+note: `error` could refer to the module imported here
+ --> $DIR/extern-with-ambiguous-1.rs:14:5
+ |
+LL | use s::*;
+ | ^^^^
+ = help: consider adding an explicit import of `error` to disambiguate
+note: `error` could also refer to the module imported here
+ --> $DIR/extern-with-ambiguous-1.rs:15:5
+ |
+LL | use extern_with_ambiguous_1_extern::*;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = help: consider adding an explicit import of `error` to disambiguate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/tests/ui/imports/extern-with-ambiguous-2.rs b/tests/ui/imports/extern-with-ambiguous-2.rs
new file mode 100644
index 000000000..68c623c1c
--- /dev/null
+++ b/tests/ui/imports/extern-with-ambiguous-2.rs
@@ -0,0 +1,16 @@
+// check-pass
+// edition: 2021
+// aux-build: extern-with-ambiguous-2-extern.rs
+
+extern crate extern_with_ambiguous_2_extern;
+
+mod s {
+ pub mod error {
+ use extern_with_ambiguous_2_extern::*;
+ }
+}
+use s::*;
+use extern_with_ambiguous_2_extern::*;
+use error::*;
+
+fn main() {}
diff --git a/tests/ui/imports/extern-with-ambiguous-3.rs b/tests/ui/imports/extern-with-ambiguous-3.rs
new file mode 100644
index 000000000..282c1d569
--- /dev/null
+++ b/tests/ui/imports/extern-with-ambiguous-3.rs
@@ -0,0 +1,17 @@
+// check-pass
+// edition: 2021
+// aux-build: extern-with-ambiguous-3-extern.rs
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1643974121
+
+extern crate extern_with_ambiguous_3_extern;
+
+mod s {
+ pub mod error {
+ use extern_with_ambiguous_3_extern::*;
+ }
+}
+use s::*;
+use extern_with_ambiguous_3_extern::*;
+use error::*;
+
+fn main() {}
diff --git a/tests/ui/imports/import-after-macro-expand-1.rs b/tests/ui/imports/import-after-macro-expand-1.rs
new file mode 100644
index 000000000..d7a8aaf2f
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-1.rs
@@ -0,0 +1,19 @@
+// check-pass
+// https://github.com/rust-lang/rust/issues/56593#issue-388659456
+
+struct Foo;
+
+mod foo {
+ use super::*;
+
+ #[derive(Debug)]
+ pub struct Foo;
+}
+
+mod bar {
+ use super::foo::*;
+
+ fn bar(_: Foo) {}
+}
+
+fn main() {}
diff --git a/tests/ui/imports/import-after-macro-expand-2.rs b/tests/ui/imports/import-after-macro-expand-2.rs
new file mode 100644
index 000000000..b3996d488
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-2.rs
@@ -0,0 +1,27 @@
+// check-pass
+// https://github.com/rust-lang/rust/issues/56593#issuecomment-1133174514
+
+use thing::*;
+
+#[derive(Debug)]
+pub enum Thing {
+ Foo
+}
+
+mod tests {
+ use super::*;
+
+ fn test_thing() {
+ let thing: crate::thing::Thing = Thing::Bar;
+ // FIXME: `thing` should refer to `crate::Thing`,
+ // FIXME: but doesn't currently refer to it due to backward compatibility
+ }
+}
+
+mod thing {
+ pub enum Thing {
+ Bar
+ }
+}
+
+fn main() { }
diff --git a/tests/ui/imports/import-after-macro-expand-3.rs b/tests/ui/imports/import-after-macro-expand-3.rs
new file mode 100644
index 000000000..3babe1470
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-3.rs
@@ -0,0 +1,24 @@
+// check-pass
+// similar with `import-after-macro-expand-2.rs`
+
+use thing::*;
+
+pub enum Thing {
+ Foo
+}
+
+mod tests {
+ use super::*;
+
+ fn test_thing() {
+ let thing: crate::Thing = Thing::Foo;
+ }
+}
+
+mod thing {
+ pub enum Thing {
+ Bar
+ }
+}
+
+fn main() {}
diff --git a/tests/ui/imports/import-after-macro-expand-4.rs b/tests/ui/imports/import-after-macro-expand-4.rs
new file mode 100644
index 000000000..02cc3f01a
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-4.rs
@@ -0,0 +1,30 @@
+// https://github.com/rust-lang/rust/pull/113242#issuecomment-1616034904
+// similar with `import-after-macro-expand-2.rs`
+
+mod a {
+ pub trait P {}
+}
+
+pub use a::*;
+
+mod c {
+ use crate::*;
+ pub struct S(Vec<P>);
+ //~^ ERROR the size for values of type
+ //~| WARNING trait objects without an explicit
+ //~| WARNING this is accepted in the current edition
+ //~| WARNING trait objects without an explicit
+ //~| WARNING this is accepted in the current edition
+ //~| WARNING trait objects without an explicit
+ //~| WARNING this is accepted in the current edition
+
+ // FIXME: should works, but doesn't currently refer
+ // to it due to backward compatibility
+}
+
+#[derive(Clone)]
+pub enum P {
+ A
+}
+
+fn main() {}
diff --git a/tests/ui/imports/import-after-macro-expand-4.stderr b/tests/ui/imports/import-after-macro-expand-4.stderr
new file mode 100644
index 000000000..01f70cfc5
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-4.stderr
@@ -0,0 +1,53 @@
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/import-after-macro-expand-4.rs:12:22
+ |
+LL | pub struct S(Vec<P>);
+ | ^
+ |
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+ = note: `#[warn(bare_trait_objects)]` on by default
+help: use `dyn`
+ |
+LL | pub struct S(Vec<dyn P>);
+ | +++
+
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/import-after-macro-expand-4.rs:12:22
+ |
+LL | pub struct S(Vec<P>);
+ | ^
+ |
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL | pub struct S(Vec<dyn P>);
+ | +++
+
+warning: trait objects without an explicit `dyn` are deprecated
+ --> $DIR/import-after-macro-expand-4.rs:12:22
+ |
+LL | pub struct S(Vec<P>);
+ | ^
+ |
+ = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+ = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+help: use `dyn`
+ |
+LL | pub struct S(Vec<dyn P>);
+ | +++
+
+error[E0277]: the size for values of type `(dyn a::P + 'static)` cannot be known at compilation time
+ --> $DIR/import-after-macro-expand-4.rs:12:18
+ |
+LL | pub struct S(Vec<P>);
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `Sized` is not implemented for `(dyn a::P + 'static)`
+note: required by a bound in `Vec`
+ --> $SRC_DIR/alloc/src/vec/mod.rs:LL:COL
+
+error: aborting due to previous error; 3 warnings emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/imports/import-after-macro-expand-5.rs b/tests/ui/imports/import-after-macro-expand-5.rs
new file mode 100644
index 000000000..ba28b6dea
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-5.rs
@@ -0,0 +1,31 @@
+// edition: 2021
+// check-pass
+// https://github.com/rust-lang/rust/issues/105235#issue-1474295873
+
+mod abc {
+ pub struct Beeblebrox;
+ pub struct Zaphod;
+}
+
+mod foo {
+ pub mod bar {
+ use crate::abc::*;
+
+ #[derive(Debug)]
+ pub enum Zaphod {
+ Whale,
+ President,
+ }
+ }
+ pub use bar::*;
+}
+
+mod baz {
+ pub fn do_something() {
+ println!("{:?}", crate::foo::Zaphod::Whale);
+ }
+}
+
+fn main() {
+ baz::do_something();
+}
diff --git a/tests/ui/imports/import-after-macro-expand-6.rs b/tests/ui/imports/import-after-macro-expand-6.rs
new file mode 100644
index 000000000..ab5bb37a1
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-6.rs
@@ -0,0 +1,24 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113099#issuecomment-1633574396
+
+pub mod a {
+ pub use crate::b::*;
+}
+
+mod b {
+ pub mod http {
+ pub struct HeaderMap;
+ }
+
+ pub use self::http::*;
+ #[derive(Debug)]
+ pub struct HeaderMap;
+}
+
+use crate::a::HeaderMap;
+
+fn main() {
+ let h: crate::b::http::HeaderMap = HeaderMap;
+ // FIXME: should refer to `crate::b::HeaderMap`,
+ // FIXME: but doesn't currently refer to it due to backward compatibility
+}
diff --git a/tests/ui/imports/import-after-macro-expand-7.rs b/tests/ui/imports/import-after-macro-expand-7.rs
new file mode 100644
index 000000000..0402dfdfd
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-7.rs
@@ -0,0 +1,21 @@
+// check-pass
+// a compared case for `import-after-macro-expand-6.rs`
+
+pub mod a {
+ pub use crate::b::*;
+}
+
+mod b {
+ mod http {
+ pub struct HeaderMap;
+ }
+
+ pub use self::http::*;
+ pub struct HeaderMap;
+}
+
+use crate::a::HeaderMap;
+
+fn main() {
+ let h: crate::b::HeaderMap = HeaderMap;
+}
diff --git a/tests/ui/imports/import-after-macro-expand-8.rs b/tests/ui/imports/import-after-macro-expand-8.rs
new file mode 100644
index 000000000..e11d65eff
--- /dev/null
+++ b/tests/ui/imports/import-after-macro-expand-8.rs
@@ -0,0 +1,22 @@
+// check-pass
+// https://github.com/rust-lang/rust/pull/113242#issuecomment-1616034904
+
+mod a {
+ pub trait P {}
+}
+pub use a::*;
+
+mod b {
+ #[derive(Clone)]
+ pub enum P {
+ A
+ }
+}
+pub use b::P;
+
+mod c {
+ use crate::*;
+ pub struct S(Vec<P>);
+}
+
+fn main() {}
diff --git a/tests/ui/imports/issue-113953.rs b/tests/ui/imports/issue-113953.rs
new file mode 100644
index 000000000..449a074f4
--- /dev/null
+++ b/tests/ui/imports/issue-113953.rs
@@ -0,0 +1,6 @@
+// edition: 2021
+use u8 as imported_u8;
+use unresolved as u8;
+//~^ ERROR unresolved import `unresolved`
+
+fn main() {}
diff --git a/tests/ui/imports/issue-113953.stderr b/tests/ui/imports/issue-113953.stderr
new file mode 100644
index 000000000..70f91bd3c
--- /dev/null
+++ b/tests/ui/imports/issue-113953.stderr
@@ -0,0 +1,9 @@
+error[E0432]: unresolved import `unresolved`
+ --> $DIR/issue-113953.rs:3:5
+ |
+LL | use unresolved as u8;
+ | ^^^^^^^^^^^^^^^^ no external crate `unresolved`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/tests/ui/imports/issue-81413.rs b/tests/ui/imports/issue-81413.rs
new file mode 100644
index 000000000..f3fb8bfab
--- /dev/null
+++ b/tests/ui/imports/issue-81413.rs
@@ -0,0 +1,23 @@
+pub const ITEM: Item = Item;
+
+pub struct Item;
+
+pub fn item() {}
+
+pub use doesnt_exist::*;
+//~^ ERROR unresolved import `doesnt_exist`
+mod a {
+ use crate::{item, Item, ITEM};
+}
+
+mod b {
+ use crate::item;
+ use crate::Item;
+ use crate::ITEM;
+}
+
+mod c {
+ use crate::item;
+}
+
+fn main() {}
diff --git a/tests/ui/imports/issue-81413.stderr b/tests/ui/imports/issue-81413.stderr
new file mode 100644
index 000000000..e2dfe02bc
--- /dev/null
+++ b/tests/ui/imports/issue-81413.stderr
@@ -0,0 +1,11 @@
+error[E0432]: unresolved import `doesnt_exist`
+ --> $DIR/issue-81413.rs:7:9
+ |
+LL | pub use doesnt_exist::*;
+ | ^^^^^^^^^^^^ maybe a missing crate `doesnt_exist`?
+ |
+ = help: consider adding `extern crate doesnt_exist` to use the `doesnt_exist` crate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/tests/ui/imports/resolve-other-libc.rs b/tests/ui/imports/resolve-other-libc.rs
new file mode 100644
index 000000000..806d854ec
--- /dev/null
+++ b/tests/ui/imports/resolve-other-libc.rs
@@ -0,0 +1,14 @@
+// Regression test for https://github.com/rust-lang/rust/issues/26043
+
+// compile-flags: --extern libc=test.rlib
+
+// The error shall NOT be something similar to the following, because it
+// indicates that `libc` was wrongly resolved to `libc` shipped with the
+// compiler:
+//
+// error[E0658]: use of unstable library feature 'rustc_private': \
+// this crate is being loaded from the sysroot
+//
+extern crate libc; //~ ERROR: extern location for libc does not exist: test.rlib
+
+fn main() {}
diff --git a/tests/ui/imports/resolve-other-libc.stderr b/tests/ui/imports/resolve-other-libc.stderr
new file mode 100644
index 000000000..e57b88e50
--- /dev/null
+++ b/tests/ui/imports/resolve-other-libc.stderr
@@ -0,0 +1,8 @@
+error: extern location for libc does not exist: test.rlib
+ --> $DIR/resolve-other-libc.rs:12:1
+ |
+LL | extern crate libc;
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+