From cf94bdc0742c13e2a0cac864c478b8626b266e1b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:11:38 +0200 Subject: Merging upstream version 1.66.0+dfsg1. Signed-off-by: Daniel Baumann --- .../enums/should_order_correctly.rs | 1 - .../enums/should_respect_endianness.rs | 1 - .../enums/should_respect_endianness.stderr | 4 +-- src/test/ui/transmutability/issue-101739-1.rs | 21 ++++++++++++ src/test/ui/transmutability/issue-101739-1.stderr | 16 ++++++++++ src/test/ui/transmutability/issue-101739-2.rs | 37 ++++++++++++++++++++++ src/test/ui/transmutability/issue-101739-2.stderr | 20 ++++++++++++ .../wrong-type-assume.rs | 4 --- .../wrong-type-assume.stderr | 37 ++++------------------ 9 files changed, 102 insertions(+), 39 deletions(-) create mode 100644 src/test/ui/transmutability/issue-101739-1.rs create mode 100644 src/test/ui/transmutability/issue-101739-1.stderr create mode 100644 src/test/ui/transmutability/issue-101739-2.rs create mode 100644 src/test/ui/transmutability/issue-101739-2.stderr (limited to 'src/test/ui/transmutability') diff --git a/src/test/ui/transmutability/enums/should_order_correctly.rs b/src/test/ui/transmutability/enums/should_order_correctly.rs index b753cf0e6..1335cc9d2 100644 --- a/src/test/ui/transmutability/enums/should_order_correctly.rs +++ b/src/test/ui/transmutability/enums/should_order_correctly.rs @@ -2,7 +2,6 @@ //! The payloads of an enum variant should be ordered after its tag. #![crate_type = "lib"] -#![feature(arbitrary_enum_discriminant)] #![feature(transmutability)] #![allow(dead_code)] diff --git a/src/test/ui/transmutability/enums/should_respect_endianness.rs b/src/test/ui/transmutability/enums/should_respect_endianness.rs index 19ff69005..f3567b405 100644 --- a/src/test/ui/transmutability/enums/should_respect_endianness.rs +++ b/src/test/ui/transmutability/enums/should_respect_endianness.rs @@ -2,7 +2,6 @@ //! an enum with a multi-byte tag. #![crate_type = "lib"] -#![feature(arbitrary_enum_discriminant)] #![feature(transmutability)] #![allow(dead_code)] diff --git a/src/test/ui/transmutability/enums/should_respect_endianness.stderr b/src/test/ui/transmutability/enums/should_respect_endianness.stderr index fcb70813b..0845a5edf 100644 --- a/src/test/ui/transmutability/enums/should_respect_endianness.stderr +++ b/src/test/ui/transmutability/enums/should_respect_endianness.stderr @@ -1,12 +1,12 @@ error[E0277]: `Src` cannot be safely transmuted into `Unexpected` in the defining scope of `assert::Context`. - --> $DIR/should_respect_endianness.rs:37:36 + --> $DIR/should_respect_endianness.rs:36:36 | LL | assert::is_transmutable::(); | ^^^^^^^^^^ `Src` cannot be safely transmuted into `Unexpected` in the defining scope of `assert::Context`. | = help: the trait `BikeshedIntrinsicFrom` is not implemented for `Unexpected` note: required by a bound in `is_transmutable` - --> $DIR/should_respect_endianness.rs:15:14 + --> $DIR/should_respect_endianness.rs:14:14 | LL | pub fn is_transmutable() | --------------- required by a bound in this diff --git a/src/test/ui/transmutability/issue-101739-1.rs b/src/test/ui/transmutability/issue-101739-1.rs new file mode 100644 index 000000000..bcb8b158e --- /dev/null +++ b/src/test/ui/transmutability/issue-101739-1.rs @@ -0,0 +1,21 @@ +#![feature(transmutability)] + +mod assert { + use std::mem::BikeshedIntrinsicFrom; + + pub fn is_transmutable() + where + Dst: BikeshedIntrinsicFrom, //~ ERROR cannot find type `Dst` in this scope + //~^ ERROR mismatched types + { + } +} + +fn via_const() { + struct Context; + struct Src; + + assert::is_transmutable::(); +} + +fn main() {} diff --git a/src/test/ui/transmutability/issue-101739-1.stderr b/src/test/ui/transmutability/issue-101739-1.stderr new file mode 100644 index 000000000..5fa741f26 --- /dev/null +++ b/src/test/ui/transmutability/issue-101739-1.stderr @@ -0,0 +1,16 @@ +error[E0412]: cannot find type `Dst` in this scope + --> $DIR/issue-101739-1.rs:8:9 + | +LL | Dst: BikeshedIntrinsicFrom, + | ^^^ not found in this scope + +error[E0308]: mismatched types + --> $DIR/issue-101739-1.rs:8:50 + | +LL | Dst: BikeshedIntrinsicFrom, + | ^^^^^^^^^^^^^^^^ expected struct `Assume`, found `bool` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0308, E0412. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/transmutability/issue-101739-2.rs b/src/test/ui/transmutability/issue-101739-2.rs new file mode 100644 index 000000000..964a7e49e --- /dev/null +++ b/src/test/ui/transmutability/issue-101739-2.rs @@ -0,0 +1,37 @@ +#![crate_type = "lib"] +#![feature(transmutability)] +#![allow(dead_code, incomplete_features, non_camel_case_types)] + +mod assert { + use std::mem::BikeshedIntrinsicFrom; + + pub fn is_transmutable< + Src, + Dst, + Context, + const ASSUME_ALIGNMENT: bool, + const ASSUME_LIFETIMES: bool, + const ASSUME_VALIDITY: bool, + const ASSUME_VISIBILITY: bool, + >() + where + Dst: BikeshedIntrinsicFrom< //~ ERROR this trait takes at most 3 generic arguments but 6 generic arguments were supplied + Src, + Context, + ASSUME_ALIGNMENT, + ASSUME_LIFETIMES, + ASSUME_VALIDITY, + ASSUME_VISIBILITY, + >, + {} +} + +fn via_const() { + struct Context; + #[repr(C)] struct Src; + #[repr(C)] struct Dst; + + const FALSE: bool = false; + + assert::is_transmutable::(); +} diff --git a/src/test/ui/transmutability/issue-101739-2.stderr b/src/test/ui/transmutability/issue-101739-2.stderr new file mode 100644 index 000000000..3f83d6583 --- /dev/null +++ b/src/test/ui/transmutability/issue-101739-2.stderr @@ -0,0 +1,20 @@ +error[E0107]: this trait takes at most 3 generic arguments but 6 generic arguments were supplied + --> $DIR/issue-101739-2.rs:18:14 + | +LL | Dst: BikeshedIntrinsicFrom< + | ^^^^^^^^^^^^^^^^^^^^^ expected at most 3 generic arguments +... +LL | / ASSUME_LIFETIMES, +LL | | ASSUME_VALIDITY, +LL | | ASSUME_VISIBILITY, + | |_____________________________- help: remove these generic arguments + | +note: trait defined here, with at most 3 generic parameters: `Src`, `Context`, `ASSUME` + --> $SRC_DIR/core/src/mem/transmutability.rs:LL:COL + | +LL | pub unsafe trait BikeshedIntrinsicFrom + | ^^^^^^^^^^^^^^^^^^^^^ --- ------- ------------------------------------------ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0107`. 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 354abf99d..52aa4bb31 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 @@ -24,10 +24,6 @@ mod assert { Src, Context, { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) } - //~^ ERROR E0080 - //~| ERROR E0080 - //~| ERROR E0080 - //~| ERROR E0080 >, {} 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 a258f2ece..c6d93876c 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,52 +1,27 @@ error[E0308]: mismatched types - --> $DIR/wrong-type-assume.rs:53:51 + --> $DIR/wrong-type-assume.rs:49:51 | LL | assert::is_transmutable::(); | ^^^ expected `bool`, found `u8` -error[E0080]: evaluation of `assert::is_transmutable::::{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:54:58 + --> $DIR/wrong-type-assume.rs:50:58 | LL | assert::is_transmutable::(); | ^^^ expected `bool`, found `u8` -error[E0080]: evaluation of `assert::is_transmutable::::{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:55:65 + --> $DIR/wrong-type-assume.rs:51:65 | LL | assert::is_transmutable::(); | ^^^ expected `bool`, found `u8` -error[E0080]: evaluation of `assert::is_transmutable::::{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:56:72 + --> $DIR/wrong-type-assume.rs:52:72 | LL | assert::is_transmutable::(); | ^^^ expected `bool`, found `u8` -error[E0080]: evaluation of `assert::is_transmutable::::{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 +error: aborting due to 4 previous errors -Some errors have detailed explanations: E0080, E0308. -For more information about an error, try `rustc --explain E0080`. +For more information about this error, try `rustc --explain E0308`. -- cgit v1.2.3