about summary refs log tree commit diff
path: root/compiler/rustc_lint/src/lib.rs
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2025-03-05 21:46:34 +0800
committerGitHub <noreply@github.com>2025-03-05 21:46:34 +0800
commit21b473334fb3c96d41149655b730c5c8b3c19a8e (patch)
treefee0a285534a5daa96aa0e6ccedac06eddc8d7a9 /compiler/rustc_lint/src/lib.rs
parent1b9b515674c46c8a59371b55ef857cbac8b985ae (diff)
parentef337a6599145766fc73b2896c6ff3e0fef65b0b (diff)
downloadrust-21b473334fb3c96d41149655b730c5c8b3c19a8e.tar.gz
rust-21b473334fb3c96d41149655b730c5c8b3c19a8e.zip
Rollup merge of #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:

- https://github.com/rust-lang/rust/pull/135881
- https://github.com/rust-lang/rust/issues/136702
- https://github.com/rust-lang/rust/pull/136776

Tracking:

- https://github.com/rust-lang/rust/issues/127323
- https://github.com/rust-lang/rust/issues/44874
- https://github.com/rust-lang/rust/issues/123430
Diffstat (limited to 'compiler/rustc_lint/src/lib.rs')
-rw-r--r--compiler/rustc_lint/src/lib.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs
index 5c5b3b350dd..7018774e5c6 100644
--- a/compiler/rustc_lint/src/lib.rs
+++ b/compiler/rustc_lint/src/lib.rs
@@ -599,6 +599,11 @@ fn register_builtins(store: &mut LintStore) {
         "converted into hard error, \
          see <https://github.com/rust-lang/rust/issues/73333> for more information",
     );
+    store.register_removed(
+        "ptr_cast_add_auto_to_object",
+        "converted into hard error, see issue #127323 \
+         <https://github.com/rust-lang/rust/issues/127323> for more information",
+    );
 }
 
 fn register_internals(store: &mut LintStore) {