summaryrefslogtreecommitdiffstats
path: root/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs')
-rw-r--r--tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs
new file mode 100644
index 000000000..3ea80173a
--- /dev/null
+++ b/tests/ui/transmutability/references/recursive-wrapper-types-bit-compatible.rs
@@ -0,0 +1,26 @@
+// check-fail
+// FIXME(bryangarza): Change to check-pass when coinduction is supported for BikeshedIntrinsicFrom
+#![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 B>(); //~ ERROR overflow evaluating the requirement
+}