mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
23 lines
400 B
Rust
23 lines
400 B
Rust
// 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 cannot transmute between types of different sizes
|
|
}
|
|
|
|
impl Bar for () {
|
|
type Bar = ();
|
|
}
|
|
|
|
fn main() {
|
|
let x: ArrayPeano<()> = ArrayPeano { data: () };
|
|
foo(&x);
|
|
}
|