mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-13 00:56:14 +00:00
4b478a5731
which checks for `as` casts between raw pointers without changing its mutability and suggest replacing it with `pointer::cast`.
35 lines
1.4 KiB
Plaintext
35 lines
1.4 KiB
Plaintext
error: `as` casting between raw pointers without changing its mutability
|
|
--> $DIR/ptr_as_ptr.rs:9:13
|
|
|
|
|
LL | let _ = ptr as *const i32;
|
|
| ^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `ptr.cast::<i32>()`
|
|
|
|
|
= note: `-D clippy::ptr-as-ptr` implied by `-D warnings`
|
|
|
|
error: `as` casting between raw pointers without changing its mutability
|
|
--> $DIR/ptr_as_ptr.rs:10:13
|
|
|
|
|
LL | let _ = mut_ptr as *mut i32;
|
|
| ^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `mut_ptr.cast::<i32>()`
|
|
|
|
error: `as` casting between raw pointers without changing its mutability
|
|
--> $DIR/ptr_as_ptr.rs:15:17
|
|
|
|
|
LL | let _ = *ptr_ptr as *const i32;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `(*ptr_ptr).cast::<i32>()`
|
|
|
|
error: `as` casting between raw pointers without changing its mutability
|
|
--> $DIR/ptr_as_ptr.rs:28:25
|
|
|
|
|
LL | let _: *const i32 = ptr as *const _;
|
|
| ^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `ptr.cast()`
|
|
|
|
error: `as` casting between raw pointers without changing its mutability
|
|
--> $DIR/ptr_as_ptr.rs:29:23
|
|
|
|
|
LL | let _: *mut i32 = mut_ptr as _;
|
|
| ^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `mut_ptr.cast()`
|
|
|
|
error: aborting due to 5 previous errors
|
|
|