summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2019-06-12 11:50:28 -0400
committerNiko Matsakis <niko@alum.mit.edu>2019-07-02 12:15:21 -0400
commitb170c0f1c4510cbabe0c767f6fcbeb58c8a05c0d (patch)
tree6ce75688b8e8c45511d6ba823ed10bab1a75a950 /src/test
parenta18c779fa21d0259da8e38ef6022a14310d3ae15 (diff)
downloadrust-b170c0f1c4510cbabe0c767f6fcbeb58c8a05c0d.tar.gz
rust-b170c0f1c4510cbabe0c767f6fcbeb58c8a05c0d.zip
add a preliminary existential test; not really enough
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original-existential.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original-existential.rs b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original-existential.rs
new file mode 100644
index 00000000000..86760dfcbda
--- /dev/null
+++ b/src/test/ui/impl-trait/multiple-lifetimes/ordinary-bounds-pick-original-existential.rs
@@ -0,0 +1,29 @@
+// edition:2018
+// run-pass
+// revisions: migrate mir
+//[mir]compile-flags: -Z borrowck=mir
+
+trait Trait<'a, 'b> { }
+impl<T> Trait<'_, '_> for T { }
+
+// Here we wind up selecting `'a` and `'b` in the hidden type because
+// those are the types that appear inth e original values.
+
+existential type Foo<'a, 'b>: Trait<'a, 'b>;
+
+fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> Foo<'a, 'b> {
+    // In this simple case, you have a hidden type `(&'0 u8, &'1 u8)` and constraints like
+    //
+    // ```
+    // 'a: '0
+    // 'b: '1
+    // '0 in ['a, 'b]
+    // '1 in ['a, 'b]
+    // ```
+    //
+    // We use the fact that `'a: 0'` must hold (combined with the in
+    // constraint) to determine that `'0 = 'a` must be the answer.
+    (a, b)
+}
+
+fn main() { }