Skip to content

Commit

Permalink
make output bitwidth-independent
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Jun 6, 2022
1 parent b39e4c7 commit 84edb76
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tests/fail/transmute_fat1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// error-pattern: type validation failed: encountered a pointer
// normalize-stderr-test: "\[u8; (08|16)\]" -> "$$ARRAY"

fn main() {
#[cfg(target_pointer_width="64")]
Expand All @@ -7,7 +8,7 @@ fn main() {
};
#[cfg(target_pointer_width="32")]
let bad = unsafe {
std::mem::transmute::<&[u8], [u8; 8]>(&[1u8])
std::mem::transmute::<&[u8], [u8; 08]>(&[1u8])
};
let _val = bad[0] + bad[bad.len()-1];
}
2 changes: 1 addition & 1 deletion tests/fail/transmute_fat1.stderr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error: Undefined Behavior: type validation failed: encountered a pointer, but expected plain (non-pointer) bytes
--> $DIR/transmute_fat1.rs:LL:CC
|
LL | std::mem::transmute::<&[u8], [u8; 16]>(&[1u8])
LL | std::mem::transmute::<&[u8], $ARRAY>(&[1u8])
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered a pointer, but expected plain (non-pointer) bytes
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
Expand Down

0 comments on commit 84edb76

Please sign in to comment.