mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 02:33:55 +00:00
21 lines
472 B
Rust
21 lines
472 B
Rust
pub trait Foo: Sized {
|
|
const SIZE: usize;
|
|
|
|
fn new(slice: &[u8; Foo::SIZE]) -> Self;
|
|
//~^ ERROR: E0790
|
|
}
|
|
|
|
pub struct Bar<T: ?Sized>(T);
|
|
|
|
impl Bar<[u8]> {
|
|
const SIZE: usize = 32;
|
|
|
|
fn new(slice: &[u8; Self::SIZE]) -> Self {
|
|
//~^ ERROR: the size for values of type `[u8]` cannot be known at compilation time
|
|
Foo(Box::new(*slice))
|
|
//~^ ERROR: expected function, tuple struct or tuple variant, found trait `Foo`
|
|
}
|
|
}
|
|
|
|
fn main() {}
|