forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#11787 - Jarcho:divergence_check, r=dswij
Fixes to `manual_let_else`'s divergence check A few changes to the divergence check in `manual_let_else` and moves it the implementation to `clippy_utils` since it's generally useful: * Handle internal `break` and `continue` expressions. e.g. The first loop is divergent, but the second is not. ```rust { loop { break 'outer; }; } { loop { break; }; } ``` * Match rust's definition of divergence which is defined via the type system. e.g. The following is not considered divergent by rustc as the inner block has a result type of `()`: ```rust { 'a: { panic!(); break 'a; }; } ``` * Handle when adding a single semicolon would make the expression divergent. e.g. The following would be a divergent if a semicolon were added after the `if` expression: ```rust { if panic!() { 0 } else { 1 } } ``` changelog: None
- Loading branch information
Showing
4 changed files
with
496 additions
and
151 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
Oops, something went wrong.