Closed
Description
I tried this code:
mod rustfmt { pub fn skip() {} }
use rustfmt::skip;
fn main() {
skip()
}
I expected to see this happen: No error, as the rustfmt
tool module cannot be imported from, so the path should resolve to the module.
Instead, this happened:
error[E0659]: `rustfmt` is ambiguous
--> poc.rs:3:5
|
3 | use rustfmt::skip;
| ^^^^^^^ ambiguous name
|
= note: ambiguous because of multiple potential import sources
= note: `rustfmt` could refer to a tool module
note: `rustfmt` could also refer to the module defined here
--> poc.rs:1:1
|
1 | mod rustfmt { pub fn skip() {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: use `crate::rustfmt` to refer to this module unambiguously
This would make adding new tool namespaces (such as the proposed RFC 3368 a breaking change.
Meta
Present on stable, nightly and master.
@rustbot label +A-resolve