]> git.lizzy.rs Git - rust.git/blob - src/test/ui/unsized-locals/unsized-exprs2.rs
Rollup merge of #89468 - FabianWolff:issue-89358, r=jackh726
[rust.git] / src / test / ui / unsized-locals / unsized-exprs2.rs
1 #![feature(unsized_tuple_coercion, unsized_fn_params)]
2
3 struct A<X: ?Sized>(X);
4
5 fn udrop<T: ?Sized>(_x: T) {}
6 fn foo() -> Box<[u8]> {
7     Box::new(*b"foo")
8 }
9 fn tfoo() -> Box<(i32, [u8])> {
10     Box::new((42, *b"foo"))
11 }
12 fn afoo() -> Box<A<[u8]>> {
13     Box::new(A(*b"foo"))
14 }
15
16 impl std::ops::Add<i32> for A<[u8]> {
17     type Output = ();
18     fn add(self, _rhs: i32) -> Self::Output {}
19 }
20
21 fn main() {
22     udrop::<[u8]>(foo()[..]);
23     //~^ERROR cannot move out of type `[u8]`, a non-copy slice
24 }