summaryrefslogtreecommitdiffstats
path: root/tests/ui/transmutability/references/u8-to-unit.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/transmutability/references/u8-to-unit.rs')
-rw-r--r--tests/ui/transmutability/references/u8-to-unit.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/ui/transmutability/references/u8-to-unit.rs b/tests/ui/transmutability/references/u8-to-unit.rs
new file mode 100644
index 000000000..8b37492bd
--- /dev/null
+++ b/tests/ui/transmutability/references/u8-to-unit.rs
@@ -0,0 +1,24 @@
+// check-pass
+#![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: false,
+ lifetimes: true,
+ safety: true,
+ validity: false,
+ }
+ }>
+ {}
+}
+
+fn main() {
+ #[repr(C)] struct Unit;
+ assert::is_maybe_transmutable::<&'static u8, &'static Unit>();
+}