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

/*

#7673 Polymorphically creating traits barely works

*/

#![feature(box_syntax)]

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 a as Box<dyn A>; }