Bug 1817900 - Update bumpalo to 3.12.0. r=emilio,supply-chain-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D170426
This commit is contained in:
Mike Hommey 2023-02-23 01:00:56 +00:00
Родитель c609e49998
Коммит 6ed6bb2cfd
9 изменённых файлов: 75 добавлений и 13 удалений

4
Cargo.lock сгенерированный
Просмотреть файл

@ -606,9 +606,9 @@ dependencies = [
[[package]] [[package]]
name = "bumpalo" name = "bumpalo"
version = "3.11.1" version = "3.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535"
[[package]] [[package]]
name = "byteorder" name = "byteorder"

Просмотреть файл

@ -248,6 +248,11 @@ safe-to-run. If we needed safe-to-deploy for this in m-c I'd ask Nick to re-
certify this version, but we don't, so this is fine for now. certify this version, but we don't, so this is fine for now.
""" """
[[audits.bumpalo]]
who = "Mike Hommey <mh+mozilla@glandium.org>"
criteria = "safe-to-run"
delta = "3.11.1 -> 3.12.0"
[[audits.bytes]] [[audits.bytes]]
who = "Mike Hommey <mh+mozilla@glandium.org>" who = "Mike Hommey <mh+mozilla@glandium.org>"
criteria = "safe-to-deploy" criteria = "safe-to-deploy"

Просмотреть файл

@ -1 +1 @@
{"files":{"CHANGELOG.md":"d5e5dd1003e24fac2d0fa25beae573f3dcc374f0e124db1a8a5d8e40f044690f","Cargo.toml":"01e00b19c457f1a6674f6eac87f9383a954b5b72bfc22b020284be10f6d19eaf","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"65f94e99ddaf4f5d1782a6dae23f35d4293a9a01444a13135a6887017d353cee","README.md":"00c9224790248ec71d1505615429699fd685b0290a0c2b6d7c0df0214e7f80eb","src/alloc.rs":"ab0f23fa11c26efdd8f0596ebdf0e3faa75d097881fb59639b0fb23340c106bc","src/boxed.rs":"53c72a0f85f293307f468ec31c71b5d7667aee0f119f0a8dee2162b1f34d6561","src/collections/collect_in.rs":"0588a4ff3967a4323abb4218bbd615af4b123639ab4fae9130c6590c258b3d15","src/collections/mod.rs":"d58dc46eb4f9fcdde574f09bc5b8646f53e42d49c169561d98e0c23e5b36848a","src/collections/raw_vec.rs":"8829cc9a693fde38aa93e47a7bbbc2dac247620d07f60519f2e6cb44f5494bc5","src/collections/str/lossy.rs":"c5d62b16e01071e2a574ae41ef6693ad12f1e6c786c5d38f7a13ebd6cb23c088","src/collections/str/mod.rs":"d82a8bd417fbf52a589d89a16ea2a0ac4f6ac920c3976ab1f5b6ac0c8493c4f2","src/collections/string.rs":"5c43caaa5b3c305f7eae148513619829e35824e20818527422f86c0212ca632b","src/collections/vec.rs":"dfc39029b950ba9430c66f3de33a3484d85454c74b988b71c1d1806bf24d78bf","src/lib.rs":"1150c18aa21b7327aeed2c2a9d94957f0c1436a82440ced30a5e18dd794545e1"},"package":"572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba"} {"files":{"CHANGELOG.md":"8b5a7a49c720ba2678c07184f50b3608e2165fbf6704da494fba23c864e691e0","Cargo.toml":"8d5fd21d2b3ed1d7149e864d43f843fd469ccdcd9893ac3c2bef8518294a61dd","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"65f94e99ddaf4f5d1782a6dae23f35d4293a9a01444a13135a6887017d353cee","README.md":"00c9224790248ec71d1505615429699fd685b0290a0c2b6d7c0df0214e7f80eb","src/alloc.rs":"ab0f23fa11c26efdd8f0596ebdf0e3faa75d097881fb59639b0fb23340c106bc","src/boxed.rs":"5fc935f8e1a7bc1b8f6a39b2bcc4355a2be4743f2308fe3ffd557455a3a27cb2","src/collections/collect_in.rs":"0588a4ff3967a4323abb4218bbd615af4b123639ab4fae9130c6590c258b3d15","src/collections/mod.rs":"d58dc46eb4f9fcdde574f09bc5b8646f53e42d49c169561d98e0c23e5b36848a","src/collections/raw_vec.rs":"8829cc9a693fde38aa93e47a7bbbc2dac247620d07f60519f2e6cb44f5494bc5","src/collections/str/lossy.rs":"c5d62b16e01071e2a574ae41ef6693ad12f1e6c786c5d38f7a13ebd6cb23c088","src/collections/str/mod.rs":"d82a8bd417fbf52a589d89a16ea2a0ac4f6ac920c3976ab1f5b6ac0c8493c4f2","src/collections/string.rs":"388d39b999788baf5c14ccc3f5cb57da728060ea3295ddfc28f0f2e1ca5858ec","src/collections/vec.rs":"2eaf52e085e6d04767e97b224e82688dd0debd231c6536d6034f431376aa8bf0","src/lib.rs":"9eb2bdb8359b368a6f3091a66b3a5eb1216672ec1605cb18d5da28292c381cb9"},"package":"0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535"}

17
third_party/rust/bumpalo/CHANGELOG.md поставляемый
Просмотреть файл

@ -28,6 +28,23 @@ Released YYYY-MM-DD.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
## 3.12.0
Released 2023-01-17.
### Added
* Added the `bumpalo::boxed::Box::bump` and `bumpalo::collections::String::bump`
getters to get the underlying `Bump` that a string or box was allocated into.
### Changed
* Some uses of `Box` that MIRI did not previously consider as UB are now
reported as UB, and `bumpalo`'s internals have been adjusted to avoid the new
UB.
--------------------------------------------------------------------------------
## 3.11.1 ## 3.11.1
Released 2022-10-18. Released 2022-10-18.

3
third_party/rust/bumpalo/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package] [package]
edition = "2021" edition = "2021"
name = "bumpalo" name = "bumpalo"
version = "3.11.1" version = "3.12.0"
authors = ["Nick Fitzgerald <fitzgen@gmail.com>"] authors = ["Nick Fitzgerald <fitzgen@gmail.com>"]
exclude = [ exclude = [
"/.github/*", "/.github/*",
@ -31,7 +31,6 @@ categories = [
] ]
license = "MIT/Apache-2.0" license = "MIT/Apache-2.0"
repository = "https://github.com/fitzgen/bumpalo" repository = "https://github.com/fitzgen/bumpalo"
resolver = "2"
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true

15
third_party/rust/bumpalo/src/boxed.rs поставляемый
Просмотреть файл

@ -130,7 +130,7 @@ use {
future::Future, future::Future,
hash::{Hash, Hasher}, hash::{Hash, Hasher},
iter::FusedIterator, iter::FusedIterator,
mem, mem::ManuallyDrop,
ops::{Deref, DerefMut}, ops::{Deref, DerefMut},
pin::Pin, pin::Pin,
task::{Context, Poll}, task::{Context, Poll},
@ -280,9 +280,8 @@ impl<'a, T: ?Sized> Box<'a, T> {
/// ``` /// ```
#[inline] #[inline]
pub fn into_raw(b: Box<'a, T>) -> *mut T { pub fn into_raw(b: Box<'a, T>) -> *mut T {
let ptr = b.0 as *mut T; let mut b = ManuallyDrop::new(b);
mem::forget(b); b.deref_mut().0 as *mut T
ptr
} }
/// Consumes and leaks the `Box`, returning a mutable reference, /// Consumes and leaks the `Box`, returning a mutable reference,
@ -662,9 +661,9 @@ impl<'a, F: ?Sized + Future + Unpin> Future for Box<'a, F> {
/// This impl replaces unsize coercion. /// This impl replaces unsize coercion.
impl<'a, T, const N: usize> From<Box<'a, [T; N]>> for Box<'a, [T]> { impl<'a, T, const N: usize> From<Box<'a, [T; N]>> for Box<'a, [T]> {
fn from(mut arr: Box<'a, [T; N]>) -> Box<'a, [T]> { fn from(arr: Box<'a, [T; N]>) -> Box<'a, [T]> {
let mut arr = ManuallyDrop::new(arr);
let ptr = core::ptr::slice_from_raw_parts_mut(arr.as_mut_ptr(), N); let ptr = core::ptr::slice_from_raw_parts_mut(arr.as_mut_ptr(), N);
mem::forget(arr);
unsafe { Box::from_raw(ptr) } unsafe { Box::from_raw(ptr) }
} }
} }
@ -672,10 +671,10 @@ impl<'a, T, const N: usize> From<Box<'a, [T; N]>> for Box<'a, [T]> {
/// This impl replaces unsize coercion. /// This impl replaces unsize coercion.
impl<'a, T, const N: usize> TryFrom<Box<'a, [T]>> for Box<'a, [T; N]> { impl<'a, T, const N: usize> TryFrom<Box<'a, [T]>> for Box<'a, [T; N]> {
type Error = Box<'a, [T]>; type Error = Box<'a, [T]>;
fn try_from(mut slice: Box<'a, [T]>) -> Result<Box<'a, [T; N]>, Box<'a, [T]>> { fn try_from(slice: Box<'a, [T]>) -> Result<Box<'a, [T; N]>, Box<'a, [T]>> {
if slice.len() == N { if slice.len() == N {
let mut slice = ManuallyDrop::new(slice);
let ptr = slice.as_mut_ptr() as *mut [T; N]; let ptr = slice.as_mut_ptr() as *mut [T; N];
mem::forget(slice);
Ok(unsafe { Box::from_raw(ptr) }) Ok(unsafe { Box::from_raw(ptr) })
} else { } else {
Err(slice) Err(slice)

Просмотреть файл

@ -798,6 +798,24 @@ impl<'bump> String<'bump> {
String { vec: bytes } String { vec: bytes }
} }
/// Returns a shared reference to the allocator backing this `String`.
///
/// # Examples
///
/// ```
/// use bumpalo::{Bump, collections::String};
///
/// // uses the same allocator as the provided `String`
/// fn copy_string<'bump>(s: &String<'bump>) -> &'bump str {
/// s.bump().alloc_str(s.as_str())
/// }
/// ```
#[inline]
#[must_use]
pub fn bump(&self) -> &'bump Bump {
self.vec.bump()
}
/// Converts a `String` into a byte vector. /// Converts a `String` into a byte vector.
/// ///
/// This consumes the `String`, so we do not need to copy its contents. /// This consumes the `String`, so we do not need to copy its contents.

Просмотреть файл

@ -675,6 +675,26 @@ impl<'bump, T: 'bump> Vec<'bump, T> {
} }
} }
/// Returns a shared reference to the allocator backing this `Vec`.
///
/// # Examples
///
/// ```
/// use bumpalo::{Bump, collections::Vec};
///
/// // uses the same allocator as the provided `Vec`
/// fn add_strings<'bump>(vec: &mut Vec<'bump, &'bump str>) {
/// for string in ["foo", "bar", "baz"] {
/// vec.push(vec.bump().alloc_str(string));
/// }
/// }
/// ```
#[inline]
#[must_use]
pub fn bump(&self) -> &'bump Bump {
self.buf.bump()
}
/// Returns the number of elements the vector can hold without /// Returns the number of elements the vector can hold without
/// reallocating. /// reallocating.
/// ///

4
third_party/rust/bumpalo/src/lib.rs поставляемый
Просмотреть файл

@ -1678,6 +1678,10 @@ impl Bump {
/// on it only counting the sum of the sizes of the things /// on it only counting the sum of the sizes of the things
/// you've allocated in the arena. /// you've allocated in the arena.
/// ///
/// The allocated bytes do not include the size of bumpalo's metadata,
/// so the amount of memory requested from the Rust allocator is higher
/// than the returned value.
///
/// ## Example /// ## Example
/// ///
/// ``` /// ```