mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
21 lines
343 B
Rust
21 lines
343 B
Rust
//@ 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;
|
|
}
|