1 // Test various ways to construct a pointer with a longer lifetime
2 // than the thing it points at and ensure that they result in
3 // errors. See also regions-free-region-ordering-callee.rs
5 struct Paramd<'a> { x: &'a usize }
7 fn call2<'a, 'b>(a: &'a usize, b: &'b usize) {
8 let z: Option<&'b &'a usize> = None;
9 //~^ ERROR lifetime may not live long enough
12 fn call3<'a, 'b>(a: &'a usize, b: &'b usize) {
13 let y: Paramd<'a> = Paramd { x: a };
14 let z: Option<&'b Paramd<'a>> = None;
15 //~^ ERROR lifetime may not live long enough
18 fn call4<'a, 'b>(a: &'a usize, b: &'b usize) {
19 let z: Option<&'a &'b usize> = None;
20 //~^ ERROR lifetime may not live long enough