about summary refs log tree commit diff
path: root/tests/ui/lifetimes/tuple-struct-vs-struct-with-fields-borrowck-10902.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/lifetimes/tuple-struct-vs-struct-with-fields-borrowck-10902.rs')
-rw-r--r--tests/ui/lifetimes/tuple-struct-vs-struct-with-fields-borrowck-10902.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/lifetimes/tuple-struct-vs-struct-with-fields-borrowck-10902.rs b/tests/ui/lifetimes/tuple-struct-vs-struct-with-fields-borrowck-10902.rs
new file mode 100644
index 00000000000..97c0d0bf554
--- /dev/null
+++ b/tests/ui/lifetimes/tuple-struct-vs-struct-with-fields-borrowck-10902.rs
@@ -0,0 +1,22 @@
+//! Regression test for https://github.com/rust-lang/rust/issues/10902
+
+//@ check-pass
+#![allow(dead_code)]
+
+pub mod two_tuple {
+    pub trait T { fn dummy(&self) { } }
+    pub struct P<'a>(&'a (dyn T + 'a), &'a (dyn T + 'a));
+    pub fn f<'a>(car: &'a dyn T, cdr: &'a dyn T) -> P<'a> {
+        P(car, cdr)
+    }
+}
+
+pub mod two_fields {
+    pub trait T { fn dummy(&self) { } }
+    pub struct P<'a> { car: &'a (dyn T + 'a), cdr: &'a (dyn T + 'a) }
+    pub fn f<'a>(car: &'a dyn T, cdr: &'a dyn T) -> P<'a> {
+        P{ car: car, cdr: cdr }
+    }
+}
+
+fn main() {}