]> git.proxmox.com Git - rustc.git/blob - src/test/ui/nll/type-alias-free-regions.rs
New upstream version 1.62.1+dfsg1
[rustc.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 // revisions: base nll
5 // ignore-compare-mode-nll
6 //[nll] compile-flags: -Z borrowck=mir
7
8 type A<'a> = &'a isize;
9 type B<'a> = Box<A<'a>>;
10
11 struct C<'a> {
12 f: Box<B<'a>>
13 }
14
15 trait FromBox<'a> {
16 fn from_box(b: Box<B>) -> Self;
17 }
18
19 impl<'a> FromBox<'a> for C<'a> {
20 fn from_box(b: Box<B>) -> Self {
21 C { f: b } //~ ERROR
22 }
23 }
24
25 trait FromTuple<'a> {
26 fn from_tuple( b: (B,)) -> Self;
27 }
28
29 impl<'a> FromTuple<'a> for C<'a> {
30 fn from_tuple(b: (B,)) -> Self {
31 C { f: Box::new(b.0) } //~ ERROR
32 }
33 }
34
35 fn main() {}