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.
This commit is contained in:
Tomasz Miąsko 2020-11-12 00:00:00 +00:00
parent 77180db6f8
commit 899d9b9bd5

View File

@ -15,9 +15,9 @@ pub fn shrink_to_fit(vec: &mut Vec<u32>) {
// CHECK-LABEL: @issue71861
#[no_mangle]
pub fn issue71861(n: usize) -> Box<[u32]> {
pub fn issue71861(vec: Vec<u32>) -> Box<[u32]> {
// CHECK-NOT: panic
vec![0; n].into_boxed_slice()
vec.into_boxed_slice()
}
// CHECK-LABEL: @issue75636