]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/min_const_generics/const-argument-if-length.rs
Replace "non trivial" with "non-trivial"
[rust.git] / src / test / ui / const-generics / min_const_generics / const-argument-if-length.rs
1 #![feature(min_const_generics)]
2
3 pub const fn is_zst<T: ?Sized>() -> usize {
4     if std::mem::size_of::<T>() == 0 {
5         1
6     } else {
7         0
8     }
9 }
10
11 pub struct AtLeastByte<T: ?Sized> {
12     value: T,
13     //~^ ERROR the size for values of type `T` cannot be known at compilation time
14     pad: [u8; is_zst::<T>()],
15     //~^ ERROR generic parameters must not be used inside of non-trivial constant values
16 }
17
18 fn main() {}