Closed
Description
Summary
borrow_deref_ref
ignores the usage of &raw const *s
and treats it like &*s
, which is obviously wrong.
Lint Name
borrow_deref_ref
Reproducer
I tried this code:
fn main() {
let s = "Hello, world!\n";
let p = &raw const *s;
unsafe {
libc::printf(p as *const i8);
}
}
I saw this happen:
warning: deref on an immutable reference
--> src/main.rs:3:13
|
3 | let p = &raw const *s;
| ^^^^^^^^^^^^^ help: if you would like to reborrow, try removing `&*`: `s`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrow_deref_ref
= note: `#[warn(clippy::borrow_deref_ref)]` on by default
I expected to see this happen:
no such warning
Version
rustc 1.84.0-nightly
(2024-10-21 4392847)
Additional Labels
No response