Rollup merge of #49446 - frewsxcv:frewsxcv-mention-optiono, r=GuillaumeGomez
Explicitly mention `Option` in `?` error message. Save users the time/effort of having to lookup what types implement the `Try` trait.
This commit is contained in:
commit
d06abdbfd8
3 changed files with 3 additions and 3 deletions
|
|
@ -6,7 +6,7 @@ LL | x?; //~ the trait bound
|
|||
|
|
||||
= note: required by `std::convert::From::from`
|
||||
|
||||
error[E0277]: the `?` operator can only be used in a function that returns `Result` (or another type that implements `std::ops::Try`)
|
||||
error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`)
|
||||
--> $DIR/try-on-option.rs:23:5
|
||||
|
|
||||
LL | x?; //~ the `?` operator
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0277]: the `?` operator can only be used in a function that returns `Result` (or another type that implements `std::ops::Try`)
|
||||
error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`)
|
||||
--> $DIR/try-operator-on-main.rs:19:5
|
||||
|
|
||||
LL | std::fs::File::open("foo")?; //~ ERROR the `?` operator can only
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue