forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#66391 - estebank:if-else-async-ice, r=Centril
Do not ICE in `if` without `else` in `async fn` Fix rust-lang#66387.
- Loading branch information
Showing
3 changed files
with
34 additions
and
2 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,10 @@ | ||
// edition:2018 | ||
async fn f() -> i32 { | ||
if true { //~ ERROR if may be missing an else clause | ||
return 0; | ||
} | ||
// An `if` block without `else` causes the type table not to have a type for this expr. | ||
// Check that we do not unconditionally access the type table and we don't ICE. | ||
} | ||
|
||
fn main() {} |
16 changes: 16 additions & 0 deletions
16
src/test/ui/async-await/issue-66387-if-without-else.stderr
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,16 @@ | ||
error[E0317]: if may be missing an else clause | ||
--> $DIR/issue-66387-if-without-else.rs:3:5 | ||
| | ||
LL | / if true { | ||
LL | | return 0; | ||
LL | | } | ||
| |_____^ expected (), found i32 | ||
| | ||
= note: expected type `()` | ||
found type `i32` | ||
= note: `if` expressions without `else` evaluate to `()` | ||
= help: consider adding an `else` block that evaluates to the expected type | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0317`. |