]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/outlives-suggestion-more.rs
Rollup merge of #83807 - sjakobi:77548-remove-ignore-annotations, r=Mark-Simulacrum
[rust.git] / src / test / ui / nll / outlives-suggestion-more.rs
1 // Test the more elaborate outlives suggestions.
2
3 #![feature(nll)]
4
5 // Should suggest: 'a: 'c, 'b: 'd
6 fn foo1<'a, 'b, 'c, 'd>(x: &'a usize, y: &'b usize) -> (&'c usize, &'d usize) {
7     (x, y) //~ERROR lifetime may not live long enough
8            //~^ERROR lifetime may not live long enough
9 }
10
11 // Should suggest: 'a: 'c and use 'static instead of 'b
12 fn foo2<'a, 'b, 'c>(x: &'a usize, y: &'b usize) -> (&'c usize, &'static usize) {
13     (x, y) //~ERROR lifetime may not live long enough
14            //~^ERROR lifetime may not live long enough
15 }
16
17 // Should suggest: 'a and 'b are the same and use 'static instead of 'c
18 fn foo3<'a, 'b, 'c, 'd, 'e>(
19     x: &'a usize,
20     y: &'b usize,
21     z: &'c usize,
22 ) -> (&'b usize, &'a usize, &'static usize) {
23     (x, y, z) //~ERROR lifetime may not live long enough
24               //~^ERROR lifetime may not live long enough
25               //~^^ERROR lifetime may not live long enough
26 }
27
28 fn main() {}