mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-12 20:16:49 +00:00
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:
parent
77180db6f8
commit
899d9b9bd5
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user