]> git.lizzy.rs Git - rust.git/blob - tests/ui/regions/regions-lifetime-bounds-on-fns.rs
internally change regions to be covariant
[rust.git] / tests / ui / regions / regions-lifetime-bounds-on-fns.rs
1 fn a<'a, 'b:'a>(x: &mut &'a isize, y: &mut &'b isize) {
2     // Note: this is legal because of the `'b:'a` declaration.
3     *x = *y;
4 }
5
6 fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) {
7     // Illegal now because there is no `'b:'a` declaration.
8     *x = *y;
9 }
10
11 fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) {
12     // Here we try to call `foo` but do not know that `'a` and `'b` are
13     // related as required.
14     a(x, y);
15 }
16
17 fn d() {
18     // 'a and 'b are early bound in the function `a` because they appear
19     // inconstraints:
20     let _: fn(&mut &isize, &mut &isize) = a;
21     //~^ ERROR mismatched types [E0308]
22 }
23
24 fn e() {
25     // 'a and 'b are late bound in the function `b` because there are
26     // no constraints:
27     let _: fn(&mut &isize, &mut &isize) = b;
28 }
29
30 fn main() { }