]> git.proxmox.com Git - rustc.git/blob - src/test/ui/nll/closure-requirements/propagate-approximated-fail-no-postdom.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / nll / closure-requirements / propagate-approximated-fail-no-postdom.rs
1 // Test where we fail to approximate due to demanding a postdom
2 // relationship between our upper bounds.
3
4 // compile-flags:-Zverbose
5
6 #![feature(rustc_attrs)]
7
8 use std::cell::Cell;
9
10 // Callee knows that:
11 //
12 // 'x: 'a
13 // 'x: 'b
14 // 'c: 'y
15 //
16 // we have to prove that `'x: 'y`. We currently can only approximate
17 // via a postdominator -- hence we fail to choose between `'a` and
18 // `'b` here and report the error in the closure.
19 fn establish_relationships<'a, 'b, 'c, F>(
20 _cell_a: Cell<&'a u32>,
21 _cell_b: Cell<&'b u32>,
22 _cell_c: Cell<&'c u32>,
23 _closure: F,
24 ) where
25 F: for<'x, 'y> FnMut(
26 Cell<&'a &'x u32>, // shows that 'x: 'a
27 Cell<&'b &'x u32>, // shows that 'x: 'b
28 Cell<&'y &'c u32>, // shows that 'c: 'y
29 Cell<&'x u32>,
30 Cell<&'y u32>,
31 ),
32 {
33 }
34
35 fn demand_y<'x, 'y>(_cell_x: Cell<&'x u32>, _cell_y: Cell<&'y u32>, _y: &'y u32) {}
36
37 #[rustc_regions]
38 fn supply<'a, 'b, 'c>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>, cell_c: Cell<&'c u32>) {
39 establish_relationships(
40 cell_a,
41 cell_b,
42 cell_c,
43 |_outlives1, _outlives2, _outlives3, x, y| {
44 // Only works if 'x: 'y:
45 let p = x.get();
46 demand_y(x, y, p) //~ ERROR
47 },
48 );
49 }
50
51 fn main() {}