2020-10-03 11:00:18 -05:00
|
|
|
// revisions: full min
|
|
|
|
|
2021-08-27 11:04:57 -05:00
|
|
|
#![cfg_attr(full, feature(generic_const_exprs))]
|
2020-10-03 11:00:18 -05:00
|
|
|
#![cfg_attr(full, allow(incomplete_features))]
|
2020-10-01 20:21:15 -05:00
|
|
|
|
|
|
|
pub const fn is_zst<T: ?Sized>() -> usize {
|
|
|
|
if std::mem::size_of::<T>() == 0 {
|
|
|
|
1
|
|
|
|
} else {
|
|
|
|
0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub struct AtLeastByte<T: ?Sized> {
|
|
|
|
value: T,
|
|
|
|
//~^ ERROR the size for values of type `T` cannot be known at compilation time
|
|
|
|
pad: [u8; is_zst::<T>()],
|
2020-10-12 16:27:59 -05:00
|
|
|
//[min]~^ ERROR generic parameters may not be used in const operations
|
2021-08-27 11:04:57 -05:00
|
|
|
//[full]~^^ ERROR unconstrained generic constant
|
2020-10-01 20:21:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|