forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#106927 - Ezrashaw:e0606-make-machine-applic…
…able, r=estebank make `CastError::NeedsDeref` create a `MachineApplicable` suggestion Fixes rust-lang#106903 Simple impl for the linked issue. I also made some other small changes: - `CastError::ErrorGuaranteed` now owns an actual `ErrorGuaranteed`. This better enforces the static guarantees of `ErrorGuaranteed`. - `CastError::NeedDeref` code simplified a bit, we now just suggest the `*`, instead of the whole expression as well.
- Loading branch information
Showing
6 changed files
with
64 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
fn main() { | ||
&0u8 as u8; //~ ERROR E0606 | ||
let x = &(&0u8 as u8); //~ ERROR E0606 | ||
x as u8; //~ casting `&u8` as `u8` is invalid [E0606] | ||
} |
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,12 +1,26 @@ | ||
error[E0606]: casting `&u8` as `u8` is invalid | ||
--> $DIR/E0606.rs:2:5 | ||
--> $DIR/E0606.rs:2:14 | ||
| | ||
LL | &0u8 as u8; | ||
| ----^^^^^^ | ||
| | | ||
| cannot cast `&u8` as `u8` | ||
| help: dereference the expression: `*&0u8` | ||
LL | let x = &(&0u8 as u8); | ||
| ^^^^^^^^^^^^ | ||
| | ||
help: remove the unneeded borrow | ||
| | ||
LL - let x = &(&0u8 as u8); | ||
LL + let x = &(0u8 as u8); | ||
| | ||
|
||
error[E0606]: casting `&u8` as `u8` is invalid | ||
--> $DIR/E0606.rs:3:5 | ||
| | ||
LL | x as u8; | ||
| ^^^^^^^ | ||
| | ||
help: dereference the expression | ||
| | ||
LL | *x as u8; | ||
| + | ||
|
||
error: aborting due to previous error | ||
error: aborting due to 2 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0606`. |
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