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() {
8
8
// Even though `x` is never actually moved out of, we don't want borrowck results to be based on
9
9
// whether MIR lowering reveals which patterns are unreachable.
10
10
let x = String :: new ( ) ;
11
- let _ = match true {
11
+ match true {
12
12
_ => { } ,
13
13
_ => drop ( x) ,
14
- } ;
14
+ }
15
15
// Borrowck must not know the second arm is never run.
16
16
drop ( x) ; //~ ERROR use of moved value
17
17
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
+
18
26
let x = ( String :: new ( ) , String :: new ( ) ) ;
19
27
match x {
20
28
( y, _) | ( _, y) => ( ) ,
21
29
}
22
30
& x. 0 ; //~ ERROR borrow of moved value
23
31
// Borrowck must not know the second pattern never matches.
24
32
& 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
25
39
}
26
40
27
41
#[ rustfmt:: skip]
You can’t perform that action at this time.
0 commit comments