]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/const-argument-if-length.full.stderr
Auto merge of #79342 - CDirkx:ipaddr-const, r=oli-obk
[rust.git] / src / test / ui / const-generics / const-argument-if-length.full.stderr
1 error[E0277]: the size for values of type `T` cannot be known at compilation time
2   --> $DIR/const-argument-if-length.rs:8:28
3    |
4 LL | pub const fn is_zst<T: ?Sized>() -> usize {
5    |                     - this type parameter needs to be `Sized`
6 LL |     if std::mem::size_of::<T>() == 0 {
7    |                            ^ doesn't have a size known at compile-time
8    | 
9   ::: $SRC_DIR/core/src/mem/mod.rs:LL:COL
10    |
11 LL | pub const fn size_of<T>() -> usize {
12    |                      - required by this bound in `std::mem::size_of`
13
14 error[E0277]: the size for values of type `T` cannot be known at compilation time
15   --> $DIR/const-argument-if-length.rs:17:12
16    |
17 LL | pub struct AtLeastByte<T: ?Sized> {
18    |                        - this type parameter needs to be `Sized`
19 LL |     value: T,
20    |            ^ doesn't have a size known at compile-time
21    |
22    = note: only the last field of a struct may have a dynamically sized type
23    = help: change the field's type to have a statically known size
24 help: borrowed types always have a statically known size
25    |
26 LL |     value: &T,
27    |            ^
28 help: the `Box` type always has a statically known size and allocates its contents in the heap
29    |
30 LL |     value: Box<T>,
31    |            ^^^^ ^
32
33 error: aborting due to 2 previous errors
34
35 For more information about this error, try `rustc --explain E0277`.