@@ -22,16 +22,22 @@ LL | let x = 5 > 2 ? f32::MAX : f32::MIN;
22
22
|
23
23
= help: use an `if-else` expression instead
24
24
25
+ error: expected one of `.`, `;`, `?`, `}`, or an operator, found keyword `return`
26
+ --> $DIR/ternary_operator.rs:54:9
27
+ |
28
+ LL | v ? return;
29
+ | ^^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator
30
+
25
31
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
26
- --> $DIR/ternary_operator.rs:53 :37
32
+ --> $DIR/ternary_operator.rs:60 :37
27
33
|
28
34
LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
29
35
| ^ expected one of `.`, `;`, `?`, `else`, or an operator
30
36
|
31
37
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
32
38
33
39
error: Rust has no ternary operator
34
- --> $DIR/ternary_operator.rs:53 :19
40
+ --> $DIR/ternary_operator.rs:60 :19
35
41
|
36
42
LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
37
43
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -93,15 +99,15 @@ LL | let x = 5 > 2 ? f32::MAX : f32::MIN;
93
99
= help: the trait `FromResidual<_>` is not implemented for `()`
94
100
95
101
error[E0277]: the `?` operator can only be applied to values that implement `Try`
96
- --> $DIR/ternary_operator.rs:53 :17
102
+ --> $DIR/ternary_operator.rs:60 :17
97
103
|
98
104
LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
99
105
| ^^^ the `?` operator cannot be applied to type `{integer}`
100
106
|
101
107
= help: the trait `Try` is not implemented for `{integer}`
102
108
103
109
error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
104
- --> $DIR/ternary_operator.rs:53 :19
110
+ --> $DIR/ternary_operator.rs:60 :19
105
111
|
106
112
LL | fn main() {
107
113
| --------- this function should return `Result` or `Option` to accept `?`
@@ -110,6 +116,6 @@ LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
110
116
|
111
117
= help: the trait `FromResidual<_>` is not implemented for `()`
112
118
113
- error: aborting due to 13 previous errors
119
+ error: aborting due to 14 previous errors
114
120
115
121
For more information about this error, try `rustc --explain E0277`.
0 commit comments