Make ptr_cast_add_auto_to_object lint into hard error by traviscross · Pull Request #136764 · rust-lang/rust (original) (raw)

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

traviscross

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.

labels

Feb 9, 2025

@traviscross traviscross added the T-lang

Relevant to the language team, which will review and decide on the PR/issue.

label

Feb 9, 2025

@rust-log-analyzer

This comment was marked as resolved.

@rust-log-analyzer

This comment has been minimized.

workingjubilee

@traviscross

@bors try

...in preparation for a crater run.

bors added a commit to rust-lang-ci/rust that referenced this pull request

Feb 9, 2025

@bors

…o_to_object-hard-error, r=

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:

Tracking:

@bors

@bors

☀️ Try build successful - checks-actions
Build commit: 8cf44c8 (8cf44c88fc5805dc578c5c987397615b47d2e2b2)

@traviscross

@craterbot

@craterbot

🚧 Experiment pr-136764 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot

@traviscross

@rustbot labels +I-lang-nominated

As expected, all the real regressions are due to anymap. Let's discuss what we want to do here.

cc @rust-lang/lang

@traviscross

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

@traviscross traviscross removed the T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.

label

Feb 12, 2025

@traviscross

This comment was marked as resolved.

@rfcbot

This comment was marked as resolved.

@traviscross

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.

@traviscross

WaffleLapkin

oli-obk

@oli-obk

@bors

📌 Commit ef337a6 has been approved by oli-obk

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Mar 4, 2025

@compiler-errors

workingjubilee added a commit to workingjubilee/rustc that referenced this pull request

Mar 4, 2025

@workingjubilee

…uto_to_object-hard-error, r=oli-obk

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:

Tracking:

bors added a commit to rust-lang-ci/rust that referenced this pull request

Mar 5, 2025

@bors

workingjubilee added a commit to workingjubilee/rustc that referenced this pull request

Mar 5, 2025

@workingjubilee

…uto_to_object-hard-error, r=oli-obk

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:

Tracking:

bors added a commit to rust-lang-ci/rust that referenced this pull request

Mar 5, 2025

@bors

…kingjubilee

Rollup of 20 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

bors added a commit to rust-lang-ci/rust that referenced this pull request

Mar 5, 2025

@bors

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Mar 5, 2025

@rust-timer

Rollup merge of rust-lang#136764 - traviscross:TC/make-ptr_cast_add_auto_to_object-hard-error, r=oli-obk

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:

Tracking:

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request

Mar 13, 2025

@matthiaskrgr

…leLapkin

Don't emit error within cast function, propagate it as a CastError

Minor nitpick from rust-lang#136764.

r? @WaffleLapkin

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Mar 13, 2025

@rust-timer

Rollup merge of rust-lang#138423 - compiler-errors:delay-emit, r=WaffleLapkin

Don't emit error within cast function, propagate it as a CastError

Minor nitpick from rust-lang#136764.

r? @WaffleLapkin

Labels

disposition-merge

This issue / PR is in PFCP or FCP with a disposition to merge it.

finished-final-comment-period

The final comment period is finished for this PR / Issue.

S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

T-lang

Relevant to the language team, which will review and decide on the PR/issue.