From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- .../primitive_reprs_should_have_correct_length.rs | 156 +++++++ ...imitive_reprs_should_have_correct_length.stderr | 463 +++++++++++++++++++++ .../repr/should_require_well_defined_layout.rs | 124 ++++++ .../repr/should_require_well_defined_layout.stderr | 141 +++++++ 4 files changed, 884 insertions(+) create mode 100644 tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.rs create mode 100644 tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr create mode 100644 tests/ui/transmutability/enums/repr/should_require_well_defined_layout.rs create mode 100644 tests/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr (limited to 'tests/ui/transmutability/enums/repr') diff --git a/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.rs b/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.rs new file mode 100644 index 000000000..940f070e7 --- /dev/null +++ b/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.rs @@ -0,0 +1,156 @@ +//! An enum with a primitive repr should have exactly the size of that primitive. + +#![crate_type = "lib"] +#![feature(transmutability)] +#![allow(dead_code)] + +mod assert { + use std::mem::{Assume, BikeshedIntrinsicFrom}; + + pub fn is_transmutable() + where + Dst: BikeshedIntrinsicFrom + {} +} + +#[repr(C)] +struct Zst; + +#[derive(Clone, Copy)] +#[repr(i8)] enum V0i8 { V } +#[repr(u8)] enum V0u8 { V } +#[repr(i16)] enum V0i16 { V } +#[repr(u16)] enum V0u16 { V } +#[repr(i32)] enum V0i32 { V } +#[repr(u32)] enum V0u32 { V } +#[repr(i64)] enum V0i64 { V } +#[repr(u64)] enum V0u64 { V } +#[repr(isize)] enum V0isize { V } +#[repr(usize)] enum V0usize { V } + +fn n8() { + struct Context; + + type Smaller = Zst; + type Analog = u8; + type Larger = u16; + + fn i_should_have_correct_length() { + type Current = V0i8; + + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::(); + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + } + + fn u_should_have_correct_length() { + type Current = V0u8; + + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::(); + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + } +} + +fn n16() { + struct Context; + + type Smaller = u8; + type Analog = u16; + type Larger = u32; + + fn i_should_have_correct_length() { + type Current = V0i16; + + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::(); + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + } + + fn u_should_have_correct_length() { + type Current = V0u16; + + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::(); + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + } +} + +fn n32() { + struct Context; + + type Smaller = u16; + type Analog = u32; + type Larger = u64; + + fn i_should_have_correct_length() { + type Current = V0i32; + + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::(); + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + } + + fn u_should_have_correct_length() { + type Current = V0u32; + + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::(); + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + } +} + +fn n64() { + struct Context; + + type Smaller = u32; + type Analog = u64; + type Larger = u128; + + fn i_should_have_correct_length() { + type Current = V0i64; + + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::(); + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + } + + fn u_should_have_correct_length() { + type Current = V0u64; + + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::(); + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + } +} + +fn nsize() { + struct Context; + + type Smaller = u8; + type Analog = usize; + type Larger = [usize; 2]; + + fn i_should_have_correct_length() { + type Current = V0isize; + + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::(); + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + } + + fn u_should_have_correct_length() { + type Current = V0usize; + + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + assert::is_transmutable::(); + assert::is_transmutable::(); //~ ERROR cannot be safely transmuted + } +} diff --git a/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr b/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr new file mode 100644 index 000000000..4da5fcea3 --- /dev/null +++ b/tests/ui/transmutability/enums/repr/primitive_reprs_should_have_correct_length.stderr @@ -0,0 +1,463 @@ +error[E0277]: `Zst` cannot be safely transmuted into `V0i8` in the defining scope of `n8::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:48:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^^ `Zst` cannot be safely transmuted into `V0i8` in the defining scope of `n8::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0i8` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error[E0277]: `V0i8` cannot be safely transmuted into `u16` in the defining scope of `n8::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:50:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^ `V0i8` cannot be safely transmuted into `u16` in the defining scope of `n8::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u16` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error[E0277]: `Zst` cannot be safely transmuted into `V0u8` in the defining scope of `n8::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:56:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^^ `Zst` cannot be safely transmuted into `V0u8` in the defining scope of `n8::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0u8` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error[E0277]: `V0u8` cannot be safely transmuted into `u16` in the defining scope of `n8::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:58:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^ `V0u8` cannot be safely transmuted into `u16` in the defining scope of `n8::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u16` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `V0i16` in the defining scope of `n16::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:72:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^^ `u8` cannot be safely transmuted into `V0i16` in the defining scope of `n16::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0i16` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error[E0277]: `V0i16` cannot be safely transmuted into `u32` in the defining scope of `n16::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:74:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^ `V0i16` cannot be safely transmuted into `u32` in the defining scope of `n16::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `V0u16` in the defining scope of `n16::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:80:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^^ `u8` cannot be safely transmuted into `V0u16` in the defining scope of `n16::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0u16` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error[E0277]: `V0u16` cannot be safely transmuted into `u32` in the defining scope of `n16::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:82:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^ `V0u16` cannot be safely transmuted into `u32` in the defining scope of `n16::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u32` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error[E0277]: `u16` cannot be safely transmuted into `V0i32` in the defining scope of `n32::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:96:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^^ `u16` cannot be safely transmuted into `V0i32` in the defining scope of `n32::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0i32` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error[E0277]: `V0i32` cannot be safely transmuted into `u64` in the defining scope of `n32::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:98:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^ `V0i32` cannot be safely transmuted into `u64` in the defining scope of `n32::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error[E0277]: `u16` cannot be safely transmuted into `V0u32` in the defining scope of `n32::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:104:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^^ `u16` cannot be safely transmuted into `V0u32` in the defining scope of `n32::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0u32` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error[E0277]: `V0u32` cannot be safely transmuted into `u64` in the defining scope of `n32::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:106:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^ `V0u32` cannot be safely transmuted into `u64` in the defining scope of `n32::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u64` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error[E0277]: `u32` cannot be safely transmuted into `V0i64` in the defining scope of `n64::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:120:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^^ `u32` cannot be safely transmuted into `V0i64` in the defining scope of `n64::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0i64` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error[E0277]: `V0i64` cannot be safely transmuted into `u128` in the defining scope of `n64::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:122:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^ `V0i64` cannot be safely transmuted into `u128` in the defining scope of `n64::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error[E0277]: `u32` cannot be safely transmuted into `V0u64` in the defining scope of `n64::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:128:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^^ `u32` cannot be safely transmuted into `V0u64` in the defining scope of `n64::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0u64` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error[E0277]: `V0u64` cannot be safely transmuted into `u128` in the defining scope of `n64::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:130:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^ `V0u64` cannot be safely transmuted into `u128` in the defining scope of `n64::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `u128` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `V0isize` in the defining scope of `nsize::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:144:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^^ `u8` cannot be safely transmuted into `V0isize` in the defining scope of `nsize::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0isize` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error[E0277]: `V0isize` cannot be safely transmuted into `[usize; 2]` in the defining scope of `nsize::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:146:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^ `V0isize` cannot be safely transmuted into `[usize; 2]` in the defining scope of `nsize::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `[usize; 2]` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error[E0277]: `u8` cannot be safely transmuted into `V0usize` in the defining scope of `nsize::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:152:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^^ `u8` cannot be safely transmuted into `V0usize` in the defining scope of `nsize::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `V0usize` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error[E0277]: `V0usize` cannot be safely transmuted into `[usize; 2]` in the defining scope of `nsize::Context`. + --> $DIR/primitive_reprs_should_have_correct_length.rs:154:44 + | +LL | assert::is_transmutable::(); + | ^^^^^^ `V0usize` cannot be safely transmuted into `[usize; 2]` in the defining scope of `nsize::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `[usize; 2]` +note: required by a bound in `is_transmutable` + --> $DIR/primitive_reprs_should_have_correct_length.rs:12:14 + | +LL | pub fn is_transmutable() + | --------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_transmutable` + +error: aborting due to 20 previous errors + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.rs b/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.rs new file mode 100644 index 000000000..102111ae2 --- /dev/null +++ b/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.rs @@ -0,0 +1,124 @@ +//! An enum must have a well-defined layout to participate in a transmutation. + +#![crate_type = "lib"] +#![feature(repr128)] +#![feature(transmutability)] +#![allow(dead_code, incomplete_features, non_camel_case_types)] + +mod assert { + use std::mem::{Assume, BikeshedIntrinsicFrom}; + pub struct Context; + + pub fn is_maybe_transmutable() + where + Dst: BikeshedIntrinsicFrom + {} +} + +fn should_reject_repr_rust() { + fn void() { + enum repr_rust {} + assert::is_maybe_transmutable::(); //~ ERROR cannot be safely transmuted + assert::is_maybe_transmutable::(); //~ ERROR cannot be safely transmuted + } + + fn singleton() { + enum repr_rust { V } + assert::is_maybe_transmutable::(); //~ ERROR cannot be safely transmuted + assert::is_maybe_transmutable::(); //~ ERROR cannot be safely transmuted + } + + fn duplex() { + enum repr_rust { A, B } + assert::is_maybe_transmutable::(); //~ ERROR cannot be safely transmuted + assert::is_maybe_transmutable::(); //~ ERROR cannot be safely transmuted + } +} + +fn should_accept_primitive_reprs() +{ + fn should_accept_repr_i8() { + #[repr(i8)] enum repr_i8 { V } + assert::is_maybe_transmutable::(); + assert::is_maybe_transmutable::(); + } + + fn should_accept_repr_u8() { + #[repr(u8)] enum repr_u8 { V } + assert::is_maybe_transmutable::(); + assert::is_maybe_transmutable::(); + } + + fn should_accept_repr_i16() { + #[repr(i16)] enum repr_i16 { V } + assert::is_maybe_transmutable::(); + assert::is_maybe_transmutable::(); + } + + fn should_accept_repr_u16() { + #[repr(u16)] enum repr_u16 { V } + assert::is_maybe_transmutable::(); + assert::is_maybe_transmutable::(); + } + + fn should_accept_repr_i32() { + #[repr(i32)] enum repr_i32 { V } + assert::is_maybe_transmutable::(); + assert::is_maybe_transmutable::(); + } + + fn should_accept_repr_u32() { + #[repr(u32)] enum repr_u32 { V } + assert::is_maybe_transmutable::(); + assert::is_maybe_transmutable::(); + } + + fn should_accept_repr_i64() { + #[repr(i64)] enum repr_i64 { V } + assert::is_maybe_transmutable::(); + assert::is_maybe_transmutable::(); + } + + fn should_accept_repr_u64() { + #[repr(u64)] enum repr_u64 { V } + assert::is_maybe_transmutable::(); + assert::is_maybe_transmutable::(); + } + + fn should_accept_repr_i128() { + #[repr(i128)] enum repr_i128 { V } + assert::is_maybe_transmutable::(); + assert::is_maybe_transmutable::(); + } + + fn should_accept_repr_u128() { + #[repr(u128)] enum repr_u128 { V } + assert::is_maybe_transmutable::(); + assert::is_maybe_transmutable::(); + } + + fn should_accept_repr_isize() { + #[repr(isize)] enum repr_isize { V } + assert::is_maybe_transmutable::(); + assert::is_maybe_transmutable::(); + } + + fn should_accept_repr_usize() { + #[repr(usize)] enum repr_usize { V } + assert::is_maybe_transmutable::(); + assert::is_maybe_transmutable::(); + } +} + +fn should_accept_repr_C() { + #[repr(C)] enum repr_c { V } + assert::is_maybe_transmutable::(); + assert::is_maybe_transmutable::(); +} diff --git a/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr b/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr new file mode 100644 index 000000000..510b8c56e --- /dev/null +++ b/tests/ui/transmutability/enums/repr/should_require_well_defined_layout.stderr @@ -0,0 +1,141 @@ +error[E0277]: `void::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. + --> $DIR/should_require_well_defined_layout.rs:28:52 + | +LL | assert::is_maybe_transmutable::(); + | ^^ `void::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/should_require_well_defined_layout.rs:14:14 + | +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` + +error[E0277]: `u128` cannot be safely transmuted into `void::repr_rust` in the defining scope of `assert::Context`. + --> $DIR/should_require_well_defined_layout.rs:29:47 + | +LL | assert::is_maybe_transmutable::(); + | ^^^^^^^^^ `u128` cannot be safely transmuted into `void::repr_rust` in the defining scope of `assert::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `void::repr_rust` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/should_require_well_defined_layout.rs:14:14 + | +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` + +error[E0277]: `singleton::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. + --> $DIR/should_require_well_defined_layout.rs:34:52 + | +LL | assert::is_maybe_transmutable::(); + | ^^ `singleton::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/should_require_well_defined_layout.rs:14:14 + | +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` + +error[E0277]: `u128` cannot be safely transmuted into `singleton::repr_rust` in the defining scope of `assert::Context`. + --> $DIR/should_require_well_defined_layout.rs:35:47 + | +LL | assert::is_maybe_transmutable::(); + | ^^^^^^^^^ `u128` cannot be safely transmuted into `singleton::repr_rust` in the defining scope of `assert::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `singleton::repr_rust` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/should_require_well_defined_layout.rs:14:14 + | +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` + +error[E0277]: `duplex::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. + --> $DIR/should_require_well_defined_layout.rs:40:52 + | +LL | assert::is_maybe_transmutable::(); + | ^^ `duplex::repr_rust` cannot be safely transmuted into `()` in the defining scope of `assert::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `()` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/should_require_well_defined_layout.rs:14:14 + | +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` + +error[E0277]: `u128` cannot be safely transmuted into `duplex::repr_rust` in the defining scope of `assert::Context`. + --> $DIR/should_require_well_defined_layout.rs:41:47 + | +LL | assert::is_maybe_transmutable::(); + | ^^^^^^^^^ `u128` cannot be safely transmuted into `duplex::repr_rust` in the defining scope of `assert::Context`. + | + = help: the trait `BikeshedIntrinsicFrom` is not implemented for `duplex::repr_rust` +note: required by a bound in `is_maybe_transmutable` + --> $DIR/should_require_well_defined_layout.rs:14:14 + | +LL | pub fn is_maybe_transmutable() + | --------------------- required by a bound in this +LL | where +LL | Dst: BikeshedIntrinsicFrom + | |__________^ required by this bound in `is_maybe_transmutable` + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0277`. -- cgit v1.2.3