]> 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 009b5fa534cf0fcf46b58c27ea163c5d144ac0e8..9e213aab68c5704a2d2079391a6e0a56a7e2bc6f 100644 (file)
@@ -1,5 +1,5 @@
 #![warn(clippy::transmute_ptr_to_ptr)]
-#![allow(clippy::transmutes_expressible_as_ptr_casts)]
+
 // Make sure we can modify lifetimes, which is one of the recommended uses
 // of transmute
 
@@ -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() {}