-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Deny-by-default never type lints #146167
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
base: master
Are you sure you want to change the base?
Deny-by-default never type lints #146167
Conversation
rustbot has assigned @petrochenkov. Use |
@bors try |
This comment has been minimized.
This comment has been minimized.
Deny-by-default never type lints
T-lang nominationThis PR marks |
This comment has been minimized.
This comment has been minimized.
@craterbot check |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
I personally would convert the lint to a hard error for a few versions :> Users can still ignore denied lints (e.g. if it's in a dependency) |
🎉 Experiment
Footnotes
|
@rfcbot reviewed |
@rfcbot reviewed This seems good! Thanks for your continued pushing on this, @WaffleLapkin -- and the crater results look encouraging, seems like mostly minor stuff. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
Yay more |
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
☔ The latest upstream changes (presumably #147261) made this pull request unmergeable. Please resolve the merge conflicts. |
efab93c
to
d6ce6ed
Compare
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
d6ce6ed
to
c598e6a
Compare
This comment has been minimized.
This comment has been minimized.
c598e6a
to
f1dfbbb
Compare
f1dfbbb
to
f025827
Compare
@nikomatsakis (and to the language team in general I guess) can you explain your assessment of the crater run? I don't see how ~470 unique crater breakages can be considered "minor stuff". 470 unique breakages feels like way too much, especially considering how not everything is tested by crater. I'm really concerned by this, because I'm not sure how we can proceed with the current plan, given that it requires so much breaking changes. |
Thanks for the question. You're right it's a non-trivial number, and clearly stability is important to us all. Some items we consider in our analysis: One, we're not breaking any code, under our normal definitions for these things, with this PR. Even at Since it's only a lint, it only stops compilation for the project with the affected code. Dependent crates are not affected except being offered the report about dependencies emitting FCWs. Since we want people to stop relying on this, this is what we want. We want to ratchet up the lints in a way that is directed at the people whose code will need to change. Two, we've been issuing this FCW for a long time. After a suitably long interval, when changing a behavior we consider to be part of our underspecified language semantics (see RFC 1122), we have historically considered ourselves "within our rights" (after considering all other factors) to make the ("minor", per RFC 1122) breaking change. This is part of what we'll be considering when it is later proposed for this to become a hard error. Three, when looking at a crater report for this kind of change where we've been issuing an FCW for a long time, we keep in mind that crater checks many pieces of code that are abandoned and will never be updated. If we see evidence that such abandoned code would still create widespread disruption to users, such as because it continues to be relied upon by many actively maintained dependent crates, then we would ask for other mitigating actions to be taken. However, we do not treat abandoned code relying on these areas of underspecified language semantics to be a permanent blocker to making minor breaking changes that we consider valuable. Four, we look at what we're getting in return for the breakage. Here, the eventual breakage we'll take will allow us to stabilize the never type without the sort of compromises that had stalled prior attempts. That has a lot of value to us, and so we're willing -- carefully and with due consideration for the stability of Rust -- to take the steps necessary to get there. All together, in this case, that was enough for us to conclude that we can change the lint level, as proposed here, and as confirmed in our FCP. (Perhaps others on lang have further thoughts.) |
In Rust 1.89.0 we started emitting these lints in dependencies. I discussed the future steps with @lcnr and we think that before stabilizing the never type (and doing the breaking changes) we should deny the lints for ~4 releases.
This PR marks
never_type_fallback_flowing_into_unsafe
anddependency_on_unit_never_type_fallback
lints as deny-by-default.Tracking:
!
to a type (RFC 1216) #35121Related: