about summary refs log tree commit diff
path: root/tests/ui/cast
diff options
context:
space:
mode:
authorMaybe Lapkin <waffle.lapkin@gmail.com>2024-06-23 19:55:17 +0200
committerMaybe Lapkin <waffle.lapkin@gmail.com>2024-07-04 17:57:29 +0200
commit340d69be12ffc03709340ec2d342db32406cd25f (patch)
treed63bc4b06c1e16d26458338af9b626cb4bd1a669 /tests/ui/cast
parentc7435571ad725791494c32a48be1cd2c027af30b (diff)
downloadrust-340d69be12ffc03709340ec2d342db32406cd25f.tar.gz
rust-340d69be12ffc03709340ec2d342db32406cd25f.zip
Align the changes to the lang decision
Diffstat (limited to 'tests/ui/cast')
-rw-r--r--tests/ui/cast/ptr-to-trait-obj-add-auto.rs6
-rw-r--r--tests/ui/cast/ptr-to-trait-obj-add-auto.stderr22
2 files changed, 21 insertions, 7 deletions
diff --git a/tests/ui/cast/ptr-to-trait-obj-add-auto.rs b/tests/ui/cast/ptr-to-trait-obj-add-auto.rs
index 27c6ffb61cc..75b56816984 100644
--- a/tests/ui/cast/ptr-to-trait-obj-add-auto.rs
+++ b/tests/ui/cast/ptr-to-trait-obj-add-auto.rs
@@ -1,9 +1,11 @@
-//@ check-fail
+//@ check-pass
 
 trait Trait<'a> {}
 
 fn add_auto<'a>(x: *mut dyn Trait<'a>) -> *mut (dyn Trait<'a> + Send) {
-    x as _ //~ error: the trait bound `dyn Trait<'_>: Unsize<dyn Trait<'_> + Send>` is not satisfied
+    x as _
+    //~^ 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!
 }
 
 fn main() {}
diff --git a/tests/ui/cast/ptr-to-trait-obj-add-auto.stderr b/tests/ui/cast/ptr-to-trait-obj-add-auto.stderr
index 0c35db57b30..ff8c7057c96 100644
--- a/tests/ui/cast/ptr-to-trait-obj-add-auto.stderr
+++ b/tests/ui/cast/ptr-to-trait-obj-add-auto.stderr
@@ -1,11 +1,23 @@
-error[E0277]: the trait bound `dyn Trait<'_>: Unsize<dyn Trait<'_> + Send>` is not satisfied
+warning: adding an auto trait `Send` to a trait object in a pointer cast may cause UB later on
   --> $DIR/ptr-to-trait-obj-add-auto.rs:6:5
    |
 LL |     x as _
-   |     ^^^^^^ the trait `Unsize<dyn Trait<'_> + Send>` is not implemented for `dyn Trait<'_>`
+   |     ^^^^^^
    |
-   = note: all implementations of `Unsize` are provided automatically by the compiler, see <https://doc.rust-lang.org/stable/std/marker/trait.Unsize.html> for more information
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #125289 <https://github.com/rust-lang/rust/issues/125289>
+   = note: `#[warn(ptr_cast_add_auto_to_object)]` on by default
 
-error: aborting due to 1 previous error
+warning: 1 warning emitted
+
+Future incompatibility report: Future breakage diagnostic:
+warning: adding an auto trait `Send` to a trait object in a pointer cast may cause UB later on
+  --> $DIR/ptr-to-trait-obj-add-auto.rs:6:5
+   |
+LL |     x as _
+   |     ^^^^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #125289 <https://github.com/rust-lang/rust/issues/125289>
+   = note: `#[warn(ptr_cast_add_auto_to_object)]` on by default
 
-For more information about this error, try `rustc --explain E0277`.