-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when applied
Description
Summary
Code from macro shows up in suggestion
Reproducer
I tried this code:
#![deny(clippy::ptr_cast_constness)]
fn main() {
let mut local = 4;
let _ = std::ptr::addr_of_mut!(local) as *const _;
}
I expected to see this happen:
`4 | let _ = std::ptr::addr_of_mut!(local) as *const _;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast_const`, a safer alternative: `std::ptr::addr_of_mut!(local).cast_const()`
Instead, this happened:
4 | let _ = std::ptr::addr_of_mut!(local) as *const _;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast_const`, a safer alternative: `(&raw mut $place).cast_const()`
@rustbot claim
@rustbot label +I-suggestion-causes-error
Version
Additional Labels
No response
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when applied