diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2020-11-12 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2020-11-12 00:00:00 +0000 |
| commit | 899d9b9bd505d5dbd39e22f1c6d04d516e75c769 (patch) | |
| tree | bca5c14498bf5fe7aaa9ac9578307beadbf0d58b /src/test/codegen | |
| parent | 77180db6f81ffdacd14545f1df0a5db55dac1706 (diff) | |
| download | rust-899d9b9bd505d5dbd39e22f1c6d04d516e75c769.tar.gz rust-899d9b9bd505d5dbd39e22f1c6d04d516e75c769.zip | |
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.
Diffstat (limited to 'src/test/codegen')
| -rw-r--r-- | src/test/codegen/vec-shrink-panic.rs | 4 |
1 files 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<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 |
