1
1
error: Rust has no ternary operator
2
- --> $DIR/ternary_operator.rs:2 :19
2
+ --> $DIR/ternary_operator.rs:5 :19
3
3
|
4
4
LL | let x = 5 > 2 ? true : false;
5
5
| ^^^^^^^^^^^^^^^
6
6
|
7
7
= help: use an `if-else` expression instead
8
8
9
9
error: Rust has no ternary operator
10
- --> $DIR/ternary_operator.rs:12 :19
10
+ --> $DIR/ternary_operator.rs:21 :19
11
11
|
12
12
LL | let x = 5 > 2 ? { true } : { false };
13
13
| ^^^^^^^^^^^^^^^^^^^^^^^
14
14
|
15
15
= help: use an `if-else` expression instead
16
16
17
17
error: Rust has no ternary operator
18
- --> $DIR/ternary_operator.rs:22 :19
18
+ --> $DIR/ternary_operator.rs:37 :19
19
19
|
20
20
LL | let x = 5 > 2 ? f32::MAX : f32::MIN;
21
21
| ^^^^^^^^^^^^^^^^^^^^^^
22
22
|
23
23
= help: use an `if-else` expression instead
24
24
25
25
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
26
- --> $DIR/ternary_operator.rs:32 :37
26
+ --> $DIR/ternary_operator.rs:53 :37
27
27
|
28
28
LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
29
29
| ^ expected one of `.`, `;`, `?`, `else`, or an operator
30
+ |
31
+ = note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
30
32
31
33
error: Rust has no ternary operator
32
- --> $DIR/ternary_operator.rs:32 :19
34
+ --> $DIR/ternary_operator.rs:53 :19
33
35
|
34
36
LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
35
37
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
36
38
|
37
39
= help: use an `if-else` expression instead
38
40
39
41
error[E0277]: the `?` operator can only be applied to values that implement `Try`
40
- --> $DIR/ternary_operator.rs:2 :17
42
+ --> $DIR/ternary_operator.rs:5 :17
41
43
|
42
44
LL | let x = 5 > 2 ? true : false;
43
45
| ^^^ the `?` operator cannot be applied to type `{integer}`
44
46
|
45
47
= help: the trait `Try` is not implemented for `{integer}`
46
48
47
49
error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
48
- --> $DIR/ternary_operator.rs:2 :19
50
+ --> $DIR/ternary_operator.rs:5 :19
49
51
|
50
52
LL | fn a() {
51
53
| ------ this function should return `Result` or `Option` to accept `?`
@@ -55,15 +57,15 @@ LL | let x = 5 > 2 ? true : false;
55
57
= help: the trait `FromResidual<_>` is not implemented for `()`
56
58
57
59
error[E0277]: the `?` operator can only be applied to values that implement `Try`
58
- --> $DIR/ternary_operator.rs:12 :17
60
+ --> $DIR/ternary_operator.rs:21 :17
59
61
|
60
62
LL | let x = 5 > 2 ? { true } : { false };
61
63
| ^^^ the `?` operator cannot be applied to type `{integer}`
62
64
|
63
65
= help: the trait `Try` is not implemented for `{integer}`
64
66
65
67
error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
66
- --> $DIR/ternary_operator.rs:12 :19
68
+ --> $DIR/ternary_operator.rs:21 :19
67
69
|
68
70
LL | fn b() {
69
71
| ------ this function should return `Result` or `Option` to accept `?`
@@ -73,15 +75,15 @@ LL | let x = 5 > 2 ? { true } : { false };
73
75
= help: the trait `FromResidual<_>` is not implemented for `()`
74
76
75
77
error[E0277]: the `?` operator can only be applied to values that implement `Try`
76
- --> $DIR/ternary_operator.rs:22 :17
78
+ --> $DIR/ternary_operator.rs:37 :17
77
79
|
78
80
LL | let x = 5 > 2 ? f32::MAX : f32::MIN;
79
81
| ^^^ the `?` operator cannot be applied to type `{integer}`
80
82
|
81
83
= help: the trait `Try` is not implemented for `{integer}`
82
84
83
85
error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
84
- --> $DIR/ternary_operator.rs:22 :19
86
+ --> $DIR/ternary_operator.rs:37 :19
85
87
|
86
88
LL | fn c() {
87
89
| ------ this function should return `Result` or `Option` to accept `?`
@@ -91,15 +93,15 @@ LL | let x = 5 > 2 ? f32::MAX : f32::MIN;
91
93
= help: the trait `FromResidual<_>` is not implemented for `()`
92
94
93
95
error[E0277]: the `?` operator can only be applied to values that implement `Try`
94
- --> $DIR/ternary_operator.rs:32 :17
96
+ --> $DIR/ternary_operator.rs:53 :17
95
97
|
96
98
LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
97
99
| ^^^ the `?` operator cannot be applied to type `{integer}`
98
100
|
99
101
= help: the trait `Try` is not implemented for `{integer}`
100
102
101
103
error[E0277]: the `?` operator can only be used in a function that returns `Result` or `Option` (or another type that implements `FromResidual`)
102
- --> $DIR/ternary_operator.rs:32 :19
104
+ --> $DIR/ternary_operator.rs:53 :19
103
105
|
104
106
LL | fn main() {
105
107
| --------- this function should return `Result` or `Option` to accept `?`
0 commit comments