Skip to content

Commit a625b77

Browse files
committed
Add a test for deref projections in new pattern capture behavior
1 parent 0bc7f13 commit a625b77

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Newly accepted examples as a result of the changes introduced in #138961.
2+
//
3+
//@ edition:2024
4+
//@ check-pass
5+
#![allow(unused_assignments)]
6+
7+
fn f() {
8+
let mut x: &mut [u8] = &mut [1, 2, 3];
9+
let c = || {
10+
match x {
11+
[] => (),
12+
_ => (),
13+
}
14+
};
15+
x = &mut [];
16+
c();
17+
}
18+
19+
fn g() {
20+
let mut x: &mut bool = &mut false;
21+
let mut t = true;
22+
let c = || {
23+
match x {
24+
true => (),
25+
false => (),
26+
}
27+
};
28+
x = &mut t;
29+
c();
30+
}
31+
32+
fn main() {
33+
f();
34+
g();
35+
}

0 commit comments

Comments
 (0)