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 20
20
any( from_method="from_error" , from_method="from_ok" ) ,
21
21
from_desugaring="?" ) ,
22
22
message="the `?` operator can only be used in a \
23
- function that returns `Result` \
23
+ function that returns `Result` or `Option` \
24
24
(or another type that implements `{Try}`)",
25
25
label="cannot use the `?` operator in a function that returns `{Self}`" ) ,
26
26
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
6
6
|
7
7
= note: required by `std::convert::From::from`
8
8
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`)
10
10
--> $DIR/try-on-option.rs:23:5
11
11
|
12
12
LL | 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`)
2
2
--> $DIR/try-operator-on-main.rs:19:5
3
3
|
4
4
LL | std::fs::File::open("foo")?; //~ ERROR the `?` operator can only
You can’t perform that action at this time.
0 commit comments