From f4ac137f3c7952c3b8e8278916ac030a6c3a9b6e Mon Sep 17 00:00:00 2001 From: Rageking8 Date: Thu, 27 Oct 2022 22:56:20 +0800 Subject: [PATCH] add test for issue 36007 --- src/test/ui/coercion/issue-36007.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/test/ui/coercion/issue-36007.rs diff --git a/src/test/ui/coercion/issue-36007.rs b/src/test/ui/coercion/issue-36007.rs new file mode 100644 index 00000000000..78812df870d --- /dev/null +++ b/src/test/ui/coercion/issue-36007.rs @@ -0,0 +1,20 @@ +// check-pass +#![feature(coerce_unsized, unsize)] + +use std::marker::Unsize; +use std::ops::CoerceUnsized; + +struct Foo(Box); + +impl CoerceUnsized> for Foo where T: Unsize {} + +struct Bar; + +trait Baz {} + +impl Baz for Bar {} + +fn main() { + let foo = Foo(Box::new(Bar)); + let foobar: Foo = foo; +}