]> git.lizzy.rs Git - rust.git/blob - tests/ui/closures/2229_closure_analysis/optimization/edge_case_run_pass.rs
Rollup merge of #106701 - ibraheemdev:sync-sender-spin, r=Amanieu
[rust.git] / tests / ui / closures / 2229_closure_analysis / optimization / edge_case_run_pass.rs
1 // edition:2021
2 // run-pass
3
4 #![allow(unused)]
5 #![allow(dead_code)]
6
7 struct Int(i32);
8 struct B<'a>(&'a i32);
9
10 const I : Int = Int(0);
11 const REF_I : &'static Int = &I;
12
13 struct MyStruct<'a> {
14    a: &'static Int,
15    b: B<'a>,
16 }
17
18 fn foo<'a, 'b>(m: &'a MyStruct<'b>) -> impl FnMut() + 'static {
19     let c = || drop(&m.a.0);
20     c
21 }
22
23 fn main() {
24     let t = 0;
25     let s = MyStruct { a: REF_I, b: B(&t) };
26     let _ = foo(&s);
27 }