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