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