]> git.lizzy.rs Git - rust.git/blob - src/test/ui/imports/duplicate.rs
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[rust.git] / src / test / ui / imports / duplicate.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 mod a {
12     pub fn foo() {}
13 }
14
15 mod b {
16     pub fn foo() {}
17 }
18
19 mod c {
20     pub use a::foo;
21 }
22
23 mod d {
24     use a::foo;
25     use a::foo; //~ ERROR the name `foo` is defined multiple times
26 }
27
28 mod e {
29     pub use a::*;
30     pub use c::*; // ok
31 }
32
33 mod f {
34     pub use a::*;
35     pub use b::*;
36 }
37
38 mod g {
39     pub use a::*;
40     pub use f::*;
41 }
42
43 fn main() {
44     e::foo();
45     f::foo(); //~ ERROR `foo` is ambiguous
46     g::foo(); //~ ERROR `foo` is ambiguous
47 }
48
49 mod ambiguous_module_errors {
50     pub mod m1 { pub use super::m1 as foo; }
51     pub mod m2 { pub use super::m2 as foo; }
52
53     use self::m1::*;
54     use self::m2::*;
55
56     use self::foo::bar; //~ ERROR `foo` is ambiguous
57
58     fn f() {
59         foo::bar(); //~ ERROR `foo` is ambiguous
60     }
61 }