about summary refs log tree commit diff
path: root/tests/ui/coercion/fake-sized-ptr-cast.rs
blob: 4b6bf0eb5168ed35db98576b903ff1775029841e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Make sure borrowck doesn't ICE because it thinks a pointer cast is a metadata-preserving
// wide-to-wide ptr cast when it's actually (falsely) a wide-to-thin ptr cast due to an
// impossible dyn sized bound.

//@ check-pass

trait Trait<T> {}

fn func<'a>(x: *const (dyn Trait<()> + 'a))
where
    dyn Trait<u8> + 'a: Sized,
{
    let _x: *const dyn Trait<u8> = x as _;
}

fn main() {}