We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a1233a7 commit bf8b2aaCopy full SHA for bf8b2aa
tests/run-pass/enum_discriminant_ptr_value.rs
@@ -0,0 +1,9 @@
1
+// A niche-optimized enum where the discriminant is a pointer value -- relies on ptr-to-int casts in
2
+// the niche handling code.
3
+// compile-flags: -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
4
+
5
+fn main() {
6
+ let x = 42;
7
+ let val: Option<&i32> = unsafe { std::mem::transmute((&x as *const i32).wrapping_offset(2)) };
8
+ assert!(val.is_some());
9
+}
0 commit comments