-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Rustc suggests importing trait inside private module #90258
Comments
This also changes the tests introduced by the previous commits because of another rustc issue (rust-lang#90258)
Suggest adding a new lifetime parameter when two elided lifetimes should match up but don't Issue rust-lang#90170 This also changes the tests introduced by the previous commits because of another rustc issue (rust-lang#90258)
I've also hit this, but there's another angle here. I have my own trait that was intended to be public, but I forgot to make it |
I think it should still suggest it if it's in the same crate. But better now for external crates. If there's some way to find out if the external crate is in the same workspace, then this could be special cased as well to show it again. |
Update: on the current nightly, I don't get the suggestion anymore.
|
The current output is:
Here, rustc suggests importing the trait
RingSlices
, which is inside a private module and can't be used.If possible, rustc should probably check whether a suggested trait is usable in the current module, and only suggest it if it is.
One thing that is useful about the current version is, that it might suggest that the user should make the module public if they control it. Maybe it should still be emitted if the trait is in the current crate.
Found by @angelsflyinhell, a rust beginner that was a bit confused by this
The text was updated successfully, but these errors were encountered: