]> git.lizzy.rs Git - rust.git/blob - src/test/ui/traits/kindck-owned-contains-1.rs
Auto merge of #87284 - Aaron1011:remove-paren-special, r=petrochenkov
[rust.git] / src / test / ui / traits / kindck-owned-contains-1.rs
1 // run-pass
2 #![allow(non_snake_case)]
3 #![allow(non_camel_case_types)]
4
5 #![feature(box_syntax)]
6
7 trait repeat<A> { fn get(&self) -> A; }
8
9 impl<A:Clone + 'static> repeat<A> for Box<A> {
10     fn get(&self) -> A {
11         (**self).clone()
12     }
13 }
14
15 fn repeater<A:Clone + 'static>(v: Box<A>) -> Box<dyn repeat<A>+'static> {
16     box v as Box<dyn repeat<A>+'static> // No
17 }
18
19 pub fn main() {
20     let x = 3;
21     let y = repeater(box x);
22     assert_eq!(x, y.get());
23 }