]> git.proxmox.com Git - rustc.git/blame - src/test/ui/regions/region-object-lifetime-4.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / regions / region-object-lifetime-4.rs
CommitLineData
85aaf69f
SL
1// Various tests related to testing how region inference works
2// with respect to the object receivers.
1a4d82fc 3
85aaf69f
SL
4trait Foo {
5 fn borrowed<'a>(&'a self) -> &'a ();
6}
223e47cc 7
85aaf69f
SL
8// Here we have two distinct lifetimes, but we try to return a pointer
9// with the longer lifetime when (from the signature) we only know
10// that it lives as long as the shorter lifetime. Therefore, error.
dc9dc135 11fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (dyn Foo + 'b)) -> &'b () {
04454e1e 12 x.borrowed()
923072b8 13 //~^ ERROR lifetime may not live long enough
223e47cc
LB
14}
15
16fn main() {}