Add test for u8 align_offset
This commit is contained in:
parent
62280b4b11
commit
ed70617b9c
13
tests/run-pass/aligned_utf8_check.rs
Normal file
13
tests/run-pass/aligned_utf8_check.rs
Normal 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) };
|
||||
}
|
1
tests/run-pass/aligned_utf8_check.stdout
Normal file
1
tests/run-pass/aligned_utf8_check.stdout
Normal file
@ -0,0 +1 @@
|
||||
"AAAAAAAAAAAAAAAAAAAA"
|
Loading…
x
Reference in New Issue
Block a user