-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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 #117695 - 3tilley:prioritise-unwrap-expect-over-last-…
…method-call, r=compiler-errors Reorder checks to make sure potential missing expect on Option/Result… … runs before removing last method call Fixes #117669
- Loading branch information
Showing
3 changed files
with
24 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
fn main() { | ||
let abs: i32 = 3i32.checked_abs(); | ||
//~^ ERROR mismatched types | ||
} |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/issue-117669.rs:2:20 | ||
| | ||
LL | let abs: i32 = 3i32.checked_abs(); | ||
| --- ^^^^^^^^^^^^^^^^^^ expected `i32`, found `Option<i32>` | ||
| | | ||
| expected due to this | ||
| | ||
= note: expected type `i32` | ||
found enum `Option<i32>` | ||
help: consider using `Option::expect` to unwrap the `Option<i32>` value, panicking if the value is an `Option::None` | ||
| | ||
LL | let abs: i32 = 3i32.checked_abs().expect("REASON"); | ||
| +++++++++++++++++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |