Add diverging match guard test.
This commit is contained in:
parent
2dbbec34ab
commit
687659f33f
2 changed files with 12 additions and 2 deletions
|
@ -20,7 +20,7 @@ fn let_wild_gets_moved_expr() {
|
|||
fn match_moved_expr_to_wild() {
|
||||
let m = M;
|
||||
drop(m);
|
||||
match m { _ => { } } // #53114: should eventually be accepted too
|
||||
match m { _ => { } } // #53114: accepted too
|
||||
|
||||
let mm = (M, M); // variation on above with `_` in substructure
|
||||
match mm { (_x, _) => { } }
|
||||
|
@ -31,7 +31,7 @@ fn match_moved_expr_to_wild() {
|
|||
fn if_let_moved_expr_to_wild() {
|
||||
let m = M;
|
||||
drop(m);
|
||||
if let _ = m { } // #53114: should eventually be accepted too
|
||||
if let _ = m { } // #53114: accepted too
|
||||
|
||||
let mm = (M, M); // variation on above with `_` in substructure
|
||||
if let (_x, _) = mm { }
|
||||
|
|
10
tests/ui/uninhabited/diverging-guard.rs
Normal file
10
tests/ui/uninhabited/diverging-guard.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
// check-pass
|
||||
|
||||
enum Void {}
|
||||
|
||||
fn main() {
|
||||
let x: Void;
|
||||
match x {
|
||||
_ if { loop {} } => (),
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue