File tree Expand file tree Collapse file tree 3 files changed +3
-3
lines changed Expand file tree Collapse file tree 3 files changed +3
-3
lines changed Original file line number Diff line number Diff line change 2020 any( from_method="from_error" , from_method="from_ok" ) ,
2121 from_desugaring="?" ) ,
2222 message="the `?` operator can only be used in a \
23- function that returns `Result` \
23+ function that returns `Result` or `Option` \
2424 (or another type that implements `{Try}`)",
2525 label="cannot use the `?` operator in a function that returns `{Self}`" ) ,
2626 on( all( from_method="into_result" , from_desugaring="?" ) ,
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ LL | x?; //~ the trait bound
66 |
77 = note: required by `std::convert::From::from`
88
9- error[E0277]: the `?` operator can only be used in a function that returns `Result` (or another type that implements `std::ops::Try`)
9+ error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`)
1010 --> $DIR/try-on-option.rs:23:5
1111 |
1212LL | x?; //~ the `?` operator
Original file line number Diff line number Diff line change 1- error[E0277]: the `?` operator can only be used in a function that returns `Result` (or another type that implements `std::ops::Try`)
1+ error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `std::ops::Try`)
22 --> $DIR/try-operator-on-main.rs:19:5
33 |
44LL | std::fs::File::open("foo")?; //~ ERROR the `?` operator can only
You can’t perform that action at this time.
0 commit comments