aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Vander Stoep <jeffv@google.com>2024-02-01 17:03:49 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2024-02-01 17:03:49 +0000
commitd4ba26a7dab3aa0a5c0c1ec1d35a2612dda3ca11 (patch)
tree4d50e39939b49d386aea8b61fea9ceecc37d644b
parente692dce24885ecfc22aa3682b4cf045bcb170c68 (diff)
parent58926982653b867ffb2100afe7ff637459f739fa (diff)
downloadcrossbeam-deque-d4ba26a7dab3aa0a5c0c1ec1d35a2612dda3ca11.tar.gz
Upgrade crossbeam-deque to 0.8.5 am: 5892698265HEADmastermainemu-34-2-dev
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/crossbeam-deque/+/2943885 Change-Id: I8259f13715a681694e22c0ec9cedd3cd203f945e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Android.bp35
-rw-r--r--CHANGELOG.md8
-rw-r--r--Cargo.toml15
-rw-r--r--Cargo.toml.orig21
-rw-r--r--METADATA25
-rw-r--r--README.md4
-rw-r--r--src/deque.rs29
-rw-r--r--src/lib.rs15
9 files changed, 62 insertions, 92 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index ee1b175..d18b334 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,6 +1,6 @@
{
"git": {
- "sha1": "721382b00b5dadd81954ed66764d547e2f1bb7a3"
+ "sha1": "9c3182abebb36bdc9446d75d4644190fef70fa01"
},
"path_in_vcs": "crossbeam-deque"
} \ No newline at end of file
diff --git a/Android.bp b/Android.bp
index e43b8b2..a5868e9 100644
--- a/Android.bp
+++ b/Android.bp
@@ -44,22 +44,19 @@ rust_test {
host_supported: true,
crate_name: "fifo",
cargo_env_compat: true,
- cargo_pkg_version: "0.8.3",
+ cargo_pkg_version: "0.8.5",
srcs: ["tests/fifo.rs"],
test_suites: ["general-tests"],
auto_gen_config: true,
test_options: {
unit_test: true,
},
- edition: "2018",
+ edition: "2021",
features: [
- "crossbeam-epoch",
- "crossbeam-utils",
"default",
"std",
],
rustlibs: [
- "libcfg_if",
"libcrossbeam_deque",
"libcrossbeam_epoch",
"libcrossbeam_utils",
@@ -72,22 +69,19 @@ rust_test {
host_supported: true,
crate_name: "injector",
cargo_env_compat: true,
- cargo_pkg_version: "0.8.3",
+ cargo_pkg_version: "0.8.5",
srcs: ["tests/injector.rs"],
test_suites: ["general-tests"],
auto_gen_config: true,
test_options: {
unit_test: true,
},
- edition: "2018",
+ edition: "2021",
features: [
- "crossbeam-epoch",
- "crossbeam-utils",
"default",
"std",
],
rustlibs: [
- "libcfg_if",
"libcrossbeam_deque",
"libcrossbeam_epoch",
"libcrossbeam_utils",
@@ -100,22 +94,19 @@ rust_test {
host_supported: true,
crate_name: "lifo",
cargo_env_compat: true,
- cargo_pkg_version: "0.8.3",
+ cargo_pkg_version: "0.8.5",
srcs: ["tests/lifo.rs"],
test_suites: ["general-tests"],
auto_gen_config: true,
test_options: {
unit_test: true,
},
- edition: "2018",
+ edition: "2021",
features: [
- "crossbeam-epoch",
- "crossbeam-utils",
"default",
"std",
],
rustlibs: [
- "libcfg_if",
"libcrossbeam_deque",
"libcrossbeam_epoch",
"libcrossbeam_utils",
@@ -128,22 +119,19 @@ rust_test {
host_supported: true,
crate_name: "steal",
cargo_env_compat: true,
- cargo_pkg_version: "0.8.3",
+ cargo_pkg_version: "0.8.5",
srcs: ["tests/steal.rs"],
test_suites: ["general-tests"],
auto_gen_config: true,
test_options: {
unit_test: true,
},
- edition: "2018",
+ edition: "2021",
features: [
- "crossbeam-epoch",
- "crossbeam-utils",
"default",
"std",
],
rustlibs: [
- "libcfg_if",
"libcrossbeam_deque",
"libcrossbeam_epoch",
"libcrossbeam_utils",
@@ -156,17 +144,14 @@ rust_library {
host_supported: true,
crate_name: "crossbeam_deque",
cargo_env_compat: true,
- cargo_pkg_version: "0.8.3",
+ cargo_pkg_version: "0.8.5",
srcs: ["src/lib.rs"],
- edition: "2018",
+ edition: "2021",
features: [
- "crossbeam-epoch",
- "crossbeam-utils",
"default",
"std",
],
rustlibs: [
- "libcfg_if",
"libcrossbeam_epoch",
"libcrossbeam_utils",
],
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0937d19..691d352 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,11 @@
+# Version 0.8.5
+
+- Remove dependency on `cfg-if`. (#1072)
+
+# Version 0.8.4
+
+- Bump the minimum supported Rust version to 1.61. (#1037)
+
# Version 0.8.3
- Add `Stealer::{steal_batch_with_limit, steal_batch_with_limit_and_pop}` methods. (#903)
diff --git a/Cargo.toml b/Cargo.toml
index ea7bab2..0fe1fed 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,10 +10,10 @@
# See Cargo.toml.orig for the original contents.
[package]
-edition = "2018"
-rust-version = "1.38"
+edition = "2021"
+rust-version = "1.61"
name = "crossbeam-deque"
-version = "0.8.3"
+version = "0.8.5"
description = "Concurrent work-stealing deque"
homepage = "https://github.com/crossbeam-rs/crossbeam/tree/master/crossbeam-deque"
readme = "README.md"
@@ -31,17 +31,12 @@ categories = [
license = "MIT OR Apache-2.0"
repository = "https://github.com/crossbeam-rs/crossbeam"
-[dependencies.cfg-if]
-version = "1"
-
[dependencies.crossbeam-epoch]
-version = "0.9"
-optional = true
+version = "0.9.17"
default-features = false
[dependencies.crossbeam-utils]
-version = "0.8"
-optional = true
+version = "0.8.18"
default-features = false
[dev-dependencies.rand]
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 805a7e0..7176817 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -4,9 +4,9 @@ name = "crossbeam-deque"
# - Update CHANGELOG.md
# - Update README.md
# - Create "crossbeam-deque-X.Y.Z" git tag
-version = "0.8.3"
-edition = "2018"
-rust-version = "1.38"
+version = "0.8.5"
+edition = "2021"
+rust-version = "1.61"
license = "MIT OR Apache-2.0"
repository = "https://github.com/crossbeam-rs/crossbeam"
homepage = "https://github.com/crossbeam-rs/crossbeam/tree/master/crossbeam-deque"
@@ -24,19 +24,8 @@ default = ["std"]
std = ["crossbeam-epoch/std", "crossbeam-utils/std"]
[dependencies]
-cfg-if = "1"
-
-[dependencies.crossbeam-epoch]
-version = "0.9"
-path = "../crossbeam-epoch"
-default-features = false
-optional = true
-
-[dependencies.crossbeam-utils]
-version = "0.8"
-path = "../crossbeam-utils"
-default-features = false
-optional = true
+crossbeam-epoch = { version = "0.9.17", path = "../crossbeam-epoch", default-features = false }
+crossbeam-utils = { version = "0.8.18", path = "../crossbeam-utils", default-features = false }
[dev-dependencies]
rand = "0.8"
diff --git a/METADATA b/METADATA
index 904cef6..3ede3e1 100644
--- a/METADATA
+++ b/METADATA
@@ -1,23 +1,20 @@
# This project was upgraded with external_updater.
-# Usage: tools/external_updater/updater.sh update rust/crates/crossbeam-deque
-# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md
+# Usage: tools/external_updater/updater.sh update external/rust/crates/crossbeam-deque
+# For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md
name: "crossbeam-deque"
description: "Concurrent work-stealing deque"
third_party {
- url {
- type: HOMEPAGE
- value: "https://crates.io/crates/crossbeam-deque"
- }
- url {
- type: ARCHIVE
- value: "https://static.crates.io/crates/crossbeam-deque/crossbeam-deque-0.8.3.crate"
- }
- version: "0.8.3"
license_type: NOTICE
last_upgrade_date {
- year: 2023
- month: 3
- day: 6
+ year: 2024
+ month: 2
+ day: 1
+ }
+ homepage: "https://crates.io/crates/crossbeam-deque"
+ identifier {
+ type: "Archive"
+ value: "https://static.crates.io/crates/crossbeam-deque/crossbeam-deque-0.8.5.crate"
+ version: "0.8.5"
}
}
diff --git a/README.md b/README.md
index 23c8794..4eae144 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ https://github.com/crossbeam-rs/crossbeam/tree/master/crossbeam-deque#license)
https://crates.io/crates/crossbeam-deque)
[![Documentation](https://docs.rs/crossbeam-deque/badge.svg)](
https://docs.rs/crossbeam-deque)
-[![Rust 1.38+](https://img.shields.io/badge/rust-1.38+-lightgray.svg)](
+[![Rust 1.61+](https://img.shields.io/badge/rust-1.61+-lightgray.svg)](
https://www.rust-lang.org)
[![chat](https://img.shields.io/discord/569610676205781012.svg?logo=discord)](https://discord.com/invite/JXYwgWZ)
@@ -28,7 +28,7 @@ crossbeam-deque = "0.8"
Crossbeam Deque supports stable Rust releases going back at least six months,
and every time the minimum supported Rust version is increased, a new minor
-version is released. Currently, the minimum supported Rust version is 1.38.
+version is released. Currently, the minimum supported Rust version is 1.61.
## License
diff --git a/src/deque.rs b/src/deque.rs
index 8afe15f..f02b03d 100644
--- a/src/deque.rs
+++ b/src/deque.rs
@@ -1,15 +1,15 @@
use std::cell::{Cell, UnsafeCell};
use std::cmp;
use std::fmt;
-use std::iter::FromIterator;
use std::marker::PhantomData;
-use std::mem::{self, ManuallyDrop, MaybeUninit};
+use std::mem::{self, MaybeUninit};
use std::ptr;
+use std::slice;
use std::sync::atomic::{self, AtomicIsize, AtomicPtr, AtomicUsize, Ordering};
use std::sync::Arc;
-use crate::epoch::{self, Atomic, Owned};
-use crate::utils::{Backoff, CachePadded};
+use crossbeam_epoch::{self as epoch, Atomic, Owned};
+use crossbeam_utils::{Backoff, CachePadded};
// Minimum buffer capacity.
const MIN_CAP: usize = 64;
@@ -38,15 +38,22 @@ impl<T> Buffer<T> {
fn alloc(cap: usize) -> Buffer<T> {
debug_assert_eq!(cap, cap.next_power_of_two());
- let mut v = ManuallyDrop::new(Vec::with_capacity(cap));
- let ptr = v.as_mut_ptr();
+ let ptr = Box::into_raw(
+ (0..cap)
+ .map(|_| MaybeUninit::<T>::uninit())
+ .collect::<Box<[_]>>(),
+ )
+ .cast::<T>();
Buffer { ptr, cap }
}
/// Deallocates the buffer.
unsafe fn dealloc(self) {
- drop(Vec::from_raw_parts(self.ptr, 0, self.cap));
+ drop(Box::from_raw(slice::from_raw_parts_mut(
+ self.ptr.cast::<MaybeUninit<T>>(),
+ self.cap,
+ )));
}
/// Returns a pointer to the task at the specified `index`.
@@ -80,10 +87,7 @@ impl<T> Buffer<T> {
impl<T> Clone for Buffer<T> {
fn clone(&self) -> Buffer<T> {
- Buffer {
- ptr: self.ptr,
- cap: self.cap,
- }
+ *self
}
}
@@ -1990,8 +1994,7 @@ impl<T> Drop for Injector<T> {
if offset < BLOCK_CAP {
// Drop the task in the slot.
let slot = (*block).slots.get_unchecked(offset);
- let p = &mut *slot.task.get();
- p.as_mut_ptr().drop_in_place();
+ (*slot.task.get()).assume_init_drop();
} else {
// Deallocate the block and move to the next one.
let next = *(*block).next.get_mut();
diff --git a/src/lib.rs b/src/lib.rs
index 16bc728..a5745d9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -97,14 +97,7 @@
)]
#![cfg_attr(not(feature = "std"), no_std)]
-use cfg_if::cfg_if;
-
-cfg_if! {
- if #[cfg(feature = "std")] {
- use crossbeam_epoch as epoch;
- use crossbeam_utils as utils;
-
- mod deque;
- pub use crate::deque::{Injector, Steal, Stealer, Worker};
- }
-}
+#[cfg(feature = "std")]
+mod deque;
+#[cfg(feature = "std")]
+pub use crate::deque::{Injector, Steal, Stealer, Worker};