forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
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#114403 - bvanjoi:fix-114392, r=estebank
fix the span in the suggestion of remove question mark Fixes rust-lang#114392 Use a more precise span.
- Loading branch information
Showing
3 changed files
with
32 additions
and
1 deletion.
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,9 @@ | ||
// https://github.com/rust-lang/rust/issues/114392 | ||
|
||
fn foo() -> Option<()> { | ||
let x = Some(()); | ||
(x?) | ||
//~^ ERROR `?` operator has incompatible types | ||
} | ||
|
||
fn main() {} |
22 changes: 22 additions & 0 deletions
22
tests/ui/suggestions/remove-question-symbol-with-paren.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
error[E0308]: `?` operator has incompatible types | ||
--> $DIR/remove-question-symbol-with-paren.rs:5:6 | ||
| | ||
LL | (x?) | ||
| ^^ expected `Option<()>`, found `()` | ||
| | ||
= note: `?` operator cannot convert from `()` to `Option<()>` | ||
= note: expected enum `Option<()>` | ||
found unit type `()` | ||
help: try removing this `?` | ||
| | ||
LL - (x?) | ||
LL + (x) | ||
| | ||
help: try wrapping the expression in `Some` | ||
| | ||
LL | (Some(x?)) | ||
| +++++ + | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |