summaryrefslogtreecommitdiffstats
path: root/tests/ui/regions/region-object-lifetime-2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/regions/region-object-lifetime-2.rs')
-rw-r--r--tests/ui/regions/region-object-lifetime-2.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/regions/region-object-lifetime-2.rs b/tests/ui/regions/region-object-lifetime-2.rs
new file mode 100644
index 000000000..cfdb8fefe
--- /dev/null
+++ b/tests/ui/regions/region-object-lifetime-2.rs
@@ -0,0 +1,14 @@
+// Various tests related to testing how region inference works
+// with respect to the object receivers.
+
+trait Foo {
+ fn borrowed<'a>(&'a self) -> &'a ();
+}
+
+// Borrowed receiver but two distinct lifetimes, we get an error.
+fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a dyn Foo) -> &'b () {
+ x.borrowed()
+ //~^ ERROR lifetime may not live long enough
+}
+
+fn main() {}