mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 02:33:55 +00:00
22 lines
323 B
Rust
22 lines
323 B
Rust
//@ known-bug: #54888
|
|
|
|
#![feature(unsize, coerce_unsized)]
|
|
|
|
use std::{
|
|
ops::CoerceUnsized,
|
|
marker::Unsize,
|
|
};
|
|
|
|
#[repr(C)]
|
|
struct Ptr<T: ?Sized>(Box<T>);
|
|
|
|
impl<T: ?Sized, U: ?Sized> CoerceUnsized<Ptr<U>> for Ptr<T>
|
|
where
|
|
T: Unsize<U>,
|
|
{}
|
|
|
|
|
|
fn main() {
|
|
let foo = Ptr(Box::new(5)) as Ptr<dyn std::any::Any>;
|
|
}
|