Add test for u8 align_offset

This commit is contained in:
Christian Poveda 2019-09-11 12:08:42 -05:00
parent 62280b4b11
commit ed70617b9c
2 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,13 @@
fn main() {
const N: usize = 10;
let x = vec![0x4141u16; N];
let mut y: Vec<u8> = unsafe { std::mem::transmute(x) };
unsafe { y.set_len(2 * N) };
println!("{:?}", String::from_utf8_lossy(&y));
let mut x: Vec<u16> = unsafe { std::mem::transmute(y) };
unsafe { x.set_len(N) };
}

View File

@ -0,0 +1 @@
"AAAAAAAAAAAAAAAAAAAA"