rust/tests/ui/resolve/duplicate-name-in-module-6936.rs
2025-08-27 00:23:26 -04:00

35 lines
601 B
Rust

// 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() {}