Files
rust/tests/ui/traits/polymorphic-trait-creation-7673.rs

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

21 lines
348 B
Rust
Raw Normal View History

2025-07-13 16:56:31 -04:00
// https://github.com/rust-lang/rust/issues/7673
//@ check-pass
#![allow(dead_code)]
/*
#7673 Polymorphically creating traits barely works
*/
pub fn main() {}
trait A {
fn dummy(&self) { }
}
impl<T: 'static> A for T {}
2019-05-28 14:46:13 -04:00
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>; }