From 84edb76e2698c62d65605d18f1c2294007d3b3aa Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 6 Jun 2022 12:33:48 -0400 Subject: [PATCH] make output bitwidth-independent --- tests/fail/transmute_fat1.rs | 3 ++- tests/fail/transmute_fat1.stderr | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/fail/transmute_fat1.rs b/tests/fail/transmute_fat1.rs index 22fb4c6fdcc..8b351d3a09e 100644 --- a/tests/fail/transmute_fat1.rs +++ b/tests/fail/transmute_fat1.rs @@ -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")] @@ -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]; } diff --git a/tests/fail/transmute_fat1.stderr b/tests/fail/transmute_fat1.stderr index ea83dd442d2..cbfa8dff2a5 100644 --- a/tests/fail/transmute_fat1.stderr +++ b/tests/fail/transmute_fat1.stderr @@ -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