]> git.proxmox.com Git - rustc.git/blob - src/test/ui/rfcs/rfc-2528-type-changing-struct-update/coerce-in-base-expr.rs
New upstream version 1.63.0+dfsg1
[rustc.git] / src / test / ui / rfcs / rfc-2528-type-changing-struct-update / coerce-in-base-expr.rs
1 // check-pass
2
3 #![feature(type_changing_struct_update)]
4 #![allow(incomplete_features)]
5
6 use std::any::Any;
7
8 struct Foo<A, B: ?Sized, C: ?Sized> {
9 a: A,
10 b: Box<B>,
11 c: Box<C>,
12 }
13
14 struct B;
15 struct C;
16
17 fn main() {
18 let y = Foo::<usize, dyn Any, dyn Any> {
19 a: 0,
20 b: Box::new(B),
21 ..Foo {
22 a: 0,
23 b: Box::new(B),
24 // C needs to be told to coerce to `Box<dyn Any>`
25 c: Box::new(C),
26 }
27 };
28 }