2019-09-30 14:55:29 -05:00
|
|
|
pub trait Foo: Sized {
|
|
|
|
const SIZE: usize;
|
|
|
|
|
|
|
|
fn new(slice: &[u8; Foo::SIZE]) -> Self;
|
2022-06-12 10:46:57 -05:00
|
|
|
//~^ ERROR: E0790
|
2019-09-30 14:55:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
pub struct Bar<T: ?Sized>(T);
|
|
|
|
|
|
|
|
impl Bar<[u8]> {
|
|
|
|
const SIZE: usize = 32;
|
|
|
|
|
|
|
|
fn new(slice: &[u8; Self::SIZE]) -> Self {
|
2023-10-18 03:47:17 -05:00
|
|
|
//~^ ERROR: the size for values of type `[u8]` cannot be known at compilation time
|
2019-10-14 19:20:50 -05:00
|
|
|
Foo(Box::new(*slice))
|
|
|
|
//~^ ERROR: expected function, tuple struct or tuple variant, found trait `Foo`
|
2019-09-30 14:55:29 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|