-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make "remove semicolon" suggestion work with
!
- Loading branch information
1 parent
6678f63
commit 6ccb844
Showing
4 changed files
with
43 additions
and
3 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,31 @@ | ||
//@ revisions: e2021 e2024 | ||
// | ||
//@[e2021] edition: 2021 | ||
//@[e2024] edition: 2024 | ||
//@[e2024] compile-flags: -Zunstable-options | ||
// | ||
//@[e2021] check-pass | ||
//@[e2024] check-fail | ||
// | ||
//@[e2024] run-rustfix | ||
#![crate_name = "diverging_block"] // or else rustfix dies because of dots in the crate name | ||
|
||
|
||
fn main() { | ||
// a diverging block, with no tail expression. | ||
// | ||
// edition <= 2021: the block has type `!`, which then can be coerced. | ||
// edition >= 2024: the block has type `()`, as with any block with no tail. | ||
let _: u32 = { //[e2024]~ error: mismatched types | ||
return | ||
}; | ||
} | ||
|
||
fn _f() { | ||
// Same as the above, but with an if | ||
if true { | ||
return | ||
} else { | ||
0_u32 //[e2024]~ error: `if` and `else` have incompatible types | ||
}; | ||
} |
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