-
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
Macro checks thwart unreachable_pub
lint
#52665
Comments
I don't know if this is solvable in general. Or are you asking for not squashing the lint behind macros? That's easy, just add rust/src/librustc_lint/builtin.rs Lines 1392 to 1396 in c7cba3d
|
I'm also not sure it's solvable! It may be a bit of a red herring here to say this is related to macro quashing, it's just sort of hiding the real bug. I think a better way to put this may be that:
The macro quashing is meaning you don't even see one of the suggestions (the one in the macro invocation), but even if we display the lint it wouldn't be actionable by rustfix anyway. |
So... For each lint candidate that has not been squished:
This is a bit extreme and might lead to loads of false negatives, so we should check to ensure that mod bar {
#[derive(Debug)]
pub struct FOO;
}
fn main() {
println!("{:?}", bar::FOO);
} still lints. |
These migration lints aren't all up to par in terms of a good migration experience. Some, like `unreachable_pub`, hit bugs like rust-lang#52665 and unprepared macros to be handled enough of the time. Others like linting against `#[macro_use]` are swimming upstream in an ecosystem that's not quite ready (and slightly buggy pending a few current PRs). The general idea is that we will continue to recommend the `rust_2018_idioms` lint group as part of the transition guide (as an optional step) but we'll be much more selective about which lints make it into this group. Only those with a strong track record of not causing too much churn will make the cut. cc rust-lang#52679
…li-obk rustc: Trim down the `rust_2018_idioms` lint group These migration lints aren't all up to par in terms of a good migration experience. Some, like `unreachable_pub`, hit bugs like rust-lang#52665 and unprepared macros to be handled enough of the time. Others like linting against `#[macro_use]` are swimming upstream in an ecosystem that's not quite ready (and slightly buggy pending a few current PRs). The general idea is that we will continue to recommend the `rust_2018_idioms` lint group as part of the transition guide (as an optional step) but we'll be much more selective about which lints make it into this group. Only those with a strong track record of not causing too much churn will make the cut. cc rust-lang#52679
Recently we landed a change which squashes all lints tied to foreign macros, but this can thwart lints like
unreachable_pub
in unusual fashions. Theunreachable_pub
lint can't be fixed unless all its warnings are fixed, which means the following examples fails to compile after being fixed:and then
compiled with:
but the corrected code doesn't compile!
This is a reuced example where
a!
islazy_static!
, but I believe the issue here is that the lints behind thelazy_static!
invocation are being ignored which means thatFoo
is actually fully public (becauseF
is) and the lint is no longer applicable as a result.cc @Manishearth, @oli-obk
The text was updated successfully, but these errors were encountered: