-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Change "A non-empty glob must import something with the glob's visibility" to be a lint? #62334
Comments
The error was introduced in #35894 as a part of import modularization, and discussed in one of the related issues, but I can't find where exactly. The error was introduced by analogy with errors for single imports (and just to be conservative): mod m {
fn f() {}
}
use m::f; // Doesn't import anything and therefore reports an error.
use m::g; // Doesn't import anything and therefore reports an error.
use m::*; // Doesn't import anything and therefore reports an error. The error is not technically necessary, and we should be able to report it as a lint for glob imports while keeping it an error for single imports. |
Would this be a "good first issue" or is it complex to fix? |
No, not complex.
|
I want to do this issue but the problem I have is with a test (ui/imports/reexports) that checks for this error, I don't know the compiler structure so I don't know when compiling this file the lint will not be reported because of the other errors or not. Else I changed the |
resolve: Turn the "non-empty glob must import something" error into a lint This fixes rust-lang#62334 by changing the error to a lint warning the glob. I changed the test but I'm very unsure of what I did as I do not know how to correctly check for the warning
Consider the following three examples: A and C are accepted and B has a compilation error. However, the message reported in B looks more like a lint than a compilation error.
A consequence of this error is that adding a non-public function to a module (e.g. the
bar
in B) may break code that imports from that module. This causes surprises when refactoring.Shouldn't "A non-empty glob must import something with the glob's visibility" be a lint?
The original discussion is here: https://users.rust-lang.org/t/a-non-empty-glob-must-import-something-with-the-globs-visibility-uhhh-okay-but-why
A
B
C
The text was updated successfully, but these errors were encountered: