declare_interior_mutable_const fires for static pointer types #13233
Labels
C-bug
Category: Clippy is not doing the correct thing
I-false-positive
Issue: The lint was triggered on code it shouldn't have
Summary
Unless I'm not understanding something here,
declare_interior_mutable_const
seems to be firing a false-positive for pointers to inner mutable types. I can understand why constant inner-mutables make no sense, but pointers to static inner mutables are a different thing - the pointer is the constant part, not the object itself, and in certain (all?) contexts, the pointer will not change.Lint Name
declare_interior_mutable_const
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen:
No warning.
Playground link:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=c920c5c7250d8e8f02d481675415664b
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: