11error: Rust has no ternary operator
2- --> $DIR/ternary_operator.rs:2 :19
2+ --> $DIR/ternary_operator.rs:5 :19
33 |
44LL | let x = 5 > 2 ? true : false;
55 | ^^^^^^^^^^^^^^^
66 |
77 = help: use an `if-else` expression instead
88
99error: Rust has no ternary operator
10- --> $DIR/ternary_operator.rs:12 :19
10+ --> $DIR/ternary_operator.rs:21 :19
1111 |
1212LL | let x = 5 > 2 ? { true } : { false };
1313 | ^^^^^^^^^^^^^^^^^^^^^^^
1414 |
1515 = help: use an `if-else` expression instead
1616
1717error: Rust has no ternary operator
18- --> $DIR/ternary_operator.rs:22 :19
18+ --> $DIR/ternary_operator.rs:37 :19
1919 |
2020LL | let x = 5 > 2 ? f32::MAX : f32::MIN;
2121 | ^^^^^^^^^^^^^^^^^^^^^^
2222 |
2323 = help: use an `if-else` expression instead
2424
2525error: expected one of `.`, `;`, `?`, `else`, or an operator, found `:`
26- --> $DIR/ternary_operator.rs:32 :37
26+ --> $DIR/ternary_operator.rs:53 :37
2727 |
2828LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
2929 | ^ 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>
3032
3133error: Rust has no ternary operator
32- --> $DIR/ternary_operator.rs:32 :19
34+ --> $DIR/ternary_operator.rs:53 :19
3335 |
3436LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
3537 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
3638 |
3739 = help: use an `if-else` expression instead
3840
3941error[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
4143 |
4244LL | let x = 5 > 2 ? true : false;
4345 | ^^^ the `?` operator cannot be applied to type `{integer}`
4446 |
4547 = help: the trait `Try` is not implemented for `{integer}`
4648
4749error[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
4951 |
5052LL | fn a() {
5153 | ------ this function should return `Result` or `Option` to accept `?`
@@ -55,15 +57,15 @@ LL | let x = 5 > 2 ? true : false;
5557 = help: the trait `FromResidual<_>` is not implemented for `()`
5658
5759error[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
5961 |
6062LL | let x = 5 > 2 ? { true } : { false };
6163 | ^^^ the `?` operator cannot be applied to type `{integer}`
6264 |
6365 = help: the trait `Try` is not implemented for `{integer}`
6466
6567error[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
6769 |
6870LL | fn b() {
6971 | ------ this function should return `Result` or `Option` to accept `?`
@@ -73,15 +75,15 @@ LL | let x = 5 > 2 ? { true } : { false };
7375 = help: the trait `FromResidual<_>` is not implemented for `()`
7476
7577error[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
7779 |
7880LL | let x = 5 > 2 ? f32::MAX : f32::MIN;
7981 | ^^^ the `?` operator cannot be applied to type `{integer}`
8082 |
8183 = help: the trait `Try` is not implemented for `{integer}`
8284
8385error[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
8587 |
8688LL | fn c() {
8789 | ------ this function should return `Result` or `Option` to accept `?`
@@ -91,15 +93,15 @@ LL | let x = 5 > 2 ? f32::MAX : f32::MIN;
9193 = help: the trait `FromResidual<_>` is not implemented for `()`
9294
9395error[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
9597 |
9698LL | let x = 5 > 2 ? { let x = vec![]: Vec<u16>; x } : { false };
9799 | ^^^ the `?` operator cannot be applied to type `{integer}`
98100 |
99101 = help: the trait `Try` is not implemented for `{integer}`
100102
101103error[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
103105 |
104106LL | fn main() {
105107 | --------- this function should return `Result` or `Option` to accept `?`
0 commit comments