blob: 4d80b78ac6575095a5640b3b0bcdae388d6ec50a [file] [log] [blame]
// Test the more elaborate outlives suggestions.
#![feature(nll)]
// Should suggest: 'a: 'c, 'b: 'd
fn foo1<'a, 'b, 'c, 'd>(x: &'a usize, y: &'b usize) -> (&'c usize, &'d usize) {
(x, y) //~ERROR lifetime may not live long enough
//~^ERROR lifetime may not live long enough
}
// Should suggest: 'a: 'c and use 'static instead of 'b
fn foo2<'a, 'b, 'c>(x: &'a usize, y: &'b usize) -> (&'c usize, &'static usize) {
(x, y) //~ERROR lifetime may not live long enough
//~^ERROR lifetime may not live long enough
}
// Should suggest: 'a and 'b are the same and use 'static instead of 'c
fn foo3<'a, 'b, 'c, 'd, 'e>(
x: &'a usize,
y: &'b usize,
z: &'c usize,
) -> (&'b usize, &'a usize, &'static usize) {
(x, y, z) //~ERROR lifetime may not live long enough
//~^ERROR lifetime may not live long enough
//~^^ERROR lifetime may not live long enough
}
fn main() {}