fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

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