-
Notifications
You must be signed in to change notification settings - Fork 13.3k
overly aggressive ambiguity errors #26187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Rust is almost pathologically aggressive here. A name which I never use and where all imports leads to the same type (one a straight re-export of the other) is still sufficient cause to fail the compile, e.g.
This also illustrates that named imports aren't given priority over wildcard imports. I initially had high hopes for |
This behavior is currently intended design and the possible breakage is known (and has mitigation strategies). It's possible to relax these requirements and allow conflicting imports if the conflict isn't actually used, but changes like this would require an RFC (and belong in the rust-lang/rfcs repo). Thanks for the report regardless, though! |
From the RFC you linked:
Since wildcard imports are no longer feature gated, I don't think it's accurate to say that the current behavior is intended. |
Just to clarify, this is not the long-term intended design. Name resolution is currently over-conservative. I think most people want, and expect, precisely the semantics @paulp is laying out here. (In fact, the mitigation strategies @alexcrichton points to are exactly the changes @paulp is asking for.) However, as @alexcrichton mentions, we don't currently have a fully fleshed-out and approved design here in the form of an RFC, which is our process for undergoing such changes. |
Issuing an ambiguity error about a name which is never used does more than create needless busywork and break namespace encapsulation. It means you can never add anything to a module without breaking an unknown and unknowable amount of source code in the wild when you happen to choose the same name as did some other crate.
The text was updated successfully, but these errors were encountered: