fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
4.9 KiB141 linesraw
1error: a `&&` expression cannot be directly assigned in `let...else`
2  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:9:19
3   |
4LL |     let Some(n) = opt && n == 1 else {
5   |                   ^^^^^^^^^^^^^
6   |
7help: wrap the expression in parentheses
8   |
9LL |     let Some(n) = (opt && n == 1) else {
10   |                   +             +
11
12error: expected expression, found `let` statement
13  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:26
14   |
15LL |     let Some(n) = opt && let another = n else {
16   |                          ^^^
17   |
18   = note: only supported directly in conditions of `if` and `while` expressions
19
20error: a `&&` expression cannot be directly assigned in `let...else`
21  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:19
22   |
23LL |     let Some(n) = opt && let another = n else {
24   |                   ^^^^^^^^^^^^^^^^^^^^^^
25   |
26help: wrap the expression in parentheses
27   |
28LL |     let Some(n) = (opt && let another = n) else {
29   |                   +                      +
30
31error: this `if` expression is missing a block after the condition
32  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:23:5
33   |
34LL |     if let Some(n) = opt else {
35   |     ^^
36   |
37help: add a block here
38  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:23:25
39   |
40LL |     if let Some(n) = opt else {
41   |                         ^
42help: remove the `if` if you meant to write a `let...else` statement
43   |
44LL -     if let Some(n) = opt else {
45LL +     let Some(n) = opt else {
46   |
47
48error: this `if` expression is missing a block after the condition
49  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:27:5
50   |
51LL |     if let Some(n) = opt && n == 1 else {
52   |     ^^
53   |
54help: add a block here
55  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:27:35
56   |
57LL |     if let Some(n) = opt && n == 1 else {
58   |                                   ^
59
60error: this `if` expression is missing a block after the condition
61  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:31:5
62   |
63LL |     if let Some(n) = opt && let another = n else {
64   |     ^^
65   |
66help: add a block here
67  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:31:44
68   |
69LL |     if let Some(n) = opt && let another = n else {
70   |                                            ^
71
72error: expected `{`, found keyword `else`
73  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:37:33
74   |
75LL |         while let Some(n) = opt else {
76   |         ----- ----------------- ^^^^ expected `{`
77   |         |     |
78   |         |     this `while` condition successfully parsed
79   |         while parsing the body of this `while` expression
80
81error: expected `{`, found keyword `else`
82  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:43:43
83   |
84LL |         while let Some(n) = opt && n == 1 else {
85   |         ----- --------------------------- ^^^^ expected `{`
86   |         |     |
87   |         |     this `while` condition successfully parsed
88   |         while parsing the body of this `while` expression
89
90error: expected `{`, found keyword `else`
91  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:49:52
92   |
93LL |         while let Some(n) = opt && let another = n else {
94   |         ----- ------------------------------------ ^^^^ expected `{`
95   |         |     |
96   |         |     this `while` condition successfully parsed
97   |         while parsing the body of this `while` expression
98
99error[E0308]: mismatched types
100  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:9:19
101   |
102LL |     let Some(n) = opt && n == 1 else {
103   |                   ^^^ expected `bool`, found `Option<i32>`
104   |
105   = note: expected type `bool`
106              found enum `Option<i32>`
107
108error[E0308]: mismatched types
109  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:9:9
110   |
111LL |     let Some(n) = opt && n == 1 else {
112   |         ^^^^^^^   ------------- this expression has type `bool`
113   |         |
114   |         expected `bool`, found `Option<_>`
115   |
116   = note: expected type `bool`
117              found enum `Option<_>`
118
119error[E0308]: mismatched types
120  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:19
121   |
122LL |     let Some(n) = opt && let another = n else {
123   |                   ^^^ expected `bool`, found `Option<i32>`
124   |
125   = note: expected type `bool`
126              found enum `Option<i32>`
127
128error[E0308]: mismatched types
129  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:9
130   |
131LL |     let Some(n) = opt && let another = n else {
132   |         ^^^^^^^   ---------------------- this expression has type `bool`
133   |         |
134   |         expected `bool`, found `Option<_>`
135   |
136   = note: expected type `bool`
137              found enum `Option<_>`
138
139error: aborting due to 13 previous errors
140
141For more information about this error, try `rustc --explain E0308`.