diff options
Diffstat (limited to 'vendor/semver/src/backport.rs')
-rw-r--r-- | vendor/semver/src/backport.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/vendor/semver/src/backport.rs b/vendor/semver/src/backport.rs index c7751b29f..4b67f56a5 100644 --- a/vendor/semver/src/backport.rs +++ b/vendor/semver/src/backport.rs @@ -22,7 +22,9 @@ pub(crate) mod alloc { pub mod alloc { use std::mem; + use std::process; + #[derive(Copy, Clone)] pub struct Layout { size: usize, } @@ -47,5 +49,12 @@ pub(crate) mod alloc { let len_u16 = (layout.size + 1) / 2; unsafe { Vec::from_raw_parts(ptr as *mut u16, 0, len_u16) }; } + + pub fn handle_alloc_error(_layout: Layout) -> ! { + // This is unreachable because the alloc implementation above never + // returns null; Vec::reserve_exact would already have called std's + // internal handle_alloc_error. + process::abort(); + } } } |