]> git.lizzy.rs Git - rust.git/commitdiff
explain what happens in a test
authorRalf Jung <post@ralfj.de>
Sun, 3 May 2020 10:24:40 +0000 (12:24 +0200)
committerRalf Jung <post@ralfj.de>
Sun, 3 May 2020 10:43:38 +0000 (12:43 +0200)
tests/run-pass/transmute_fat2.rs
tests/run-pass/transmute_fat2.stderr

index 8cbe9a099bb6c1240683a733db1bca8df6fe44da..c667aab6bb5fdbd1f478b6f9a3dc8ebd401e1cc8 100644 (file)
@@ -8,5 +8,6 @@ fn main() {
     let bad = unsafe {
         std::mem::transmute::<u64, &[u8]>(42)
     };
+    // This created a slice with length 0, so the following will fail the bounds check.
     bad[0];
 }
index 08849a5b517a4e9e3a9fa6dd90e9879f4dedfdbe..2539e58814d6b833010b59851b04516f1757cd33 100644 (file)
@@ -1 +1 @@
-thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', $DIR/transmute_fat2.rs:11:5
+thread 'main' panicked at 'index out of bounds: the len is 0 but the index is 0', $DIR/transmute_fat2.rs:12:5