]> git.proxmox.com Git - rustc.git/blame - src/test/ui/unsized/unsized-struct.stderr
New upstream version 1.46.0~beta.2+dfsg1
[rustc.git] / src / test / ui / unsized / unsized-struct.stderr
CommitLineData
b7449926 1error[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 4LL | struct Foo<T> { data: T }
ba9703b0 5 | - required by this bound in `Foo`
e1599b0c 6LL | fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory.
b7449926 7LL | 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>
f035d41b
XL
14help: you could relax the implicit `Sized` bound on `T` if it were used through indirection like `&T` or `Box<T>`
15 --> $DIR/unsized-struct.rs:4:12
16 |
17LL | struct Foo<T> { data: T }
18 | ^ - ...if indirection was used here: `Box<T>`
19 | |
20 | this could be changed to `T: ?Sized`...
b7449926
XL
21
22error[E0277]: the size for values of type `T` cannot be known at compilation time
0731742a 23 --> $DIR/unsized-struct.rs:13:24
b7449926 24 |
e1599b0c 25LL | fn is_sized<T:Sized>() { }
ba9703b0 26 | - required by this bound in `is_sized`
e1599b0c 27...
b7449926 28LL | fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() }
74b04a01 29 | - ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
e74abb32 30 | |
74b04a01 31 | this type parameter needs to be `std::marker::Sized`
b7449926
XL
32 |
33 = help: within `Bar<T>`, the trait `std::marker::Sized` is not implemented for `T`
0731742a 34 = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
b7449926 35 = note: required because it appears within the type `Bar<T>`
b7449926
XL
36
37error: aborting due to 2 previous errors
38
39For more information about this error, try `rustc --explain E0277`.