]> git.proxmox.com Git - rustc.git/blame - src/test/ui/regions/region-object-lifetime-2.rs
New upstream version 1.62.1+dfsg1
[rustc.git] / src / test / ui / regions / region-object-lifetime-2.rs
CommitLineData
85aaf69f
SL
1// Various tests related to testing how region inference works
2// with respect to the object receivers.
1a4d82fc 3
04454e1e
FG
4// revisions: base nll
5// ignore-compare-mode-nll
6//[nll] compile-flags: -Z borrowck=mir
7
85aaf69f
SL
8trait Foo {
9 fn borrowed<'a>(&'a self) -> &'a ();
10}
223e47cc 11
85aaf69f 12// Borrowed receiver but two distinct lifetimes, we get an error.
dc9dc135 13fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () {
04454e1e
FG
14 x.borrowed()
15 //[base]~^ ERROR cannot infer
16 //[nll]~^^ ERROR lifetime may not live long enough
223e47cc
LB
17}
18
19fn main() {}