Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 84edb76

Browse files
committed
make output bitwidth-independent
1 parent b39e4c7 commit 84edb76

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

tests/fail/transmute_fat1.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// error-pattern: type validation failed: encountered a pointer
2+
// normalize-stderr-test: "\[u8; (08|16)\]" -> "$$ARRAY"
23

34
fn main() {
45
#[cfg(target_pointer_width="64")]
@@ -7,7 +8,7 @@ fn main() {
78
};
89
#[cfg(target_pointer_width="32")]
910
let bad = unsafe {
10-
std::mem::transmute::<&[u8], [u8; 8]>(&[1u8])
11+
std::mem::transmute::<&[u8], [u8; 08]>(&[1u8])
1112
};
1213
let _val = bad[0] + bad[bad.len()-1];
1314
}

tests/fail/transmute_fat1.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: Undefined Behavior: type validation failed: encountered a pointer, but expected plain (non-pointer) bytes
22
--> $DIR/transmute_fat1.rs:LL:CC
33
|
4-
LL | std::mem::transmute::<&[u8], [u8; 16]>(&[1u8])
4+
LL | std::mem::transmute::<&[u8], $ARRAY>(&[1u8])
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected plain (non-pointer) bytes
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior

0 commit comments

Comments
 (0)