Rollup merge of #103631 - Rageking8:Add-test-for-issue-36007, r=compiler-errors

Add test for issue 36007

Fixes #36007

r? ``@compiler-errors``
This commit is contained in:
Matthias Krüger 2022-10-28 07:06:47 +02:00 committed by GitHub
commit 19b406d16b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -0,0 +1,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;
}