2016-08-20 03:28:35 +00:00
|
|
|
mod a {
|
|
|
|
pub fn foo() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod b {
|
|
|
|
pub fn foo() {}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod c {
|
|
|
|
pub use a::foo;
|
|
|
|
}
|
|
|
|
|
|
|
|
mod d {
|
2017-12-10 20:29:24 +00:00
|
|
|
use a::foo;
|
2017-05-18 03:29:58 +00:00
|
|
|
use a::foo; //~ ERROR the name `foo` is defined multiple times
|
2016-08-20 03:28:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mod e {
|
|
|
|
pub use a::*;
|
|
|
|
pub use c::*; // ok
|
|
|
|
}
|
|
|
|
|
2016-08-20 05:23:19 +00:00
|
|
|
mod f {
|
2017-12-10 20:29:24 +00:00
|
|
|
pub use a::*;
|
|
|
|
pub use b::*;
|
2016-08-20 05:23:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mod g {
|
2017-12-10 20:29:24 +00:00
|
|
|
pub use a::*;
|
|
|
|
pub use f::*;
|
2016-08-20 05:23:19 +00:00
|
|
|
}
|
|
|
|
|
2016-08-20 03:28:35 +00:00
|
|
|
fn main() {
|
|
|
|
e::foo();
|
2016-08-20 05:23:19 +00:00
|
|
|
f::foo(); //~ ERROR `foo` is ambiguous
|
2018-12-29 15:15:29 +00:00
|
|
|
g::foo();
|
2023-07-26 14:46:49 +00:00
|
|
|
//~^ WARNING `foo` is ambiguous
|
|
|
|
//~| WARNING this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
|
2016-08-20 03:28:35 +00:00
|
|
|
}
|
2016-08-22 08:30:07 +00:00
|
|
|
|
|
|
|
mod ambiguous_module_errors {
|
2018-12-29 15:15:29 +00:00
|
|
|
pub mod m1 { pub use super::m1 as foo; pub fn bar() {} }
|
2016-08-22 08:30:07 +00:00
|
|
|
pub mod m2 { pub use super::m2 as foo; }
|
|
|
|
|
2017-12-10 20:29:24 +00:00
|
|
|
use self::m1::*;
|
|
|
|
use self::m2::*;
|
2016-08-22 07:12:13 +00:00
|
|
|
|
|
|
|
use self::foo::bar; //~ ERROR `foo` is ambiguous
|
2016-08-22 08:30:07 +00:00
|
|
|
|
|
|
|
fn f() {
|
|
|
|
foo::bar(); //~ ERROR `foo` is ambiguous
|
|
|
|
}
|
|
|
|
}
|