about summary refs log tree commit diff
path: root/tests/ui/resolve
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-08-29 12:37:30 +0200
committerGitHub <noreply@github.com>2025-08-29 12:37:30 +0200
commite15744e7a4095a868cc3d145ae81bd6660247519 (patch)
treef7d75c0c28612e897db38efed084684b0aa4a878 /tests/ui/resolve
parent41f2b6b39e7526a28d50ff6918dda6de48add5e4 (diff)
parent2e659f58940a31fa625e88f75f78111ed773f32d (diff)
downloadrust-e15744e7a4095a868cc3d145ae81bd6660247519.tar.gz
rust-e15744e7a4095a868cc3d145ae81bd6660247519.zip
Rollup merge of #145675 - Oneirical:uncountable-integer-8, r=jieyouxu
Rehome 30 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` [#1 of Batch #2]

Part of rust-lang/rust#133895

Methodology:

1. Refer to the previously written `tests/ui/SUMMARY.md`
2. Find an appropriate category for the test, using the original issue thread and the test contents.
3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers)
4. Rename the tests to make their purpose clearer

Inspired by the methodology that `@Kivooeo` was using.

r? `@jieyouxu`
Diffstat (limited to 'tests/ui/resolve')
-rw-r--r--tests/ui/resolve/duplicate-name-in-module-6936.rs34
-rw-r--r--tests/ui/resolve/duplicate-name-in-module-6936.stderr43
2 files changed, 77 insertions, 0 deletions
diff --git a/tests/ui/resolve/duplicate-name-in-module-6936.rs b/tests/ui/resolve/duplicate-name-in-module-6936.rs
new file mode 100644
index 00000000000..ae9282c0c24
--- /dev/null
+++ b/tests/ui/resolve/duplicate-name-in-module-6936.rs
@@ -0,0 +1,34 @@
+// https://github.com/rust-lang/rust/issues/6936
+struct T;
+
+mod t1 {
+    type Foo = crate::T;
+    mod Foo {} //~ ERROR the name `Foo` is defined multiple times
+}
+
+mod t2 {
+    type Foo = crate::T;
+    struct Foo; //~ ERROR the name `Foo` is defined multiple times
+}
+
+mod t3 {
+    type Foo = crate::T;
+    enum Foo {} //~ ERROR the name `Foo` is defined multiple times
+}
+
+mod t4 {
+    type Foo = crate::T;
+    fn Foo() {} // ok
+}
+
+mod t5 {
+    type Bar<T> = T;
+    mod Bar {} //~ ERROR the name `Bar` is defined multiple times
+}
+
+mod t6 {
+    type Foo = crate::T;
+    impl Foo {} // ok
+}
+
+fn main() {}
diff --git a/tests/ui/resolve/duplicate-name-in-module-6936.stderr b/tests/ui/resolve/duplicate-name-in-module-6936.stderr
new file mode 100644
index 00000000000..76bb8f57386
--- /dev/null
+++ b/tests/ui/resolve/duplicate-name-in-module-6936.stderr
@@ -0,0 +1,43 @@
+error[E0428]: the name `Foo` is defined multiple times
+  --> $DIR/duplicate-name-in-module-6936.rs:6:5
+   |
+LL |     type Foo = crate::T;
+   |     -------------------- previous definition of the type `Foo` here
+LL |     mod Foo {}
+   |     ^^^^^^^ `Foo` redefined here
+   |
+   = note: `Foo` must be defined only once in the type namespace of this module
+
+error[E0428]: the name `Foo` is defined multiple times
+  --> $DIR/duplicate-name-in-module-6936.rs:11:5
+   |
+LL |     type Foo = crate::T;
+   |     -------------------- previous definition of the type `Foo` here
+LL |     struct Foo;
+   |     ^^^^^^^^^^^ `Foo` redefined here
+   |
+   = note: `Foo` must be defined only once in the type namespace of this module
+
+error[E0428]: the name `Foo` is defined multiple times
+  --> $DIR/duplicate-name-in-module-6936.rs:16:5
+   |
+LL |     type Foo = crate::T;
+   |     -------------------- previous definition of the type `Foo` here
+LL |     enum Foo {}
+   |     ^^^^^^^^ `Foo` redefined here
+   |
+   = note: `Foo` must be defined only once in the type namespace of this module
+
+error[E0428]: the name `Bar` is defined multiple times
+  --> $DIR/duplicate-name-in-module-6936.rs:26:5
+   |
+LL |     type Bar<T> = T;
+   |     ---------------- previous definition of the type `Bar` here
+LL |     mod Bar {}
+   |     ^^^^^^^ `Bar` redefined here
+   |
+   = note: `Bar` must be defined only once in the type namespace of this module
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0428`.