summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfc-2497-if-let-chains/ensure-that-let-else-does-not-interact-with-let-chains.stderr
blob: 498a112fa9bb3f7434e6031827821cf9ba38bb69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
error: a `&&` expression cannot be directly assigned in `let...else`
  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:9:19
   |
LL |     let Some(n) = opt && n == 1 else {
   |                   ^^^^^^^^^^^^^
   |
help: wrap the expression in parentheses
   |
LL |     let Some(n) = (opt && n == 1) else {
   |                   +             +

error: expected expression, found `let` statement
  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:26
   |
LL |     let Some(n) = opt && let another = n else {
   |                          ^^^

error: a `&&` expression cannot be directly assigned in `let...else`
  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:19
   |
LL |     let Some(n) = opt && let another = n else {
   |                   ^^^^^^^^^^^^^^^^^^^^^^
   |
help: wrap the expression in parentheses
   |
LL |     let Some(n) = (opt && let another = n) else {
   |                   +                      +

error: this `if` expression is missing a block after the condition
  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:24:5
   |
LL |     if let Some(n) = opt else {
   |     ^^
   |
help: add a block here
  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:24:25
   |
LL |     if let Some(n) = opt else {
   |                         ^

error: this `if` expression is missing a block after the condition
  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:28:5
   |
LL |     if let Some(n) = opt && n == 1 else {
   |     ^^
   |
help: add a block here
  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:28:35
   |
LL |     if let Some(n) = opt && n == 1 else {
   |                                   ^

error: this `if` expression is missing a block after the condition
  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:32:5
   |
LL |     if let Some(n) = opt && let another = n else {
   |     ^^
   |
help: add a block here
  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:32:44
   |
LL |     if let Some(n) = opt && let another = n else {
   |                                            ^

error: expected `{`, found keyword `else`
  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:38:33
   |
LL |         while let Some(n) = opt else {
   |         ----- ----------------- ^^^^ expected `{`
   |         |     |
   |         |     this `while` condition successfully parsed
   |         while parsing the body of this `while` expression

error: expected `{`, found keyword `else`
  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:44:43
   |
LL |         while let Some(n) = opt && n == 1 else {
   |         ----- --------------------------- ^^^^ expected `{`
   |         |     |
   |         |     this `while` condition successfully parsed
   |         while parsing the body of this `while` expression

error: expected `{`, found keyword `else`
  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:50:52
   |
LL |         while let Some(n) = opt && let another = n else {
   |         ----- ------------------------------------ ^^^^ expected `{`
   |         |     |
   |         |     this `while` condition successfully parsed
   |         while parsing the body of this `while` expression

error: `let` expressions are not supported here
  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:26
   |
LL |     let Some(n) = opt && let another = n else {
   |                          ^^^^^^^^^^^^^^^
   |
   = note: only supported directly in conditions of `if` and `while` expressions

error[E0308]: mismatched types
  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:9:19
   |
LL |     let Some(n) = opt && n == 1 else {
   |                   ^^^ expected `bool`, found enum `Option`
   |
   = note: expected type `bool`
              found enum `Option<i32>`

error[E0308]: mismatched types
  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:9:9
   |
LL |     let Some(n) = opt && n == 1 else {
   |         ^^^^^^^   ------------- this expression has type `bool`
   |         |
   |         expected `bool`, found enum `Option`
   |
   = note: expected type `bool`
              found enum `Option<_>`

error[E0308]: mismatched types
  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:19
   |
LL |     let Some(n) = opt && let another = n else {
   |                   ^^^ expected `bool`, found enum `Option`
   |
   = note: expected type `bool`
              found enum `Option<i32>`

error[E0308]: mismatched types
  --> $DIR/ensure-that-let-else-does-not-interact-with-let-chains.rs:15:9
   |
LL |     let Some(n) = opt && let another = n else {
   |         ^^^^^^^   ---------------------- this expression has type `bool`
   |         |
   |         expected `bool`, found enum `Option`
   |
   = note: expected type `bool`
              found enum `Option<_>`

error: aborting due to 14 previous errors

For more information about this error, try `rustc --explain E0308`.