about summary refs log tree commit diff
path: root/tests/ui/unsized-locals/unsized-exprs-rpass.rs
blob: ce31bd63f7cc18400b17adc57398598f2a74062d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//@ run-pass
#![allow(internal_features, unused_braces, unused_parens)]
#![feature(unsized_fn_params)]

struct A<X: ?Sized>(#[allow(dead_code)] X);

fn udrop<T: ?Sized>(_x: T) {}
fn foo() -> Box<[u8]> {
    Box::new(*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::<[u8]>((*foo()));
    *afoo() + 42;
    udrop as fn([u8]);
}