-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Wrong "possible better candidate is found in another module" suggestion #42944
Comments
cc @estebank |
Why is that even an error? |
@oli-obk tuple structs have private fields by default, you can't construct instances of B outside of the foo module. |
oh ^^ maybe we should simply modify this error message then to say that the "function" is private? |
It already says "constructor is not visible here due to private fields". That's okay, but maybe you might have meant another B from another module or something. However, the candidate offered is not any better as its the same one you are attempting to use. |
Reopening to track "removal of suggestion" work for pub tuple structs with private fields. |
Only suggest imports if not imported. Fixes rust-lang#42944 and fixes rust-lang#53430. This commit modifies name resolution error reporting so that if a name is in scope and has been imported then we do not suggest importing it. This can occur when we add a label about constructors not being visible due to private fields. In these cases, we know that the struct/variant has been imported and we should silence any suggestions to import the struct/variant. r? @estebank
Only suggest imports if not imported. Fixes rust-lang#42944 and fixes rust-lang#53430. This commit modifies name resolution error reporting so that if a name is in scope and has been imported then we do not suggest importing it. This can occur when we add a label about constructors not being visible due to private fields. In these cases, we know that the struct/variant has been imported and we should silence any suggestions to import the struct/variant. r? @estebank
Only suggest imports if not imported. Fixes rust-lang#42944 and fixes rust-lang#53430. This commit modifies name resolution error reporting so that if a name is in scope and has been imported then we do not suggest importing it. This can occur when we add a label about constructors not being visible due to private fields. In these cases, we know that the struct/variant has been imported and we should silence any suggestions to import the struct/variant. r? @estebank
For this code:
You get the following error message:
The suggestion may be excused to be not 100% perfect, but here it suggests to add an use statement despite that same item being imported already. What I want is this exactly: that it removes stuff from the suggestion list that is already being imported.
Note that changing the glob import to a non glob one doesn't change anything.
The text was updated successfully, but these errors were encountered: