diff options
| author | Ralf Jung <post@ralfj.de> | 2022-11-05 12:35:40 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2022-11-05 15:21:50 +0100 |
| commit | 83239c2c1ebed372dd34016bdd75d02e4429589d (patch) | |
| tree | f76015608b2a3fcdbdc5dc7f50049e089c6666d6 /library/alloc | |
| parent | 4492c029eff7b42e91e759576ab0c7ca88f873dc (diff) | |
| parent | 452cf4f7109f58433ac38be7d3da527408571054 (diff) | |
| download | rust-83239c2c1ebed372dd34016bdd75d02e4429589d.tar.gz rust-83239c2c1ebed372dd34016bdd75d02e4429589d.zip | |
Merge from rustc
Diffstat (limited to 'library/alloc')
| -rw-r--r-- | library/alloc/src/alloc.rs | 11 | ||||
| -rw-r--r-- | library/alloc/src/string.rs | 2 | ||||
| -rw-r--r-- | library/alloc/src/vec/mod.rs | 4 |
3 files changed, 8 insertions, 9 deletions
diff --git a/library/alloc/src/alloc.rs b/library/alloc/src/alloc.rs index 8187517ccfb..8c6663569a5 100644 --- a/library/alloc/src/alloc.rs +++ b/library/alloc/src/alloc.rs @@ -402,19 +402,18 @@ pub use std::alloc::handle_alloc_error; #[allow(unused_attributes)] #[unstable(feature = "alloc_internals", issue = "none")] pub mod __alloc_error_handler { - use crate::alloc::Layout; - - // called via generated `__rust_alloc_error_handler` - - // if there is no `#[alloc_error_handler]` + // called via generated `__rust_alloc_error_handler` if there is no + // `#[alloc_error_handler]`. #[rustc_std_internal_symbol] pub unsafe fn __rdl_oom(size: usize, _align: usize) -> ! { panic!("memory allocation of {size} bytes failed") } - // if there is an `#[alloc_error_handler]` + #[cfg(bootstrap)] #[rustc_std_internal_symbol] pub unsafe fn __rg_oom(size: usize, align: usize) -> ! { + use crate::alloc::Layout; + let layout = unsafe { Layout::from_size_align_unchecked(size, align) }; extern "Rust" { #[lang = "oom"] diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index c436adf7006..c9ba8921f6e 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -949,7 +949,7 @@ impl String { /// assert_eq!(string, "abcdecdeabecde"); /// ``` #[cfg(not(no_global_oom_handling))] - #[unstable(feature = "string_extend_from_within", issue = "none")] + #[unstable(feature = "string_extend_from_within", issue = "103806")] pub fn extend_from_within<R>(&mut self, src: R) where R: RangeBounds<usize>, diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index bbbdc3aa2a2..834c8f58cb2 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -2588,7 +2588,7 @@ impl<T: Clone, A: Allocator> ExtendFromWithinSpec for Vec<T, A> { let (this, spare, len) = unsafe { self.split_at_spare_mut_with_len() }; // SAFETY: - // - caller guaratees that src is a valid index + // - caller guarantees that src is a valid index let to_clone = unsafe { this.get_unchecked(src) }; iter::zip(to_clone, spare) @@ -2607,7 +2607,7 @@ impl<T: Copy, A: Allocator> ExtendFromWithinSpec for Vec<T, A> { let (init, spare) = self.split_at_spare_mut(); // SAFETY: - // - caller guaratees that `src` is a valid index + // - caller guarantees that `src` is a valid index let source = unsafe { init.get_unchecked(src) }; // SAFETY: |
