]> git.lizzy.rs Git - rust.git/blob - src/test/ui/imports/duplicate.rs
Sync portable-simd to rust-lang/portable-simd@72df4c45056a8bc0d1b3f06fdc828722177f0763
[rust.git] / src / test / ui / imports / duplicate.rs
1 mod a {
2     pub fn foo() {}
3 }
4
5 mod b {
6     pub fn foo() {}
7 }
8
9 mod c {
10     pub use a::foo;
11 }
12
13 mod d {
14     use a::foo;
15     use a::foo; //~ ERROR the name `foo` is defined multiple times
16 }
17
18 mod e {
19     pub use a::*;
20     pub use c::*; // ok
21 }
22
23 mod f {
24     pub use a::*;
25     pub use b::*;
26 }
27
28 mod g {
29     pub use a::*;
30     pub use f::*;
31 }
32
33 fn main() {
34     e::foo();
35     f::foo(); //~ ERROR `foo` is ambiguous
36     g::foo();
37 }
38
39 mod ambiguous_module_errors {
40     pub mod m1 { pub use super::m1 as foo; pub fn bar() {} }
41     pub mod m2 { pub use super::m2 as foo; }
42
43     use self::m1::*;
44     use self::m2::*;
45
46     use self::foo::bar; //~ ERROR `foo` is ambiguous
47
48     fn f() {
49         foo::bar(); //~ ERROR `foo` is ambiguous
50     }
51 }