Closed
Description
Summary
There's one last FP in #2906 that wasn't fixed
Lint Name
transmute_ptr_to_ref
Reproducer
I tried this code:
#![allow(clippy::missing_safety_doc)]
use std::mem::transmute;
pub unsafe fn ptr_to_ref<'a, 'b>(ptr: *const &'a ()) -> &&'b () {
transmute(ptr)
}
I saw this happen:
warning: transmute from a pointer type (`*const &()`) to a reference type (`&&()`)
--> t.rs:5:5
|
5 | std::mem::transmute(ptr)
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&*ptr`
|
I expected to see this happen:
It shouldn't lint, as &*ptr
would fail to compile
Version
No response
Additional Labels
No response