diff options
| author | Michael Goulet <michael@errs.io> | 2025-02-04 02:37:13 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2025-02-24 18:48:40 +0000 |
| commit | f3d31f77e4754d5547606d95db97fd6b2335a8ce (patch) | |
| tree | 3e80529e1c79449fe992421259617915d9d48cc4 /tests/ui/wf | |
| parent | 617aad8c2e8783f6df8e5d1f8bb1e4bcdc70aa7b (diff) | |
| download | rust-f3d31f77e4754d5547606d95db97fd6b2335a8ce.tar.gz rust-f3d31f77e4754d5547606d95db97fd6b2335a8ce.zip | |
Remove dyn_compatible_for_dispatch
Diffstat (limited to 'tests/ui/wf')
| -rw-r--r-- | tests/ui/wf/wf-convert-dyn-incompat-trait-obj-box.rs | 18 | ||||
| -rw-r--r-- | tests/ui/wf/wf-convert-dyn-incompat-trait-obj-box.stderr | 54 | ||||
| -rw-r--r-- | tests/ui/wf/wf-convert-dyn-incompat-trait-obj.rs | 18 | ||||
| -rw-r--r-- | tests/ui/wf/wf-convert-dyn-incompat-trait-obj.stderr | 54 | ||||
| -rw-r--r-- | tests/ui/wf/wf-dyn-incompat-trait-obj-match.rs | 29 | ||||
| -rw-r--r-- | tests/ui/wf/wf-dyn-incompat-trait-obj-match.stderr | 60 |
6 files changed, 0 insertions, 233 deletions
diff --git a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj-box.rs b/tests/ui/wf/wf-convert-dyn-incompat-trait-obj-box.rs deleted file mode 100644 index 26292a1d218..00000000000 --- a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj-box.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Check that we do not allow casts or coercions -// to dyn-incompatible trait objects inside a Box - -#![feature(dyn_compatible_for_dispatch)] - -trait Trait: Sized {} - -struct S; - -impl Trait for S {} - -fn takes_box(t: Box<dyn Trait>) {} - -fn main() { - Box::new(S) as Box<dyn Trait>; //~ ERROR E0038 - let t_box: Box<dyn Trait> = Box::new(S); //~ ERROR E0038 - takes_box(Box::new(S)); //~ ERROR E0038 -} diff --git a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj-box.stderr b/tests/ui/wf/wf-convert-dyn-incompat-trait-obj-box.stderr deleted file mode 100644 index f3e4f2a63e9..00000000000 --- a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj-box.stderr +++ /dev/null @@ -1,54 +0,0 @@ -error[E0038]: the trait `Trait` is not dyn compatible - --> $DIR/wf-convert-dyn-incompat-trait-obj-box.rs:16:33 - | -LL | let t_box: Box<dyn Trait> = Box::new(S); - | ^^^^^^^^^^^ `Trait` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/wf-convert-dyn-incompat-trait-obj-box.rs:6:14 - | -LL | trait Trait: Sized {} - | ----- ^^^^^ ...because it requires `Self: Sized` - | | - | this trait is not dyn compatible... - = help: only type `S` implements `Trait`; consider using it directly instead. - = note: required for the cast from `Box<S>` to `Box<dyn Trait>` - -error[E0038]: the trait `Trait` is not dyn compatible - --> $DIR/wf-convert-dyn-incompat-trait-obj-box.rs:17:15 - | -LL | takes_box(Box::new(S)); - | ^^^^^^^^^^^ `Trait` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/wf-convert-dyn-incompat-trait-obj-box.rs:6:14 - | -LL | trait Trait: Sized {} - | ----- ^^^^^ ...because it requires `Self: Sized` - | | - | this trait is not dyn compatible... - = help: only type `S` implements `Trait`; consider using it directly instead. - = note: required for the cast from `Box<S>` to `Box<(dyn Trait + 'static)>` - -error[E0038]: the trait `Trait` is not dyn compatible - --> $DIR/wf-convert-dyn-incompat-trait-obj-box.rs:15:5 - | -LL | Box::new(S) as Box<dyn Trait>; - | ^^^^^^^^^^^ `Trait` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/wf-convert-dyn-incompat-trait-obj-box.rs:6:14 - | -LL | trait Trait: Sized {} - | ----- ^^^^^ ...because it requires `Self: Sized` - | | - | this trait is not dyn compatible... - = help: only type `S` implements `Trait`; consider using it directly instead. - = note: required for the cast from `Box<S>` to `Box<dyn Trait>` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj.rs b/tests/ui/wf/wf-convert-dyn-incompat-trait-obj.rs deleted file mode 100644 index ec4bb2897f9..00000000000 --- a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Check that we do not allow casts or coercions -// to dyn-incompatible trait objects by ref - -#![feature(dyn_compatible_for_dispatch)] - -trait Trait: Sized {} - -struct S; - -impl Trait for S {} - -fn takes_trait(t: &dyn Trait) {} - -fn main() { - &S as &dyn Trait; //~ ERROR E0038 - let t: &dyn Trait = &S; //~ ERROR E0038 - takes_trait(&S); //~ ERROR E0038 -} diff --git a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj.stderr b/tests/ui/wf/wf-convert-dyn-incompat-trait-obj.stderr deleted file mode 100644 index 716d0e78ff1..00000000000 --- a/tests/ui/wf/wf-convert-dyn-incompat-trait-obj.stderr +++ /dev/null @@ -1,54 +0,0 @@ -error[E0038]: the trait `Trait` is not dyn compatible - --> $DIR/wf-convert-dyn-incompat-trait-obj.rs:16:25 - | -LL | let t: &dyn Trait = &S; - | ^^ `Trait` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/wf-convert-dyn-incompat-trait-obj.rs:6:14 - | -LL | trait Trait: Sized {} - | ----- ^^^^^ ...because it requires `Self: Sized` - | | - | this trait is not dyn compatible... - = help: only type `S` implements `Trait`; consider using it directly instead. - = note: required for the cast from `&S` to `&dyn Trait` - -error[E0038]: the trait `Trait` is not dyn compatible - --> $DIR/wf-convert-dyn-incompat-trait-obj.rs:17:17 - | -LL | takes_trait(&S); - | ^^ `Trait` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/wf-convert-dyn-incompat-trait-obj.rs:6:14 - | -LL | trait Trait: Sized {} - | ----- ^^^^^ ...because it requires `Self: Sized` - | | - | this trait is not dyn compatible... - = help: only type `S` implements `Trait`; consider using it directly instead. - = note: required for the cast from `&S` to `&dyn Trait` - -error[E0038]: the trait `Trait` is not dyn compatible - --> $DIR/wf-convert-dyn-incompat-trait-obj.rs:15:5 - | -LL | &S as &dyn Trait; - | ^^ `Trait` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/wf-convert-dyn-incompat-trait-obj.rs:6:14 - | -LL | trait Trait: Sized {} - | ----- ^^^^^ ...because it requires `Self: Sized` - | | - | this trait is not dyn compatible... - = help: only type `S` implements `Trait`; consider using it directly instead. - = note: required for the cast from `&S` to `&dyn Trait` - -error: aborting due to 3 previous errors - -For more information about this error, try `rustc --explain E0038`. diff --git a/tests/ui/wf/wf-dyn-incompat-trait-obj-match.rs b/tests/ui/wf/wf-dyn-incompat-trait-obj-match.rs deleted file mode 100644 index 6eba6b7abec..00000000000 --- a/tests/ui/wf/wf-dyn-incompat-trait-obj-match.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Check that we do not allow coercions to object -// unsafe trait objects in match arms - -#![feature(dyn_compatible_for_dispatch)] - -trait Trait: Sized {} - -struct S; - -impl Trait for S {} - -struct R; - -impl Trait for R {} - -fn opt() -> Option<()> { - Some(()) -} - -fn main() { - match opt() { - Some(()) => &S, - None => &R, //~ ERROR E0308 - } - let t: &dyn Trait = match opt() { - Some(()) => &S, //~ ERROR E0038 - None => &R, //~ ERROR E0038 - }; -} diff --git a/tests/ui/wf/wf-dyn-incompat-trait-obj-match.stderr b/tests/ui/wf/wf-dyn-incompat-trait-obj-match.stderr deleted file mode 100644 index a7405ce4caa..00000000000 --- a/tests/ui/wf/wf-dyn-incompat-trait-obj-match.stderr +++ /dev/null @@ -1,60 +0,0 @@ -error[E0308]: `match` arms have incompatible types - --> $DIR/wf-dyn-incompat-trait-obj-match.rs:23:17 - | -LL | / match opt() { -LL | | Some(()) => &S, - | | -- this is found to be of type `&S` -LL | | None => &R, - | | ^^ expected `&S`, found `&R` -LL | | } - | |_____- `match` arms have incompatible types - | - = note: expected reference `&S` - found reference `&R` - -error[E0038]: the trait `Trait` is not dyn compatible - --> $DIR/wf-dyn-incompat-trait-obj-match.rs:26:21 - | -LL | Some(()) => &S, - | ^^ `Trait` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/wf-dyn-incompat-trait-obj-match.rs:6:14 - | -LL | trait Trait: Sized {} - | ----- ^^^^^ ...because it requires `Self: Sized` - | | - | this trait is not dyn compatible... - = help: the following types implement `Trait`: - S - R - consider defining an enum where each variant holds one of these types, - implementing `Trait` for this new enum and using it instead - = note: required for the cast from `&S` to `&dyn Trait` - -error[E0038]: the trait `Trait` is not dyn compatible - --> $DIR/wf-dyn-incompat-trait-obj-match.rs:27:17 - | -LL | None => &R, - | ^^ `Trait` is not dyn compatible - | -note: for a trait to be dyn compatible it needs to allow building a vtable - for more information, visit <https://doc.rust-lang.org/reference/items/traits.html#dyn-compatibility> - --> $DIR/wf-dyn-incompat-trait-obj-match.rs:6:14 - | -LL | trait Trait: Sized {} - | ----- ^^^^^ ...because it requires `Self: Sized` - | | - | this trait is not dyn compatible... - = help: the following types implement `Trait`: - S - R - consider defining an enum where each variant holds one of these types, - implementing `Trait` for this new enum and using it instead - = note: required for the cast from `&R` to `&dyn Trait` - -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0038, E0308. -For more information about an error, try `rustc --explain E0038`. |
