1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
// run-pass
#![allow(dead_code)]
// Test that we elaborate `Type: 'region` constraints and infer various important things.
trait Master<'a, T: ?Sized> {
fn foo() where T: 'a;
}
// [U]: 'a => U: 'a
impl<'a, U> Master<'a, [U]> for () {
fn foo() where U: 'a { }
}
// &'b U: 'a => 'b: 'a, U: 'a
impl<'a, 'b, U> Master<'a, &'b U> for () {
fn foo() where 'b: 'a, U: 'a { }
}
// &'b [U]: 'a => 'b: 'a, U: 'a
impl<'a, 'b, U> Master<'a, &'b [U]> for () {
fn foo() where 'b: 'a, U: 'a { }
}
// Foo<'b>: 'a => 'b: 'a
struct Foo<'a> { x: &'a () }
impl<'a, 'b> Master<'a, Foo<'b>> for () {
fn foo() where 'b: 'a { }
}
// Bar<'b, T>: 'a => 'b: 'a, T: 'a
struct Bar<'a, T: 'a> { x: &'a T }
impl<'a, 'b, T> Master<'a, Bar<'b, T>> for () {
fn foo() where 'b: 'a, T: 'a { }
}
// fn(T): 'a => T: 'a
impl<'a, T> Master<'a, fn(T)> for () {
fn foo() where T: 'a { }
}
// fn() -> T: 'a => T: 'a
impl<'a, T> Master<'a, fn() -> T> for () {
fn foo() where T: 'a { }
}
fn main() {
println!("Hello, world!");
}
|