]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/region-object-lifetime-5.rs
Rollup merge of #57132 - daxpedda:master, r=steveklabnik
[rust.git] / src / test / ui / regions / region-object-lifetime-5.rs
1 // Various tests related to testing how region inference works
2 // with respect to the object receivers.
3
4 trait Foo {
5     fn borrowed<'a>(&'a self) -> &'a ();
6 }
7
8 // Here, the object is bounded by an anonymous lifetime and returned
9 // as `&'static`, so you get an error.
10 fn owned_receiver(x: Box<Foo>) -> &'static () {
11     x.borrowed() //~ ERROR `*x` does not live long enough
12 }
13
14 fn main() {}