From 899d9b9bd505d5dbd39e22f1c6d04d516e75c769 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Thu, 12 Nov 2020 00:00:00 +0000 Subject: [PATCH] Fix test checking that into_boxed_slice does not panic The memory allocation in vec might panic in the case of capacity overflow. Move the allocation outside the function to fix the test. --- src/test/codegen/vec-shrink-panic.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/codegen/vec-shrink-panic.rs b/src/test/codegen/vec-shrink-panic.rs index 690c7e6d6ce..cee4128c650 100644 --- a/src/test/codegen/vec-shrink-panic.rs +++ b/src/test/codegen/vec-shrink-panic.rs @@ -15,9 +15,9 @@ pub fn shrink_to_fit(vec: &mut Vec) { // CHECK-LABEL: @issue71861 #[no_mangle] -pub fn issue71861(n: usize) -> Box<[u32]> { +pub fn issue71861(vec: Vec) -> Box<[u32]> { // CHECK-NOT: panic - vec![0; n].into_boxed_slice() + vec.into_boxed_slice() } // CHECK-LABEL: @issue75636