forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#11288 - Centri3:rust-lang#11278, r=Alexendoo
[`ptr_as_ptr`]: Take snippet instead of pretty printing type Fixes rust-lang#11278 changelog: [`ptr_as_ptr`]: Include leading `super`s in suggestion
- Loading branch information
Showing
4 changed files
with
82 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,60 @@ | ||
error: `as` casting between raw pointers without changing its mutability | ||
--> $DIR/ptr_as_ptr.rs:14:13 | ||
--> $DIR/ptr_as_ptr.rs:19:33 | ||
| | ||
LL | let _ = ptr as *const i32; | ||
| ^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `ptr.cast::<i32>()` | ||
LL | *unsafe { Box::from_raw(Box::into_raw(Box::new(o)) as *mut super::issue_11278_a::T<String>) } | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `Box::into_raw(Box::new(o)).cast::<super::issue_11278_a::T<String>>()` | ||
| | ||
= 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:15:13 | ||
--> $DIR/ptr_as_ptr.rs:28:13 | ||
| | ||
LL | let _ = ptr as *const i32; | ||
| ^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `ptr.cast::<i32>()` | ||
|
||
error: `as` casting between raw pointers without changing its mutability | ||
--> $DIR/ptr_as_ptr.rs:29: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:20:17 | ||
--> $DIR/ptr_as_ptr.rs:34: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:33:25 | ||
--> $DIR/ptr_as_ptr.rs:47: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:34:23 | ||
--> $DIR/ptr_as_ptr.rs:48:23 | ||
| | ||
LL | let _: *mut i32 = mut_ptr as _; | ||
| ^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `mut_ptr.cast()` | ||
|
||
error: `as` casting between raw pointers without changing its mutability | ||
--> $DIR/ptr_as_ptr.rs:37:21 | ||
--> $DIR/ptr_as_ptr.rs:51:21 | ||
| | ||
LL | let _ = inline!($ptr as *const i32); | ||
| ^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `$ptr.cast::<i32>()` | ||
| | ||
= note: this error originates in the macro `__inline_mac_fn_main` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: `as` casting between raw pointers without changing its mutability | ||
--> $DIR/ptr_as_ptr.rs:58:13 | ||
--> $DIR/ptr_as_ptr.rs:72:13 | ||
| | ||
LL | let _ = ptr as *const i32; | ||
| ^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `ptr.cast::<i32>()` | ||
|
||
error: `as` casting between raw pointers without changing its mutability | ||
--> $DIR/ptr_as_ptr.rs:59:13 | ||
--> $DIR/ptr_as_ptr.rs:73:13 | ||
| | ||
LL | let _ = mut_ptr as *mut i32; | ||
| ^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `mut_ptr.cast::<i32>()` | ||
|
||
error: aborting due to 8 previous errors | ||
error: aborting due to 9 previous errors | ||
|