summaryrefslogtreecommitdiffstats
path: root/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.rs')
-rw-r--r--tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.rs b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.rs
new file mode 100644
index 000000000..a6e2889d3
--- /dev/null
+++ b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible-mut.rs
@@ -0,0 +1,25 @@
+// check-fail
+#![feature(transmutability)]
+
+mod assert {
+ use std::mem::{Assume, BikeshedIntrinsicFrom};
+ pub struct Context;
+
+ pub fn is_maybe_transmutable<Src, Dst>()
+ where
+ Dst: BikeshedIntrinsicFrom<Src, Context, {
+ Assume {
+ alignment: true,
+ lifetimes: false,
+ safety: true,
+ validity: false,
+ }
+ }>
+ {}
+}
+
+fn main() {
+ #[repr(C)] struct A(bool, &'static A);
+ #[repr(C)] struct B(u8, &'static B);
+ assert::is_maybe_transmutable::<&'static A, &'static mut B>(); //~ ERROR cannot be safely transmuted
+}