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#86382 - JohnTitor:try-desugar, r=estebank
Make diagnostics clearer for `?` operators Re-submission of rust-lang#75029, fixes rust-lang#71309 This also revives the `content` methods removed by rust-lang#83185. r? `@estebank`
- Loading branch information
Showing
6 changed files
with
53 additions
and
5 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
fn foo(x: Result<i32, ()>) -> Result<(), ()> { | ||
let y: u32 = x?; | ||
//~^ ERROR: `?` operator has incompatible types | ||
Ok(()) | ||
} | ||
|
||
fn main() {} |
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,15 @@ | ||
error[E0308]: `?` operator has incompatible types | ||
--> $DIR/issue-71309.rs:2:18 | ||
| | ||
LL | let y: u32 = x?; | ||
| ^^ expected `u32`, found `i32` | ||
| | ||
= note: `?` operator cannot convert from `i32` to `u32` | ||
help: you can convert an `i32` to a `u32` and panic if the converted value doesn't fit | ||
| | ||
LL | let y: u32 = x?.try_into().unwrap(); | ||
| ++++++++++++++++++++ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
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
3 changes: 2 additions & 1 deletion
3
src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr
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