1 // Tests that callees correctly infer an ordering between free regions
2 // that appear in their parameter list. See also
3 // regions-free-region-ordering-caller.rs
5 fn ordering1<'a, 'b>(x: &'a &'b usize) -> &'a usize {
6 // It is safe to assume that 'a <= 'b due to the type of x
7 let y: &'b usize = &**x;
11 fn ordering2<'a, 'b>(x: &'a &'b usize, y: &'a usize) -> &'b usize {
12 // However, it is not safe to assume that 'b <= 'a
13 &*y //~ ERROR lifetime mismatch [E0623]
16 fn ordering3<'a, 'b>(x: &'a usize, y: &'b usize) -> &'a &'b usize {
17 // Do not infer an ordering from the return value.
18 let z: &'b usize = &*x;
19 //~^ ERROR lifetime mismatch [E0623]
23 // see regions-free-region-ordering-callee-4.rs
25 fn ordering5<'a, 'b>(a: &'a usize, b: &'b usize, x: Option<&'a &'b usize>) {
26 let z: Option<&'a &'b usize> = None;