2018-08-10 16:46:59 -05:00
|
|
|
// normalize-stderr-test "\d+ bits" -> "N bits"
|
|
|
|
|
2016-08-27 17:37:27 -05: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 08:15:47 -06:00
|
|
|
unsafe { std::mem::transmute(a) } //~ ERROR cannot transmute between types of different sizes
|
2016-08-27 17:37:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Bar for () {
|
|
|
|
type Bar = ();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x: ArrayPeano<()> = ArrayPeano { data: () };
|
|
|
|
foo(&x);
|
|
|
|
}
|