about summary refs log tree commit diff
path: root/library/alloc/tests/slice.rs
diff options
context:
space:
mode:
authorLukas Kalbertodt <lukas.kalbertodt@gmail.com>2020-07-19 14:04:30 +0200
committerLukas Kalbertodt <lukas.kalbertodt@gmail.com>2020-08-12 21:12:21 +0200
commitdb99f98c3ec7978f33ab00aa45d1517a4562cfb5 (patch)
tree536f6d69de7862521257306ccc3126763d76fc92 /library/alloc/tests/slice.rs
parent3df25ae186e89c885d9a71cd37fbd7a37e39fc85 (diff)
downloadrust-db99f98c3ec7978f33ab00aa45d1517a4562cfb5.tar.gz
rust-db99f98c3ec7978f33ab00aa45d1517a4562cfb5.zip
Put panic code path from `copy_from_slice` into cold function
The previous `assert_eq` generated quite some code, which is especially
problematic when this call is inlined. This commit also slightly
improves the panic message from:

  assertion failed: `(left == right)`
    left: `3`,
   right: `2`: destination and source slices have different lengths

...to:

  source slice length (2) does not match destination slice length (3)
Diffstat (limited to 'library/alloc/tests/slice.rs')
-rw-r--r--library/alloc/tests/slice.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/alloc/tests/slice.rs b/library/alloc/tests/slice.rs
index 147f7f7d0c7..3c7d57f8b32 100644
--- a/library/alloc/tests/slice.rs
+++ b/library/alloc/tests/slice.rs
@@ -1522,7 +1522,7 @@ fn test_copy_from_slice() {
 }
 
 #[test]
-#[should_panic(expected = "destination and source slices have different lengths")]
+#[should_panic(expected = "source slice length (4) does not match destination slice length (5)")]
 fn test_copy_from_slice_dst_longer() {
     let src = [0, 1, 2, 3];
     let mut dst = [0; 5];
@@ -1530,7 +1530,7 @@ fn test_copy_from_slice_dst_longer() {
 }
 
 #[test]
-#[should_panic(expected = "destination and source slices have different lengths")]
+#[should_panic(expected = "source slice length (4) does not match destination slice length (3)")]
 fn test_copy_from_slice_dst_shorter() {
     let src = [0, 1, 2, 3];
     let mut dst = [0; 3];