]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/type-alias-free-regions.rs
Auto merge of #103600 - compiler-errors:early-binder-nits, r=spastorino
[rust.git] / src / test / ui / nll / type-alias-free-regions.rs
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
4 type A<'a> = &'a isize;
5 type B<'a> = Box<A<'a>>;
6
7 struct C<'a> {
8     f: Box<B<'a>>
9 }
10
11 trait FromBox<'a> {
12     fn from_box(b: Box<B>) -> Self;
13 }
14
15 impl<'a> FromBox<'a> for C<'a> {
16     fn from_box(b: Box<B>) -> Self {
17         C { f: b } //~ ERROR
18     }
19 }
20
21 trait FromTuple<'a> {
22     fn from_tuple( b: (B,)) -> Self;
23 }
24
25 impl<'a> FromTuple<'a> for C<'a> {
26     fn from_tuple(b: (B,)) -> Self {
27         C { f: Box::new(b.0) } //~ ERROR
28     }
29 }
30
31 fn main() {}