File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -8,20 +8,34 @@ fn all_patterns_are_tested() {
88 // Even though `x` is never actually moved out of, we don't want borrowck results to be based on
99 // whether MIR lowering reveals which patterns are unreachable.
1010 let x = String :: new ( ) ;
11- let _ = match true {
11+ match true {
1212 _ => { } ,
1313 _ => drop ( x) ,
14- } ;
14+ }
1515 // Borrowck must not know the second arm is never run.
1616 drop ( x) ; //~ ERROR use of moved value
1717
18+ let x = String :: new ( ) ;
19+ if let _ = true {
20+ } else {
21+ drop ( x)
22+ }
23+ // Borrowck must not know the else branch is never run.
24+ drop ( x) ; //~ ERROR use of moved value
25+
1826 let x = ( String :: new ( ) , String :: new ( ) ) ;
1927 match x {
2028 ( y, _) | ( _, y) => ( ) ,
2129 }
2230 & x. 0 ; //~ ERROR borrow of moved value
2331 // Borrowck must not know the second pattern never matches.
2432 & x. 1 ; //~ ERROR borrow of moved value
33+
34+ let x = ( String :: new ( ) , String :: new ( ) ) ;
35+ let ( y, _) | ( _, y) = x;
36+ & x. 0 ; //~ ERROR borrow of moved value
37+ // Borrowck must not know the second pattern never matches.
38+ & x. 1 ; //~ ERROR borrow of moved value
2539}
2640
2741#[ rustfmt:: skip]
You can’t perform that action at this time.
0 commit comments