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