2023-12-12 09:20:29 -06:00
|
|
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:8:5
|
2023-12-12 09:20:29 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: wrap the expression in parentheses
|
|
|
|
|
|
2024-05-12 14:49:49 -05:00
|
|
|
LL ~ let 0 = ({
|
2023-12-12 09:20:29 -06:00
|
|
|
LL | 1
|
|
|
|
LL ~ }) else {
|
|
|
|
|
|
|
|
|
|
|
|
|
error: `for...else` loops are not supported
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:17:7
|
2023-12-12 09:20:29 -06:00
|
|
|
|
|
|
|
|
LL | let foo = for i in 1..2 {
|
|
|
|
| --- `else` is attached to this loop
|
|
|
|
LL | break;
|
|
|
|
LL | } else {
|
|
|
|
| _______^
|
|
|
|
LL | |
|
|
|
|
LL | | return;
|
|
|
|
LL | | };
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
= note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run
|
|
|
|
|
|
|
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:28:5
|
2023-12-12 09:20:29 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: wrap the expression in parentheses
|
|
|
|
|
|
2024-05-12 14:49:49 -05:00
|
|
|
LL ~ let 0 = (if true {
|
|
|
|
LL | 1
|
|
|
|
LL | } else {
|
2023-12-12 09:20:29 -06:00
|
|
|
LL | 0
|
|
|
|
LL ~ }) else {
|
|
|
|
|
|
|
|
|
|
|
|
|
error: `loop...else` loops are not supported
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:37:7
|
2023-12-12 09:20:29 -06:00
|
|
|
|
|
|
|
|
LL | let foo = loop {
|
|
|
|
| ---- `else` is attached to this loop
|
|
|
|
LL | break;
|
|
|
|
LL | } else {
|
|
|
|
| _______^
|
|
|
|
LL | |
|
|
|
|
LL | | return;
|
|
|
|
LL | | };
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
= note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run
|
|
|
|
|
|
|
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:47:5
|
2023-12-12 09:20:29 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: wrap the expression in parentheses
|
|
|
|
|
|
2024-05-12 14:49:49 -05:00
|
|
|
LL ~ let 0 = (match true {
|
2023-12-12 09:20:29 -06:00
|
|
|
LL | true => 1,
|
|
|
|
LL | false => 0
|
|
|
|
LL ~ }) else {
|
|
|
|
|
|
|
|
|
|
|
|
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:60:5
|
2023-12-12 09:20:29 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: wrap the expression in parentheses
|
|
|
|
|
|
2024-05-12 14:49:49 -05:00
|
|
|
LL ~ let X { a: 0 } = (X {
|
2023-12-12 09:20:29 -06:00
|
|
|
LL | a: 1
|
|
|
|
LL ~ }) else {
|
|
|
|
|
|
|
|
|
|
|
|
|
error: `while...else` loops are not supported
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:69:7
|
2023-12-12 09:20:29 -06:00
|
|
|
|
|
|
|
|
LL | let foo = while false {
|
|
|
|
| ----- `else` is attached to this loop
|
|
|
|
LL | break;
|
|
|
|
LL | } else {
|
|
|
|
| _______^
|
|
|
|
LL | |
|
|
|
|
LL | | return;
|
|
|
|
LL | | };
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
= note: consider moving this `else` clause to a separate `if` statement and use a `bool` variable to control if it should run
|
|
|
|
|
|
|
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:78:5
|
2023-12-12 09:20:29 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: wrap the expression in parentheses
|
|
|
|
|
|
2024-05-12 14:49:49 -05:00
|
|
|
LL ~ let 0 = (const {
|
2023-12-12 09:20:29 -06:00
|
|
|
LL | 1
|
|
|
|
LL ~ }) else {
|
|
|
|
|
|
|
|
|
|
|
|
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:87:5
|
2023-12-12 09:20:29 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: wrap the expression in parentheses
|
|
|
|
|
|
2024-05-12 14:49:49 -05:00
|
|
|
LL ~ let 0 = &({
|
2023-12-12 09:20:29 -06:00
|
|
|
LL | 1
|
|
|
|
LL ~ }) else {
|
|
|
|
|
|
|
|
|
|
|
|
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:98:5
|
2023-12-12 09:20:29 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: wrap the expression in parentheses
|
|
|
|
|
|
|
|
|
LL ~ let foo = bar = ({
|
2024-02-01 16:45:00 -06:00
|
|
|
LL |
|
2023-12-12 09:20:29 -06:00
|
|
|
LL | 1
|
|
|
|
LL ~ }) else {
|
|
|
|
|
|
|
|
|
|
|
|
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:107:5
|
2023-12-12 09:20:29 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: wrap the expression in parentheses
|
|
|
|
|
|
2024-05-12 14:49:49 -05:00
|
|
|
LL ~ let 0 = 1 + ({
|
2023-12-12 09:20:29 -06:00
|
|
|
LL | 1
|
|
|
|
LL ~ }) else {
|
|
|
|
|
|
|
|
|
|
|
|
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:117:5
|
2023-12-12 09:20:29 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: wrap the expression in parentheses
|
|
|
|
|
|
2024-05-12 14:49:49 -05:00
|
|
|
LL ~ let RANGE = 1..({
|
2023-12-12 09:20:29 -06:00
|
|
|
LL | 1
|
|
|
|
LL ~ }) else {
|
|
|
|
|
|
|
|
|
|
|
|
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:126:5
|
2023-12-12 09:20:29 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: wrap the expression in parentheses
|
|
|
|
|
|
2024-05-12 14:49:49 -05:00
|
|
|
LL ~ let 0 = return ({
|
2023-12-12 09:20:29 -06:00
|
|
|
LL | ()
|
|
|
|
LL ~ }) else {
|
|
|
|
|
|
|
|
|
|
|
|
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:135:5
|
2023-12-12 09:20:29 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: wrap the expression in parentheses
|
|
|
|
|
|
2024-05-12 14:49:49 -05:00
|
|
|
LL ~ let 0 = -({
|
2023-12-12 09:20:29 -06:00
|
|
|
LL | 1
|
|
|
|
LL ~ }) else {
|
|
|
|
|
|
|
|
|
|
|
|
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:144:5
|
2023-12-12 09:20:29 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: wrap the expression in parentheses
|
|
|
|
|
|
2024-05-12 14:49:49 -05:00
|
|
|
LL ~ let 0 = do yeet ({
|
2023-12-12 09:20:29 -06:00
|
|
|
LL | ()
|
|
|
|
LL ~ }) else {
|
|
|
|
|
|
|
|
|
|
|
|
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:163:5
|
2023-12-12 09:20:29 -06:00
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: wrap the expression in parentheses
|
|
|
|
|
|
|
|
|
LL ~ let foo = |x: i32| ({
|
2024-02-01 16:45:00 -06:00
|
|
|
LL |
|
2023-12-12 09:20:29 -06:00
|
|
|
LL | x
|
|
|
|
LL ~ }) else {
|
|
|
|
|
|
|
|
|
|
2023-12-17 20:11:55 -06:00
|
|
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:173:31
|
2023-12-17 20:11:55 -06:00
|
|
|
|
|
|
|
|
LL | let bad = format_args! {""} else { return; };
|
|
|
|
| ^
|
|
|
|
|
|
2023-12-17 21:01:05 -06:00
|
|
|
help: use parentheses instead of braces for this macro
|
2023-12-17 20:11:55 -06:00
|
|
|
|
|
2023-12-17 21:01:05 -06:00
|
|
|
LL | let bad = format_args! ("") else { return; };
|
|
|
|
| ~ ~
|
2023-12-17 20:11:55 -06:00
|
|
|
|
2024-05-12 14:28:10 -05:00
|
|
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
|
|
|
|
--> $DIR/bad-let-else-statement.rs:207:5
|
|
|
|
|
|
|
|
|
LL | } else {
|
|
|
|
| ^
|
|
|
|
|
|
|
|
|
help: use parentheses instead of braces for this macro
|
|
|
|
|
|
|
|
|
LL ~ let foo = &std::ptr::null as &'static dyn std::ops::Fn() -> *const primitive! (
|
|
|
|
LL |
|
|
|
|
LL | 8
|
|
|
|
LL ~ ) else {
|
|
|
|
|
|
|
|
|
|
2023-12-17 20:11:55 -06:00
|
|
|
error: right curly brace `}` before `else` in a `let...else` statement not allowed
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:190:25
|
2023-12-17 20:11:55 -06:00
|
|
|
|
|
2024-05-12 14:49:49 -05:00
|
|
|
LL | let 0 = a! {} else { return; };
|
2023-12-17 20:11:55 -06:00
|
|
|
| ^
|
|
|
|
...
|
2024-05-12 14:49:49 -05:00
|
|
|
LL | b!(2);
|
|
|
|
| ----- in this macro invocation
|
2023-12-17 20:11:55 -06:00
|
|
|
|
|
|
|
|
= note: this error originates in the macro `b` (in Nightly builds, run with -Z macro-backtrace for more info)
|
2023-12-17 21:01:05 -06:00
|
|
|
help: use parentheses instead of braces for this macro
|
2023-12-17 20:11:55 -06:00
|
|
|
|
|
2024-05-12 14:49:49 -05:00
|
|
|
LL | let 0 = a! () else { return; };
|
2023-12-17 21:01:05 -06:00
|
|
|
| ~~
|
2023-12-17 20:11:55 -06:00
|
|
|
|
2024-02-01 16:45:00 -06:00
|
|
|
warning: irrefutable `let...else` pattern
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:95:5
|
2024-02-01 16:45:00 -06:00
|
|
|
|
|
|
|
|
LL | / let foo = bar = {
|
|
|
|
LL | |
|
|
|
|
LL | | 1
|
|
|
|
LL | | } else {
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
= note: this pattern will always match, so the `else` clause is useless
|
|
|
|
= help: consider removing the `else` clause
|
2024-05-12 14:49:49 -05:00
|
|
|
= note: `#[warn(irrefutable_let_patterns)]` on by default
|
2024-02-01 16:45:00 -06:00
|
|
|
|
|
|
|
warning: irrefutable `let...else` pattern
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:160:5
|
2024-02-01 16:45:00 -06:00
|
|
|
|
|
|
|
|
LL | / let foo = |x: i32| {
|
|
|
|
LL | |
|
|
|
|
LL | | x
|
|
|
|
LL | | } else {
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
= note: this pattern will always match, so the `else` clause is useless
|
|
|
|
= help: consider removing the `else` clause
|
|
|
|
|
|
|
|
warning: irrefutable `let...else` pattern
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:170:5
|
2024-02-01 16:45:00 -06:00
|
|
|
|
|
|
|
|
LL | let ok = format_args!("") else { return; };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: this pattern will always match, so the `else` clause is useless
|
|
|
|
= help: consider removing the `else` clause
|
|
|
|
|
|
|
|
warning: irrefutable `let...else` pattern
|
2024-05-12 14:49:49 -05:00
|
|
|
--> $DIR/bad-let-else-statement.rs:173:5
|
2024-02-01 16:45:00 -06:00
|
|
|
|
|
|
|
|
LL | let bad = format_args! {""} else { return; };
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: this pattern will always match, so the `else` clause is useless
|
|
|
|
= help: consider removing the `else` clause
|
|
|
|
|
2024-05-12 15:02:54 -05:00
|
|
|
warning: irrefutable `let...else` pattern
|
|
|
|
--> $DIR/bad-let-else-statement.rs:204:5
|
|
|
|
|
|
|
|
|
LL | / let foo = &std::ptr::null as &'static dyn std::ops::Fn() -> *const primitive! {
|
|
|
|
LL | |
|
|
|
|
LL | | 8
|
|
|
|
LL | | } else {
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
= note: this pattern will always match, so the `else` clause is useless
|
|
|
|
= help: consider removing the `else` clause
|
|
|
|
|
2024-02-15 13:54:37 -06:00
|
|
|
error: aborting due to 19 previous errors; 5 warnings emitted
|
2023-12-12 09:20:29 -06:00
|
|
|
|