]> git.proxmox.com Git - rustc.git/blame - src/test/ui/nll/type-alias-free-regions.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / nll / type-alias-free-regions.rs
CommitLineData
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
4type A<'a> = &'a isize;
5type B<'a> = Box<A<'a>>;
0bf4aa26 6
0731742a
XL
7struct C<'a> {
8 f: Box<B<'a>>
0bf4aa26
XL
9}
10
11trait FromBox<'a> {
0731742a 12 fn from_box(b: Box<B>) -> Self;
0bf4aa26
XL
13}
14
0731742a
XL
15impl<'a> FromBox<'a> for C<'a> {
16 fn from_box(b: Box<B>) -> Self {
17 C { f: b } //~ ERROR
0bf4aa26
XL
18 }
19}
20
21trait FromTuple<'a> {
0731742a 22 fn from_tuple( b: (B,)) -> Self;
0bf4aa26
XL
23}
24
0731742a
XL
25impl<'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
31fn main() {}