]> git.lizzy.rs Git - rust.git/commitdiff
make output bitwidth-independent
authorRalf Jung <post@ralfj.de>
Mon, 6 Jun 2022 16:33:48 +0000 (12:33 -0400)
committerRalf Jung <post@ralfj.de>
Mon, 6 Jun 2022 16:35:48 +0000 (12:35 -0400)
tests/fail/transmute_fat1.rs
tests/fail/transmute_fat1.stderr

index 22fb4c6fdcc938ad0f72c45bef3635e3417cc1b7..8b351d3a09e9dd53cd8f2e3c5a28ade50fb6fb52 100644 (file)
@@ -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];
 }
index ea83dd442d2b38d225ad3ee5eca45d6a2b0ac242..cbfa8dff2a50c160601227ffcfa68b274b8267a5 100644 (file)
@@ -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