]>
Commit | Line | Data |
---|---|---|
136023e0 | 1 | // edition:2021 |
5869c6ff XL |
2 | // run-pass |
3 | ||
4 | // Test that ByValue captures compile sucessefully especially when the captures are | |
5 | // derefenced within the closure. | |
6 | ||
5869c6ff XL |
7 | #[derive(Debug, Default)] |
8 | struct SomeLargeType; | |
9 | struct MuchLargerType([SomeLargeType; 32]); | |
10 | ||
11 | fn big_box() { | |
12 | let s = MuchLargerType(Default::default()); | |
13 | let b = Box::new(s); | |
14 | let t = (b, 10); | |
15 | ||
16 | let c = || { | |
17 | let p = t.0.0; | |
18 | println!("{} {:?}", t.1, p); | |
19 | }; | |
20 | ||
21 | c(); | |
22 | } | |
23 | ||
24 | fn main() { | |
25 | big_box(); | |
26 | } |