-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Make ptr_cast_add_auto_to_object
lint into hard error
#136764
base: master
Are you sure you want to change the base?
Make ptr_cast_add_auto_to_object
lint into hard error
#136764
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
7719195
to
d5f82f6
Compare
This comment has been minimized.
This comment has been minimized.
d5f82f6
to
866c3cf
Compare
@bors try ...in preparation for a crater run. |
…o_to_object-hard-error, r=<try> Make `ptr_cast_add_auto_to_object` lint into hard error In Rust 1.81, we added a FCW lint (including linting in dependencies) against pointer casts that add an auto trait to dyn bounds. This was part of work making casts of pointers involving trait objects stricter, and was part of the work needed to restabilize trait upcasting. We considered just making this a hard error, but opted against it at that time due to breakage found by crater. This breakage was mostly due to the `anymap` crate which has been a persistent problem for us. It's now a year later, and the fact that this is not yet a hard error is giving us pause about stabilizing arbitrary self types and `derive(CoercePointee)`. So let's see about making a hard error of this. r? ghost cc `@adetaylor` `@Darksonn` `@BoxyUwU` `@RalfJung` `@compiler-errors` `@oli-obk` `@WaffleLapkin` Related: - rust-lang#135881 - rust-lang#136702 Tracking: - rust-lang#127323 - rust-lang#44874 - rust-lang#123430
☀️ Try build successful - checks-actions |
@craterbot check |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🎉 Experiment
|
@rustbot labels +I-lang-nominated As expected, all the real regressions are due to cc @rust-lang/lang |
We talked about this in triage today. The feeling is that the FCW has been out there long enough, so we're within our rights to do this. @rfcbot fcp merge |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
@rfcbot fcp merge |
Team member @traviscross has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
@rfcbot reviewed |
Some changes occurred in diagnostic error codes |
@rfcbot reviewed The time has come. |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
866c3cf
to
7c2c4ff
Compare
☔ The latest upstream changes (presumably #137248) made this pull request unmergeable. Please resolve the merge conflicts. |
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. |
In Rust 1.81, we added a FCW lint (including linting in dependencies) against pointer casts that add an auto trait to dyn bounds. This was part of work making casts of pointers involving trait objects stricter which was needed to restabilize trait upcasting. We considered just making this a hard error at the time, but opted against it due to breakage found by crater. This breakage was mostly due to the `anymap` crate which has been a persistent problem for us. It's now a year later, and the fact that this is not yet a hard error is giving us pause about stabilizing arbitrary self types and `derive(CoercePointee)`. So let's now make a hard error of this.
7c2c4ff
to
ef337a6
Compare
r? @oli-obk |
# Removed lints | ||
|
||
This directory contains tests to confirm that lints that have been | ||
removed do not cause errors and produce the appropriate warnings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would that ever prevent a problem?
As-in, if you forgot to remove the lint properly surely you'd also forget to add a test? And it seems very unlikely that any compiler change would break removed lints...
//~^ warning: adding an auto trait `Send` to a trait object in a pointer cast may cause UB later on | ||
//~| warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
//~^ ERROR cannot add auto trait `Send` to dyn bound via pointer cast | ||
//~| NOTE unsupported cast | ||
//~| NOTE this could allow UB elsewhere | ||
//~| HELP use `transmute` if you're sure this is sound |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(curiosity) Any specific reason you are using ERROR
instead of error:
?
I prefer the latter cause it's closer to the actual compiler output (error[CODE]: message
or error: message
for code-less errors) and because in my opinion it looks/reads nicer. (but there is no accepted style, so feel free to use whatever of course)
In Rust 1.81, we added a FCW lint (including linting in dependencies) against pointer casts that add an auto trait to dyn bounds. This was part of work making casts of pointers involving trait objects stricter, and was part of the work needed to restabilize trait upcasting.
We considered just making this a hard error, but opted against it at that time due to breakage found by crater. This breakage was mostly due to the
anymap
crate which has been a persistent problem for us.It's now a year later, and the fact that this is not yet a hard error is giving us pause about stabilizing arbitrary self types and
derive(CoercePointee)
. So let's see about making a hard error of this.r? ghost
cc @adetaylor @Darksonn @BoxyUwU @RalfJung @compiler-errors @oli-obk @WaffleLapkin
Related:
Tracking:
ptr_cast_add_auto_to_object
#127323arbitrary_self_types
#44874derive(CoercePointee)
#123430