2023-07-02 12:35:19 +00:00
|
|
|
error: `as` casting between raw pointers while changing only its constness
|
2024-02-19 13:53:53 +00:00
|
|
|
--> tests/ui/ptr_cast_constness.rs:15:41
|
2023-06-02 09:41:57 +00:00
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | let _: &mut T = std::mem::transmute(p as *mut T);
|
|
|
|
| ^^^^^^^^^^^ help: try `pointer::cast_mut`, a safer alternative: `p.cast_mut()`
|
2023-06-02 09:41:57 +00:00
|
|
|
|
|
|
|
|
= note: `-D clippy::ptr-cast-constness` implied by `-D warnings`
|
2023-08-01 12:02:21 +00:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::ptr_cast_constness)]`
|
2023-06-02 09:41:57 +00:00
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
error: `as` casting between raw pointers while changing only its constness
|
2024-02-19 13:53:53 +00:00
|
|
|
--> tests/ui/ptr_cast_constness.rs:16:19
|
2023-07-02 12:35:19 +00:00
|
|
|
|
|
|
|
|
LL | let _ = &mut *(p as *mut T);
|
|
|
|
| ^^^^^^^^^^^^^ help: try `pointer::cast_mut`, a safer alternative: `p.cast_mut()`
|
|
|
|
|
|
|
|
error: `as` casting between raw pointers while changing only its constness
|
2024-02-19 13:53:53 +00:00
|
|
|
--> tests/ui/ptr_cast_constness.rs:31:17
|
2023-07-02 12:35:19 +00:00
|
|
|
|
|
|
|
|
LL | let _ = *ptr_ptr as *mut u32;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast_mut`, a safer alternative: `(*ptr_ptr).cast_mut()`
|
|
|
|
|
|
|
|
error: `as` casting between raw pointers while changing only its constness
|
2024-02-19 13:53:53 +00:00
|
|
|
--> tests/ui/ptr_cast_constness.rs:34:13
|
2023-06-02 09:41:57 +00:00
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | let _ = ptr as *mut u32;
|
2023-06-02 09:41:57 +00:00
|
|
|
| ^^^^^^^^^^^^^^^ help: try `pointer::cast_mut`, a safer alternative: `ptr.cast_mut()`
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
error: `as` casting between raw pointers while changing only its constness
|
2024-02-19 13:53:53 +00:00
|
|
|
--> tests/ui/ptr_cast_constness.rs:35:13
|
2023-06-02 09:41:57 +00:00
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | let _ = mut_ptr as *const u32;
|
2023-06-02 09:41:57 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast_const`, a safer alternative: `mut_ptr.cast_const()`
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
error: `as` casting between raw pointers while changing only its constness
|
2024-07-23 11:11:22 +00:00
|
|
|
--> tests/ui/ptr_cast_constness.rs:68:13
|
2023-06-02 09:41:57 +00:00
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | let _ = ptr as *mut u32;
|
2023-06-02 09:41:57 +00:00
|
|
|
| ^^^^^^^^^^^^^^^ help: try `pointer::cast_mut`, a safer alternative: `ptr.cast_mut()`
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
error: `as` casting between raw pointers while changing only its constness
|
2024-07-23 11:11:22 +00:00
|
|
|
--> tests/ui/ptr_cast_constness.rs:69:13
|
2023-06-02 09:41:57 +00:00
|
|
|
|
|
2023-07-02 12:35:19 +00:00
|
|
|
LL | let _ = mut_ptr as *const u32;
|
2023-06-02 09:41:57 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast_const`, a safer alternative: `mut_ptr.cast_const()`
|
|
|
|
|
2024-09-07 14:18:45 +00:00
|
|
|
error: `as` casting to make a const null pointer into a mutable null pointer
|
|
|
|
--> tests/ui/ptr_cast_constness.rs:75:13
|
|
|
|
|
|
|
|
|
LL | let _ = ptr::null::<String>() as *mut String;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `null_mut()` directly instead: `std::ptr::null_mut::<String>()`
|
|
|
|
|
|
|
|
error: `as` casting to make a mutable null pointer into a const null pointer
|
|
|
|
--> tests/ui/ptr_cast_constness.rs:76:13
|
|
|
|
|
|
|
|
|
LL | let _ = ptr::null_mut::<u32>() as *const u32;
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `null()` directly instead: `std::ptr::null::<u32>()`
|
|
|
|
|
2024-09-07 19:57:29 +00:00
|
|
|
error: changing constness of a null pointer
|
|
|
|
--> tests/ui/ptr_cast_constness.rs:77:13
|
|
|
|
|
|
|
|
|
LL | let _ = ptr::null::<u32>().cast_mut();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `null_mut()` directly instead: `std::ptr::null_mut::<u32>()`
|
|
|
|
|
|
|
|
error: changing constness of a null pointer
|
|
|
|
--> tests/ui/ptr_cast_constness.rs:78:13
|
|
|
|
|
|
|
|
|
LL | let _ = ptr::null_mut::<u32>().cast_const();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `null()` directly instead: `std::ptr::null::<u32>()`
|
|
|
|
|
2024-09-07 14:18:45 +00:00
|
|
|
error: `as` casting to make a const null pointer into a mutable null pointer
|
2024-09-07 19:57:29 +00:00
|
|
|
--> tests/ui/ptr_cast_constness.rs:81:21
|
2024-09-07 14:18:45 +00:00
|
|
|
|
|
|
|
|
LL | let _ = inline!(ptr::null::<u32>() as *mut u32);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `null_mut()` directly instead: `std::ptr::null_mut::<u32>()`
|
|
|
|
|
|
|
|
|
= note: this error originates in the macro `__inline_mac_fn_null_pointers` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
|
2024-09-07 19:57:29 +00:00
|
|
|
error: changing constness of a null pointer
|
|
|
|
--> tests/ui/ptr_cast_constness.rs:82:21
|
|
|
|
|
|
|
|
|
LL | let _ = inline!(ptr::null::<u32>().cast_mut());
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `null_mut()` directly instead: `std::ptr::null_mut::<u32>()`
|
|
|
|
|
|
|
|
|
= note: this error originates in the macro `__inline_mac_fn_null_pointers` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
|
|
|
|
error: aborting due to 13 previous errors
|
2023-06-02 09:41:57 +00:00
|
|
|
|