]> git.lizzy.rs Git - rust.git/blob - src/test/ui/box-into-boxed-slice-fail.rs
Rollup merge of #73331 - hermitcore:listen, r=kennytm
[rust.git] / src / test / ui / box-into-boxed-slice-fail.rs
1 // ignore-tidy-linelength
2 #![feature(box_into_boxed_slice)]
3
4 use std::boxed::Box;
5 use std::fmt::Debug;
6 fn main() {
7     let boxed_slice = Box::new([1,2,3]) as Box<[u8]>;
8     let _ = Box::into_boxed_slice(boxed_slice);
9     //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
10     //~^^ ERROR the size for values of type `[u8]` cannot be known at compilation time
11     let boxed_trait: Box<dyn Debug> = Box::new(5u8);
12     let _ = Box::into_boxed_slice(boxed_trait);
13     //~^ ERROR the size for values of type `dyn std::fmt::Debug` cannot be known at compilation time
14     //~^^ ERROR the size for values of type `dyn std::fmt::Debug` cannot be known at compilation time
15 }