]> git.proxmox.com Git - rustc.git/blob - src/test/ui/unsized/unsized-struct.stderr
New upstream version 1.52.0~beta.3+dfsg1
[rustc.git] / src / test / ui / unsized / unsized-struct.stderr
1 error[E0277]: the size for values of type `T` cannot be known at compilation time
2 --> $DIR/unsized-struct.rs:6:36
3 |
4 LL | struct Foo<T> { data: T }
5 | - required by this bound in `Foo`
6 LL | fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory.
7 LL | fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
8 | - ^^^^^^ doesn't have a size known at compile-time
9 | |
10 | this type parameter needs to be `Sized`
11 |
12 help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>`
13 --> $DIR/unsized-struct.rs:4:12
14 |
15 LL | struct Foo<T> { data: T }
16 | ^ - ...if indirection were used here: `Box<T>`
17 | |
18 | this could be changed to `T: ?Sized`...
19
20 error[E0277]: the size for values of type `T` cannot be known at compilation time
21 --> $DIR/unsized-struct.rs:13:24
22 |
23 LL | fn is_sized<T:Sized>() { }
24 | - required by this bound in `is_sized`
25 ...
26 LL | fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() }
27 | - ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
28 | |
29 | this type parameter needs to be `Sized`
30 |
31 = note: required because it appears within the type `Bar<T>`
32
33 error: aborting due to 2 previous errors
34
35 For more information about this error, try `rustc --explain E0277`.