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