diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:03:36 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:03:36 +0000 |
commit | 17d40c6057c88f4c432b0d7bac88e1b84cb7e67f (patch) | |
tree | 3f66c4a5918660bb8a758ab6cda5ff8ee4f6cdcd /src/test/ui/transmutability/malformed-program-gracefulness | |
parent | Adding upstream version 1.64.0+dfsg1. (diff) | |
download | rustc-upstream/1.65.0+dfsg1.tar.xz rustc-upstream/1.65.0+dfsg1.zip |
Adding upstream version 1.65.0+dfsg1.upstream/1.65.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/transmutability/malformed-program-gracefulness')
5 files changed, 57 insertions, 15 deletions
diff --git a/src/test/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs b/src/test/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs index e13462d39..b3a1e13b8 100644 --- a/src/test/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs +++ b/src/test/ui/transmutability/malformed-program-gracefulness/unknown_dst.rs @@ -10,7 +10,7 @@ mod assert { pub fn is_transmutable<Src, Dst, Context>() where - Dst: BikeshedIntrinsicFrom<Src, Context, false, false, false, false> + Dst: BikeshedIntrinsicFrom<Src, Context> {} } diff --git a/src/test/ui/transmutability/malformed-program-gracefulness/unknown_src.rs b/src/test/ui/transmutability/malformed-program-gracefulness/unknown_src.rs index dc51e2a8f..092b205b7 100644 --- a/src/test/ui/transmutability/malformed-program-gracefulness/unknown_src.rs +++ b/src/test/ui/transmutability/malformed-program-gracefulness/unknown_src.rs @@ -10,7 +10,7 @@ mod assert { pub fn is_transmutable<Src, Dst, Context>() where - Dst: BikeshedIntrinsicFrom<Src, Context, false, false, false, false> + Dst: BikeshedIntrinsicFrom<Src, Context> {} } diff --git a/src/test/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs b/src/test/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs index 86fc8bd6b..ebe34e134 100644 --- a/src/test/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs +++ b/src/test/ui/transmutability/malformed-program-gracefulness/unknown_src_field.rs @@ -10,7 +10,7 @@ mod assert { pub fn is_transmutable<Src, Dst, Context>() where - Dst: BikeshedIntrinsicFrom<Src, Context, false, false, false, false> + Dst: BikeshedIntrinsicFrom<Src, Context> {} } diff --git a/src/test/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.rs b/src/test/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.rs index bd36748e7..354abf99d 100644 --- a/src/test/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.rs +++ b/src/test/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.rs @@ -2,11 +2,13 @@ //! provided. #![crate_type = "lib"] +#![feature(adt_const_params)] +#![feature(generic_const_exprs)] #![feature(transmutability)] #![allow(dead_code, incomplete_features, non_camel_case_types)] mod assert { - use std::mem::BikeshedIntrinsicFrom; + use std::mem::{Assume, BikeshedIntrinsicFrom}; pub fn is_transmutable< Src, @@ -14,19 +16,34 @@ mod assert { Context, const ASSUME_ALIGNMENT: bool, const ASSUME_LIFETIMES: bool, + const ASSUME_SAFETY: bool, const ASSUME_VALIDITY: bool, - const ASSUME_VISIBILITY: bool, >() where Dst: BikeshedIntrinsicFrom< Src, Context, - ASSUME_ALIGNMENT, - ASSUME_LIFETIMES, - ASSUME_VALIDITY, - ASSUME_VISIBILITY, + { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) } + //~^ ERROR E0080 + //~| ERROR E0080 + //~| ERROR E0080 + //~| ERROR E0080 >, {} + + const fn from_options( + alignment: bool, + lifetimes: bool, + safety: bool, + validity: bool, + ) -> Assume { + Assume { + alignment, + lifetimes, + safety, + validity, + } + } } fn test() { diff --git a/src/test/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.stderr b/src/test/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.stderr index e1464e023..a258f2ece 100644 --- a/src/test/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.stderr +++ b/src/test/ui/transmutability/malformed-program-gracefulness/wrong-type-assume.stderr @@ -1,27 +1,52 @@ error[E0308]: mismatched types - --> $DIR/wrong-type-assume.rs:36:51 + --> $DIR/wrong-type-assume.rs:53:51 | LL | assert::is_transmutable::<Src, Dst, Context, {0u8}, false, false, false>(); | ^^^ expected `bool`, found `u8` +error[E0080]: evaluation of `assert::is_transmutable::<test::Src, test::Dst, test::Context, {0u8}, false, false, false>::{constant#0}` failed + --> $DIR/wrong-type-assume.rs:26:15 + | +LL | { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors + error[E0308]: mismatched types - --> $DIR/wrong-type-assume.rs:37:58 + --> $DIR/wrong-type-assume.rs:54:58 | LL | assert::is_transmutable::<Src, Dst, Context, false, {0u8}, false, false>(); | ^^^ expected `bool`, found `u8` +error[E0080]: evaluation of `assert::is_transmutable::<test::Src, test::Dst, test::Context, false, {0u8}, false, false>::{constant#0}` failed + --> $DIR/wrong-type-assume.rs:26:15 + | +LL | { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors + error[E0308]: mismatched types - --> $DIR/wrong-type-assume.rs:38:65 + --> $DIR/wrong-type-assume.rs:55:65 | LL | assert::is_transmutable::<Src, Dst, Context, false, false, {0u8}, false>(); | ^^^ expected `bool`, found `u8` +error[E0080]: evaluation of `assert::is_transmutable::<test::Src, test::Dst, test::Context, false, false, {0u8}, false>::{constant#0}` failed + --> $DIR/wrong-type-assume.rs:26:15 + | +LL | { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors + error[E0308]: mismatched types - --> $DIR/wrong-type-assume.rs:39:72 + --> $DIR/wrong-type-assume.rs:56:72 | LL | assert::is_transmutable::<Src, Dst, Context, false, false, false, {0u8}>(); | ^^^ expected `bool`, found `u8` -error: aborting due to 4 previous errors +error[E0080]: evaluation of `assert::is_transmutable::<test::Src, test::Dst, test::Context, false, false, false, {0u8}>::{constant#0}` failed + --> $DIR/wrong-type-assume.rs:26:15 + | +LL | { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors + +error: aborting due to 8 previous errors -For more information about this error, try `rustc --explain E0308`. +Some errors have detailed explanations: E0080, E0308. +For more information about an error, try `rustc --explain E0080`. |