Skip to content

Commit

Permalink
Rollup merge of rust-lang#103631 - Rageking8:Add-test-for-issue-36007…
Browse files Browse the repository at this point in the history
…, r=compiler-errors

Add test for issue 36007

Fixes rust-lang#36007

r? ``@compiler-errors``
  • Loading branch information
matthiaskrgr authored Oct 28, 2022
2 parents ab0d9df + f4ac137 commit 19b406d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/test/ui/coercion/issue-36007.rs
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit 19b406d

Please sign in to comment.