summaryrefslogtreecommitdiffstats
path: root/tests/ui/coercion/issue-36007.rs
blob: 78812df870d02eb232d08a8c91a152c67f10d91f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// check-pass
#![feature(coerce_unsized, unsize)]

use std::marker::Unsize;
use std::ops::CoerceUnsized;

struct Foo<T: ?Sized>(Box<T>);

impl<T> CoerceUnsized<Foo<dyn Baz>> for Foo<T> where T: Unsize<dyn Baz> {}

struct Bar;

trait Baz {}

impl Baz for Bar {}

fn main() {
    let foo = Foo(Box::new(Bar));
    let foobar: Foo<Bar> = foo;
}