]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.rs
1 // Check that explicit region bounds are allowed on the various
2 // nominal types (but not on other types) and that they are type
6 // ignore-compare-mode-nll
7 //[nll] compile-flags: -Z borrowck=mir
9 struct Inv
<'a
> { // invariant w/r/t 'a
14 fn method
<'y
:'x
>(self, y
: Inv
<'y
>);
17 fn caller1
<'a
,'b
,F
:Foo
<'a
>>(a
: Inv
<'a
>, b
: Inv
<'b
>, f
: F
) {
18 // Here the value provided for 'y is 'a, and hence 'a:'a holds.
22 fn caller2
<'a
,'b
,F
:Foo
<'a
>>(a
: Inv
<'a
>, b
: Inv
<'b
>, f
: F
) {
23 // Here the value provided for 'y is 'b, and hence 'b:'a does not hold.
25 //[base]~^ ERROR lifetime mismatch [E0623]
26 //[nll]~^^ ERROR lifetime may not live long enough
29 fn caller3
<'a
,'b
:'a
,F
:Foo
<'a
>>(a
: Inv
<'a
>, b
: Inv
<'b
>, f
: F
) {
30 // Here the value provided for 'y is 'b, and hence 'b:'a holds.