Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
200 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
warning: unreachable block in `if` expression | ||
--> $DIR/if-ret.rs:4:24 | ||
| | ||
LL | fn foo() { if (return) { } } | ||
| ^^^ | ||
| | ||
= note: #[warn(unreachable_code)] on by default | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
fn main() { | ||
if let Some(b) = None { | ||
//~^ NOTE if let` arms have incompatible types | ||
//~^ NOTE if and else have incompatible types | ||
() | ||
//~^ NOTE expected because of this | ||
} else { | ||
1 | ||
}; | ||
//~^^ ERROR: `if let` arms have incompatible types | ||
//~^^ ERROR: if and else have incompatible types | ||
//~| NOTE expected (), found integer | ||
//~| NOTE expected type `()` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
error: unreachable statement | ||
--> $DIR/expr_if.rs:27:5 | ||
error: unreachable block in `if` expression | ||
--> $DIR/expr_if.rs:7:17 | ||
| | ||
LL | println!("But I am."); | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | if {return} { | ||
| _________________^ | ||
LL | | println!("Hello, world!"); | ||
LL | | } | ||
| |_____^ | ||
| | ||
note: lint level defined here | ||
--> $DIR/expr_if.rs:4:9 | ||
| | ||
LL | #![deny(unreachable_code)] | ||
| ^^^^^^^^^^^^^^^^ | ||
|
||
error: unreachable statement | ||
--> $DIR/expr_if.rs:27:5 | ||
| | ||
LL | println!("But I am."); | ||
| ^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) | ||
|
||
error: aborting due to previous error | ||
error: aborting due to 2 previous errors | ||
|