rust/tests/ui/issues/issue-28625.rs

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

23 lines
402 B
Rust
Raw Normal View History

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