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