summaryrefslogtreecommitdiffstats
path: root/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs
blob: c089c33083984d7f77ac91b36a45cc64dcf3f7a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// check-pass
#![allow(dead_code)]
// pretty-expanded FIXME #23616

/*

#7673 Polymorphically creating traits barely works

*/

pub fn main() {}

trait A {
    fn dummy(&self) { }
}

impl<T: 'static> A for T {}

fn owned2<T: 'static>(a: Box<T>) { a as Box<dyn A>; }
fn owned3<T: 'static>(a: Box<T>) { Box::new(a) as Box<dyn A>; }