2015-02-12 09:37:52 -05:00
|
|
|
// Various tests related to testing how region inference works
|
|
|
|
// with respect to the object receivers.
|
|
|
|
|
|
|
|
trait Foo {
|
|
|
|
fn borrowed<'a>(&'a self) -> &'a ();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Here, the object is bounded by an anonymous lifetime and returned
|
|
|
|
// as `&'static`, so you get an error.
|
2019-05-28 14:46:13 -04:00
|
|
|
fn owned_receiver(x: Box<dyn Foo>) -> &'static () {
|
2023-06-22 20:30:23 +00:00
|
|
|
x.borrowed() //~ ERROR cannot return value referencing local data `*x`
|
2015-02-12 09:37:52 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|