2020-01-19 01:47:01 +00:00
|
|
|
#![feature(unsized_locals)]
|
2020-05-23 12:35:22 +00:00
|
|
|
//~^ WARN the feature `unsized_locals` is incomplete
|
2022-12-09 01:14:56 +00:00
|
|
|
#![allow(unused)]
|
2019-12-15 16:14:24 +00: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 22:37:54 +00:00
|
|
|
[a @ ..] => {}
|
2019-12-15 16:14:24 +00: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 22:37:54 +00:00
|
|
|
[_, _, b @ .., _] => {}
|
2019-12-15 16:14:24 +00: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 22:37:54 +00:00
|
|
|
[c @ ..] => {}
|
2019-12-15 16:14:24 +00: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 22:37:54 +00:00
|
|
|
[_, _, d @ .., _] => {}
|
2019-12-15 16:14:24 +00:00
|
|
|
_ => {}
|
|
|
|
}
|
|
|
|
}
|