2020-05-23 19:26:20 +00:00
|
|
|
#![feature(unsized_tuple_coercion, unsized_fn_params)]
|
2018-05-28 15:11:34 +00:00
|
|
|
|
|
|
|
struct A<X: ?Sized>(X);
|
|
|
|
|
|
|
|
fn udrop<T: ?Sized>(_x: T) {}
|
|
|
|
fn foo() -> Box<[u8]> {
|
|
|
|
Box::new(*b"foo")
|
|
|
|
}
|
|
|
|
fn tfoo() -> Box<(i32, [u8])> {
|
|
|
|
Box::new((42, *b"foo"))
|
|
|
|
}
|
|
|
|
fn afoo() -> Box<A<[u8]>> {
|
|
|
|
Box::new(A(*b"foo"))
|
|
|
|
}
|
|
|
|
|
|
|
|
impl std::ops::Add<i32> for A<[u8]> {
|
|
|
|
type Output = ();
|
|
|
|
fn add(self, _rhs: i32) -> Self::Output {}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
udrop::<(i32, [u8])>((42, *foo()));
|
|
|
|
//~^ERROR E0277
|
|
|
|
udrop::<A<[u8]>>(A { 0: *foo() });
|
|
|
|
//~^ERROR E0277
|
2018-11-18 15:18:13 +00:00
|
|
|
udrop::<A<[u8]>>(A(*foo()));
|
|
|
|
//~^ERROR E0277
|
2018-05-28 15:11:34 +00:00
|
|
|
}
|