2016-08-19 22:28:35 -05:00
|
|
|
mod a {
|
|
|
|
pub fn foo() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod b {
|
|
|
|
pub fn foo() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod c {
|
|
|
|
pub use a::foo;
|
|
|
|
}
|
|
|
|
|
|
|
|
mod d {
|
2017-12-10 14:29:24 -06:00
|
|
|
use a::foo;
|
2017-05-17 22:29:58 -05:00
|
|
|
use a::foo; //~ ERROR the name `foo` is defined multiple times
|
2016-08-19 22:28:35 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
mod e {
|
|
|
|
pub use a::*;
|
|
|
|
pub use c::*; // ok
|
|
|
|
}
|
|
|
|
|
2016-08-20 00:23:19 -05:00
|
|
|
mod f {
|
2017-12-10 14:29:24 -06:00
|
|
|
pub use a::*;
|
|
|
|
pub use b::*;
|
2016-08-20 00:23:19 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
mod g {
|
2017-12-10 14:29:24 -06:00
|
|
|
pub use a::*;
|
|
|
|
pub use f::*;
|
2016-08-20 00:23:19 -05:00
|
|
|
}
|
|
|
|
|
2016-08-19 22:28:35 -05:00
|
|
|
fn main() {
|
|
|
|
e::foo();
|
2016-08-20 00:23:19 -05:00
|
|
|
f::foo(); //~ ERROR `foo` is ambiguous
|
2018-12-29 09:15:29 -06:00
|
|
|
g::foo();
|
2016-08-19 22:28:35 -05:00
|
|
|
}
|
2016-08-22 03:30:07 -05:00
|
|
|
|
|
|
|
mod ambiguous_module_errors {
|
2018-12-29 09:15:29 -06:00
|
|
|
pub mod m1 { pub use super::m1 as foo; pub fn bar() {} }
|
2016-08-22 03:30:07 -05:00
|
|
|
pub mod m2 { pub use super::m2 as foo; }
|
|
|
|
|
2017-12-10 14:29:24 -06:00
|
|
|
use self::m1::*;
|
|
|
|
use self::m2::*;
|
2016-08-22 02:12:13 -05:00
|
|
|
|
|
|
|
use self::foo::bar; //~ ERROR `foo` is ambiguous
|
2016-08-22 03:30:07 -05:00
|
|
|
|
|
|
|
fn f() {
|
|
|
|
foo::bar(); //~ ERROR `foo` is ambiguous
|
|
|
|
}
|
|
|
|
}
|