const_item_mutation
incorrectly fires when using raw pointers
#78819
Labels
A-lint
Area: Lints (warnings about flaws in source code) such as unused_mut.
A-raw-pointers
Area: raw pointers, MaybeUninit, NonNull
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I tried this code:
I expected to see this happen: This should compile without warnings, as I am just turning the
0x8000_0000
raw pointer into a mutable reference.Instead, this happened:
The lint claims that I'm "taking a mutable reference to a
const
item", but I'm not – the const item is the reference.This warning started popping up a lot for the cortex-m crate, which uses this pattern heavily.
Meta
This is on current nightly (2020-11-05).
The text was updated successfully, but these errors were encountered: