Erroneous code example:
-```compile_fail,E0659
+```compile_fail,edition2018,E0659
pub mod moon {
pub fn foo() {}
}
}
mod collider {
- pub use moon::*;
- pub use earth::*;
+ pub use crate::moon::*;
+ pub use crate::earth::*;
}
fn main() {
- collider::foo(); // ERROR: `foo` is ambiguous
+ crate::collider::foo(); // ERROR: `foo` is ambiguous
}
```
To solve this error, the best solution is generally to keep the path before the
item when using it. Example:
-```
+```edition2018
pub mod moon {
pub fn foo() {}
}
}
mod collider {
- pub use moon;
- pub use earth;
+ pub use crate::moon;
+ pub use crate::earth;
}
fn main() {
- collider::moon::foo(); // ok!
- collider::earth::foo(); // ok!
+ crate::collider::moon::foo(); // ok!
+ crate::collider::earth::foo(); // ok!
}
```
"##,