]> git.proxmox.com Git - rustc.git/blame - src/test/ui/closures/2229_closure_analysis/run_pass/by_value.rs
New upstream version 1.55.0+dfsg1
[rustc.git] / src / test / ui / closures / 2229_closure_analysis / run_pass / by_value.rs
CommitLineData
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)]
8struct SomeLargeType;
9struct MuchLargerType([SomeLargeType; 32]);
10
11fn 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
24fn main() {
25 big_box();
26}