Skip to content

Commit b170c0f

Browse files
committed
add a preliminary existential test; not really enough
1 parent a18c779 commit b170c0f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// edition:2018
2+
// run-pass
3+
// revisions: migrate mir
4+
//[mir]compile-flags: -Z borrowck=mir
5+
6+
trait Trait<'a, 'b> { }
7+
impl<T> Trait<'_, '_> for T { }
8+
9+
// Here we wind up selecting `'a` and `'b` in the hidden type because
10+
// those are the types that appear inth e original values.
11+
12+
existential type Foo<'a, 'b>: Trait<'a, 'b>;
13+
14+
fn upper_bounds<'a, 'b>(a: &'a u8, b: &'b u8) -> Foo<'a, 'b> {
15+
// In this simple case, you have a hidden type `(&'0 u8, &'1 u8)` and constraints like
16+
//
17+
// ```
18+
// 'a: '0
19+
// 'b: '1
20+
// '0 in ['a, 'b]
21+
// '1 in ['a, 'b]
22+
// ```
23+
//
24+
// We use the fact that `'a: 0'` must hold (combined with the in
25+
// constraint) to determine that `'0 = 'a` must be the answer.
26+
(a, b)
27+
}
28+
29+
fn main() { }

0 commit comments

Comments
 (0)