]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/transmute_ptr_to_ptr.rs
Addition `manual_map` test for `unsafe` blocks
[rust.git] / tests / ui / transmute_ptr_to_ptr.rs
index 0d8a322f2b2b0b7fa31f410c4af644409b1e0310..9e213aab68c5704a2d2079391a6e0a56a7e2bc6f 100644 (file)
@@ -51,4 +51,12 @@ fn transmute_ptr_to_ptr() {
     let _: &GenericParam<&LifetimeParam<'static>> = unsafe { std::mem::transmute(&GenericParam { t: &lp }) };
 }
 
+// dereferencing raw pointers in const contexts, should not lint as it's unstable (issue 5959)
+const _: &() = {
+    struct Zst;
+    let zst = &Zst;
+
+    unsafe { std::mem::transmute::<&'static Zst, &'static ()>(zst) }
+};
+
 fn main() {}