]>
Commit | Line | Data |
---|---|---|
b7449926 | 1 | error[E0277]: the size for values of type `T` cannot be known at compilation time |
0731742a | 2 | --> $DIR/unsized-struct.rs:6:36 |
b7449926 | 3 | | |
e1599b0c | 4 | LL | struct Foo<T> { data: T } |
ba9703b0 | 5 | | - required by this bound in `Foo` |
e1599b0c | 6 | LL | fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory. |
b7449926 | 7 | LL | fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() } |
74b04a01 | 8 | | - ^^^^^^ doesn't have a size known at compile-time |
e74abb32 | 9 | | | |
74b04a01 | 10 | | this type parameter needs to be `std::marker::Sized` |
b7449926 XL |
11 | | |
12 | = help: the trait `std::marker::Sized` is not implemented for `T` | |
0731742a | 13 | = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait> |
b7449926 XL |
14 | |
15 | error[E0277]: the size for values of type `T` cannot be known at compilation time | |
0731742a | 16 | --> $DIR/unsized-struct.rs:13:24 |
b7449926 | 17 | | |
e1599b0c | 18 | LL | fn is_sized<T:Sized>() { } |
ba9703b0 | 19 | | - required by this bound in `is_sized` |
e1599b0c | 20 | ... |
b7449926 | 21 | LL | fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() } |
74b04a01 | 22 | | - ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time |
e74abb32 | 23 | | | |
74b04a01 | 24 | | this type parameter needs to be `std::marker::Sized` |
b7449926 XL |
25 | | |
26 | = help: within `Bar<T>`, the trait `std::marker::Sized` is not implemented for `T` | |
0731742a | 27 | = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait> |
b7449926 | 28 | = note: required because it appears within the type `Bar<T>` |
b7449926 XL |
29 | |
30 | error: aborting due to 2 previous errors | |
31 | ||
32 | For more information about this error, try `rustc --explain E0277`. |