]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/tests/ui/transmute_ptr_to_ptr.rs
Rollup merge of #78769 - est31:remove_lifetimes, r=KodrAus
[rust.git] / src / tools / clippy / tests / ui / transmute_ptr_to_ptr.rs
index 0d8a322f2b2b0b7fa31f410c4af644409b1e0310..26b03bdc74055665d927efde9bbd8ae50ccd6f71 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() {}