rust/src/test/ui/issues/issue-7673-cast-generically-implemented-trait.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
349 B
Rust
Raw Normal View History

// 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 {}
2019-05-28 13:46:13 -05:00
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>; }