rust/src/test/ui/issues/issue-28625.rs

23 lines
397 B
Rust
Raw Normal View History

2018-08-10 16:46:59 -05:00
// normalize-stderr-test "\d+ bits" -> "N bits"
trait Bar {
type Bar;
}
struct ArrayPeano<T: Bar> {
data: T::Bar,
}
fn foo<T>(a: &ArrayPeano<T>) -> &[T] where T: Bar {
unsafe { std::mem::transmute(a) } //~ ERROR transmute called with types of different sizes
}
impl Bar for () {
type Bar = ();
}
fn main() {
let x: ArrayPeano<()> = ArrayPeano { data: () };
foo(&x);
}