]> git.proxmox.com Git - rustc.git/blame - src/test/ui/traits/kindck-owned-trait-contains-1.rs
New upstream version 1.51.0+dfsg1
[rustc.git] / src / test / ui / traits / kindck-owned-trait-contains-1.rs
CommitLineData
b7449926
XL
1// run-pass
2#![allow(non_snake_case)]
3#![allow(non_camel_case_types)]
c34b1796 4
1a4d82fc
JJ
5#![feature(box_syntax)]
6
223e47cc
LB
7trait repeat<A> { fn get(&self) -> A; }
8
1a4d82fc
JJ
9impl<A:Clone + 'static> repeat<A> for Box<A> {
10 fn get(&self) -> A {
11 (**self).clone()
12 }
223e47cc
LB
13}
14
dc9dc135
XL
15fn repeater<A:Clone + 'static>(v: Box<A>) -> Box<dyn repeat<A>+'static> {
16 box v as Box<dyn repeat<A>+'static> // No
223e47cc
LB
17}
18
19pub fn main() {
85aaf69f 20 let x = 3;
1a4d82fc
JJ
21 let y = repeater(box x);
22 assert_eq!(x, y.get());
223e47cc 23}