]>
Commit | Line | Data |
---|---|---|
0bf4aa26 XL |
1 | // Test that we don't assume that type aliases have the same type parameters |
2 | // as the type they alias and then panic when we see this. | |
3 | ||
0731742a XL |
4 | type A<'a> = &'a isize; |
5 | type B<'a> = Box<A<'a>>; | |
0bf4aa26 | 6 | |
0731742a XL |
7 | struct C<'a> { |
8 | f: Box<B<'a>> | |
0bf4aa26 XL |
9 | } |
10 | ||
11 | trait FromBox<'a> { | |
0731742a | 12 | fn from_box(b: Box<B>) -> Self; |
0bf4aa26 XL |
13 | } |
14 | ||
0731742a XL |
15 | impl<'a> FromBox<'a> for C<'a> { |
16 | fn from_box(b: Box<B>) -> Self { | |
17 | C { f: b } //~ ERROR | |
0bf4aa26 XL |
18 | } |
19 | } | |
20 | ||
21 | trait FromTuple<'a> { | |
0731742a | 22 | fn from_tuple( b: (B,)) -> Self; |
0bf4aa26 XL |
23 | } |
24 | ||
0731742a XL |
25 | impl<'a> FromTuple<'a> for C<'a> { |
26 | fn from_tuple(b: (B,)) -> Self { | |
27 | C { f: Box::new(b.0) } //~ ERROR | |
0bf4aa26 XL |
28 | } |
29 | } | |
30 | ||
31 | fn main() {} |