2020-01-18 19:47:01 -06:00
|
|
|
#![feature(unsized_locals)]
|
2020-05-23 07:35:22 -05:00
|
|
|
//~^ WARN the feature `unsized_locals` is incomplete
|
2022-12-08 19:14:56 -06:00
|
|
|
#![allow(unused)]
|
2019-12-15 10:14:24 -06:00
|
|
|
|
|
|
|
struct A;
|
|
|
|
#[derive(Clone, Copy)]
|
|
|
|
struct C;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let a: Box<[A]> = Box::new([A]);
|
|
|
|
match *a {
|
|
|
|
//~^ ERROR cannot move out of type `[A]`, a non-copy slice
|
2020-10-16 17:37:54 -05:00
|
|
|
[a @ ..] => {}
|
2019-12-15 10:14:24 -06:00
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
let b: Box<[A]> = Box::new([A, A, A]);
|
|
|
|
match *b {
|
|
|
|
//~^ ERROR cannot move out of type `[A]`, a non-copy slice
|
2020-10-16 17:37:54 -05:00
|
|
|
[_, _, b @ .., _] => {}
|
2019-12-15 10:14:24 -06:00
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
|
|
|
|
// `[C]` isn't `Copy`, even if `C` is.
|
|
|
|
let c: Box<[C]> = Box::new([C]);
|
|
|
|
match *c {
|
|
|
|
//~^ ERROR cannot move out of type `[C]`, a non-copy slice
|
2020-10-16 17:37:54 -05:00
|
|
|
[c @ ..] => {}
|
2019-12-15 10:14:24 -06:00
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
let d: Box<[C]> = Box::new([C, C, C]);
|
|
|
|
match *d {
|
|
|
|
//~^ ERROR cannot move out of type `[C]`, a non-copy slice
|
2020-10-16 17:37:54 -05:00
|
|
|
[_, _, d @ .., _] => {}
|
2019-12-15 10:14:24 -06:00
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
}
|