diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:13 +0000 |
commit | 218caa410aa38c29984be31a5229b9fa717560ee (patch) | |
tree | c54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/transmutability/structs/should_order_fields_correctly.rs | |
parent | Releasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip |
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/transmutability/structs/should_order_fields_correctly.rs')
-rw-r--r-- | src/test/ui/transmutability/structs/should_order_fields_correctly.rs | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/src/test/ui/transmutability/structs/should_order_fields_correctly.rs b/src/test/ui/transmutability/structs/should_order_fields_correctly.rs deleted file mode 100644 index 28724562b..000000000 --- a/src/test/ui/transmutability/structs/should_order_fields_correctly.rs +++ /dev/null @@ -1,36 +0,0 @@ -// check-pass -//! The fields of a struct should be laid out in lexical order. - -#![crate_type = "lib"] -#![feature(transmutability)] -#![allow(dead_code)] - -mod assert { - use std::mem::{Assume, BikeshedIntrinsicFrom}; - pub struct Context; - - pub fn is_transmutable<Src, Dst>() - where - Dst: BikeshedIntrinsicFrom<Src, Context, { - Assume::ALIGNMENT - .and(Assume::LIFETIMES) - .and(Assume::SAFETY) - .and(Assume::VALIDITY) - }> - {} -} - -#[repr(u8)] enum V0 { V = 0 } -#[repr(u8)] enum V1 { V = 1 } -#[repr(u8)] enum V2 { V = 2 } - -#[repr(C)] struct S01(V0, V1); -#[repr(C)] struct S012(V0, V1, V2); - -fn should_order_tag_and_fields_correctly() { - // An implementation that (incorrectly) arranges S01 as [0x01, 0x00] will, - // in principle, reject this transmutation. - assert::is_transmutable::<S01, V0>(); - // Again, but with one more field. - assert::is_transmutable::<S012, S01>(); -} |