aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-15 21:43:44 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-15 21:43:44 +0000
commitc49ce2e6c8e4696f4a14076885289edeec78d594 (patch)
treeb2f6376d7ac86207929c4a9b338b4313e06a8585
parent8e004e857158abd495cfacdc0cd905ef2e3ae45f (diff)
parent746ceecf7cf7cd97801582f876a68ba474fe6e95 (diff)
downloadcrossbeam-epoch-aml_tz3_314012070.tar.gz
Change-Id: Iebf268421d99f2c160c7438c5511a259d95220a7
-rw-r--r--.cargo_vcs_info.json7
-rw-r--r--Android.bp72
-rw-r--r--CHANGELOG.md19
-rw-r--r--Cargo.lock242
-rw-r--r--Cargo.toml50
-rw-r--r--Cargo.toml.orig24
-rw-r--r--METADATA8
-rw-r--r--README.md2
-rw-r--r--TEST_MAPPING24
-rw-r--r--benches/pin.rs2
-rw-r--r--build.rs41
-rw-r--r--cargo2android.json5
-rw-r--r--no_atomic.rs71
-rw-r--r--src/atomic.rs97
-rw-r--r--src/collector.rs30
-rw-r--r--src/deferred.rs11
-rw-r--r--src/internal.rs6
-rw-r--r--src/lib.rs11
-rw-r--r--src/sync/queue.rs7
19 files changed, 166 insertions, 563 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 0a948d5..1d9c34d 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,6 +1,5 @@
{
"git": {
- "sha1": "2988f873f87d2263a7fd2b9465fb9c28f43a6490"
- },
- "path_in_vcs": "crossbeam-epoch"
-} \ No newline at end of file
+ "sha1": "d841a2028dc72b4e09739116f07e865db60f3690"
+ }
+}
diff --git a/Android.bp b/Android.bp
index bd3c978..bba5b1e 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,4 +1,4 @@
-// This file is generated by cargo2android.py --config cargo2android.json.
+// This file is generated by cargo2android.py --run --device --dependencies --tests.
// Do not modify this file as changes will be overridden on upgrade.
package {
@@ -39,18 +39,48 @@ license {
],
}
-rust_test {
- name: "crossbeam-epoch_test_src_lib",
- host_supported: true,
+rust_defaults {
+ name: "crossbeam-epoch_defaults",
crate_name: "crossbeam_epoch",
- cargo_env_compat: true,
- cargo_pkg_version: "0.9.7",
srcs: ["src/lib.rs"],
test_suites: ["general-tests"],
auto_gen_config: true,
+ edition: "2018",
+ features: [
+ "alloc",
+ "default",
+ "lazy_static",
+ "std",
+ ],
+ rustlibs: [
+ "libcfg_if",
+ "libcrossbeam_utils",
+ "liblazy_static",
+ "libmemoffset",
+ "librand",
+ "libscopeguard",
+ ],
+}
+
+rust_test_host {
+ name: "crossbeam-epoch_host_test_src_lib",
+ defaults: ["crossbeam-epoch_defaults"],
test_options: {
unit_test: true,
},
+}
+
+rust_test {
+ name: "crossbeam-epoch_device_test_src_lib",
+ defaults: ["crossbeam-epoch_defaults"],
+}
+
+rust_defaults {
+ name: "crossbeam-epoch_defaults_loom",
+ crate_name: "loom",
+ srcs: ["tests/loom.rs"],
+ test_suites: ["general-tests"],
+ auto_gen_config: true,
edition: "2018",
features: [
"alloc",
@@ -60,6 +90,7 @@ rust_test {
],
rustlibs: [
"libcfg_if",
+ "libcrossbeam_epoch",
"libcrossbeam_utils",
"liblazy_static",
"libmemoffset",
@@ -68,12 +99,23 @@ rust_test {
],
}
+rust_test_host {
+ name: "crossbeam-epoch_host_test_tests_loom",
+ defaults: ["crossbeam-epoch_defaults_loom"],
+ test_options: {
+ unit_test: true,
+ },
+}
+
+rust_test {
+ name: "crossbeam-epoch_device_test_tests_loom",
+ defaults: ["crossbeam-epoch_defaults_loom"],
+}
+
rust_library {
name: "libcrossbeam_epoch",
host_supported: true,
crate_name: "crossbeam_epoch",
- cargo_env_compat: true,
- cargo_pkg_version: "0.9.7",
srcs: ["src/lib.rs"],
edition: "2018",
features: [
@@ -90,3 +132,17 @@ rust_library {
"libscopeguard",
],
}
+
+// dependent_library ["feature_list"]
+// autocfg-1.0.1
+// cfg-if-1.0.0
+// crossbeam-utils-0.8.3 "lazy_static,std"
+// getrandom-0.2.2 "std"
+// lazy_static-1.4.0
+// libc-0.2.92
+// memoffset-0.6.3 "default"
+// ppv-lite86-0.2.10 "simd,std"
+// rand-0.8.3 "alloc,default,getrandom,libc,rand_chacha,rand_hc,std,std_rng"
+// rand_chacha-0.3.0 "std"
+// rand_core-0.6.2 "alloc,getrandom,std"
+// scopeguard-1.1.0
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 8c158f6..0f30b70 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,22 +1,3 @@
-# Version 0.9.7
-
-- Fix Miri error when `-Zmiri-check-number-validity` is enabled. (#779)
-
-# Version 0.9.6
-
-- Add `Atomic::fetch_update`. (#706)
-
-# Version 0.9.5
-
-- Fix UB in `Pointable` impl of `[MaybeUninit<T>]`. (#694)
-- Support targets that do not have atomic CAS on stable Rust. (#698)
-- Fix breakage with nightly feature due to rust-lang/rust#84510. (#692)
-
-# Version 0.9.4
-
-- Fix UB in `<[MaybeUninit<T>] as Pointable>::init` when global allocator failed allocation. (#690)
-- Bump `loom` dependency to version 0.5. (#686)
-
# Version 0.9.3
- Make `loom` dependency optional. (#666)
diff --git a/Cargo.lock b/Cargo.lock
index ded699e..fd37e90 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3,15 +3,6 @@
version = 3
[[package]]
-name = "ansi_term"
-version = "0.12.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
-dependencies = [
- "winapi",
-]
-
-[[package]]
name = "autocfg"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -19,9 +10,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "cc"
-version = "1.0.72"
+version = "1.0.67"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee"
+checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd"
[[package]]
name = "cfg-if"
@@ -31,13 +22,13 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "const_fn"
-version = "0.4.9"
+version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935"
+checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6"
[[package]]
name = "crossbeam-epoch"
-version = "0.9.7"
+version = "0.9.3"
dependencies = [
"cfg-if",
"const_fn",
@@ -51,10 +42,11 @@ dependencies = [
[[package]]
name = "crossbeam-utils"
-version = "0.8.7"
+version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b5e5bed1f1c269533fa816a0a5492b3545209a205ca1a54842be180eb63a16a6"
+checksum = "e7e9d99fa91428effe99c5c6d4634cdeba32b8cf784fc428a2a687f61a952c49"
dependencies = [
+ "autocfg",
"cfg-if",
"lazy_static",
"loom",
@@ -62,9 +54,9 @@ dependencies = [
[[package]]
name = "generator"
-version = "0.7.0"
+version = "0.6.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c1d9279ca822891c1a4dae06d185612cf8fc6acfe5dff37781b41297811b12ee"
+checksum = "a9fed24fd1e18827652b4d55652899a1e9da8e54d91624dc3437a5bc3a9f9a9c"
dependencies = [
"cc",
"libc",
@@ -75,9 +67,9 @@ dependencies = [
[[package]]
name = "getrandom"
-version = "0.2.4"
+version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c"
+checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8"
dependencies = [
"cfg-if",
"libc",
@@ -92,9 +84,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
-version = "0.2.117"
+version = "0.2.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e74d72e0f9b65b5b4ca49a346af3976df0f9c61d550727f349ecd559f251a26c"
+checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c"
[[package]]
name = "log"
@@ -107,76 +99,35 @@ dependencies = [
[[package]]
name = "loom"
-version = "0.5.4"
+version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "edc5c7d328e32cc4954e8e01193d7f0ef5ab257b5090b70a964e099a36034309"
+checksum = "d44c73b4636e497b4917eb21c33539efa3816741a2d3ff26c6316f1b529481a4"
dependencies = [
"cfg-if",
"generator",
"scoped-tls",
- "tracing",
- "tracing-subscriber",
-]
-
-[[package]]
-name = "matchers"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
-dependencies = [
- "regex-automata",
]
[[package]]
name = "memoffset"
-version = "0.6.5"
+version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
+checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87"
dependencies = [
"autocfg",
]
[[package]]
-name = "once_cell"
-version = "1.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
-
-[[package]]
-name = "pin-project-lite"
-version = "0.2.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c"
-
-[[package]]
name = "ppv-lite86"
-version = "0.2.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
-
-[[package]]
-name = "proc-macro2"
-version = "1.0.36"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
-dependencies = [
- "unicode-xid",
-]
-
-[[package]]
-name = "quote"
-version = "1.0.15"
+version = "0.2.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145"
-dependencies = [
- "proc-macro2",
-]
+checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857"
[[package]]
name = "rand"
-version = "0.8.4"
+version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
+checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e"
dependencies = [
"libc",
"rand_chacha",
@@ -186,9 +137,9 @@ dependencies = [
[[package]]
name = "rand_chacha"
-version = "0.3.1"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
+checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d"
dependencies = [
"ppv-lite86",
"rand_core",
@@ -196,51 +147,27 @@ dependencies = [
[[package]]
name = "rand_core"
-version = "0.6.3"
+version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
+checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7"
dependencies = [
"getrandom",
]
[[package]]
name = "rand_hc"
-version = "0.3.1"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7"
+checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73"
dependencies = [
"rand_core",
]
[[package]]
-name = "regex"
-version = "1.5.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
-dependencies = [
- "regex-syntax",
-]
-
-[[package]]
-name = "regex-automata"
-version = "0.1.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
-dependencies = [
- "regex-syntax",
-]
-
-[[package]]
-name = "regex-syntax"
-version = "0.6.25"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
-
-[[package]]
name = "rustversion"
-version = "1.0.6"
+version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f"
+checksum = "cb5d2a036dc6d2d8fd16fde3498b04306e29bd193bf306a57427019b823d5acd"
[[package]]
name = "scoped-tls"
@@ -255,115 +182,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
-name = "sharded-slab"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31"
-dependencies = [
- "lazy_static",
-]
-
-[[package]]
-name = "smallvec"
-version = "1.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83"
-
-[[package]]
-name = "syn"
-version = "1.0.86"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b"
-dependencies = [
- "proc-macro2",
- "quote",
- "unicode-xid",
-]
-
-[[package]]
-name = "thread_local"
-version = "1.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180"
-dependencies = [
- "once_cell",
-]
-
-[[package]]
-name = "tracing"
-version = "0.1.30"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2d8d93354fe2a8e50d5953f5ae2e47a3fc2ef03292e7ea46e3cc38f549525fb9"
-dependencies = [
- "cfg-if",
- "pin-project-lite",
- "tracing-attributes",
- "tracing-core",
-]
-
-[[package]]
-name = "tracing-attributes"
-version = "0.1.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8276d9a4a3a558d7b7ad5303ad50b53d58264641b82914b7ada36bd762e7a716"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "tracing-core"
-version = "0.1.22"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "03cfcb51380632a72d3111cb8d3447a8d908e577d31beeac006f836383d29a23"
-dependencies = [
- "lazy_static",
- "valuable",
-]
-
-[[package]]
-name = "tracing-log"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3"
-dependencies = [
- "lazy_static",
- "log",
- "tracing-core",
-]
-
-[[package]]
-name = "tracing-subscriber"
-version = "0.3.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "74786ce43333fcf51efe947aed9718fbe46d5c7328ec3f1029e818083966d9aa"
-dependencies = [
- "ansi_term",
- "lazy_static",
- "matchers",
- "regex",
- "sharded-slab",
- "smallvec",
- "thread_local",
- "tracing",
- "tracing-core",
- "tracing-log",
-]
-
-[[package]]
-name = "unicode-xid"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
-
-[[package]]
-name = "valuable"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
-
-[[package]]
name = "wasi"
version = "0.10.2+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index abacbe2..2d7eb00 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,33 +3,25 @@
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
-# to registry (e.g., crates.io) dependencies.
+# to registry (e.g., crates.io) dependencies
#
-# If you are reading this file be aware that the original Cargo.toml
-# will likely look very different (and much more reasonable).
-# See Cargo.toml.orig for the original contents.
+# If you believe there's an error in this file please file an
+# issue against the rust-lang/cargo repository. If you're
+# editing this file be aware that the upstream Cargo.toml
+# will likely look very different (and much more reasonable)
[package]
edition = "2018"
-rust-version = "1.36"
name = "crossbeam-epoch"
-version = "0.9.7"
+version = "0.9.3"
+authors = ["The Crossbeam Project Developers"]
description = "Epoch-based garbage collection"
homepage = "https://github.com/crossbeam-rs/crossbeam/tree/master/crossbeam-epoch"
-keywords = [
- "lock-free",
- "rcu",
- "atomic",
- "garbage",
-]
-categories = [
- "concurrency",
- "memory-management",
- "no-std",
-]
+documentation = "https://docs.rs/crossbeam-epoch"
+keywords = ["lock-free", "rcu", "atomic", "garbage"]
+categories = ["concurrency", "memory-management", "no-std"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/crossbeam-rs/crossbeam"
-
[dependencies.cfg-if]
version = "1"
@@ -38,7 +30,7 @@ version = "0.4.4"
optional = true
[dependencies.crossbeam-utils]
-version = "0.8.5"
+version = "0.8.3"
default-features = false
[dependencies.lazy_static]
@@ -51,28 +43,16 @@ version = "0.6"
[dependencies.scopeguard]
version = "1.1.0"
default-features = false
-
[dev-dependencies.rand]
version = "0.8"
[features]
alloc = []
default = ["std"]
-loom = [
- "loom-crate",
- "crossbeam-utils/loom",
-]
-nightly = [
- "crossbeam-utils/nightly",
- "const_fn",
-]
-std = [
- "alloc",
- "crossbeam-utils/std",
- "lazy_static",
-]
-
+loom = ["loom-crate", "crossbeam-utils/loom"]
+nightly = ["crossbeam-utils/nightly", "const_fn"]
+std = ["alloc", "crossbeam-utils/std", "lazy_static"]
[target."cfg(crossbeam_loom)".dependencies.loom-crate]
-version = "0.5"
+version = "0.4"
optional = true
package = "loom"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index bdb095a..8961f25 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -4,12 +4,13 @@ name = "crossbeam-epoch"
# - Update CHANGELOG.md
# - Update README.md
# - Create "crossbeam-epoch-X.Y.Z" git tag
-version = "0.9.7"
+version = "0.9.3"
+authors = ["The Crossbeam Project Developers"]
edition = "2018"
-rust-version = "1.36"
license = "MIT OR Apache-2.0"
repository = "https://github.com/crossbeam-rs/crossbeam"
homepage = "https://github.com/crossbeam-rs/crossbeam/tree/master/crossbeam-epoch"
+documentation = "https://docs.rs/crossbeam-epoch"
description = "Epoch-based garbage collection"
keywords = ["lock-free", "rcu", "atomic", "garbage"]
categories = ["concurrency", "memory-management", "no-std"]
@@ -23,21 +24,18 @@ std = ["alloc", "crossbeam-utils/std", "lazy_static"]
# Enable to use APIs that require `alloc`.
# This is enabled by default and also enabled if the `std` feature is enabled.
-#
-# NOTE: Disabling both `std` *and* `alloc` features is not supported yet.
alloc = []
# Enable to use of unstable functionality.
# This is disabled by default and requires recent nightly compiler.
-#
-# NOTE: This feature is outside of the normal semver guarantees and minor or
-# patch versions of crossbeam may make breaking changes to them at any time.
+# Note that this is outside of the normal semver guarantees and minor versions
+# of crossbeam may make breaking changes to them at any time.
nightly = ["crossbeam-utils/nightly", "const_fn"]
# Enable the use of loom for concurrency testing.
#
-# NOTE: This feature is outside of the normal semver guarantees and minor or
-# patch versions of crossbeam may make breaking changes to them at any time.
+# This configuration option is outside of the normal semver guarantees: minor
+# versions of crossbeam may make breaking changes to it at any time.
loom = ["loom-crate", "crossbeam-utils/loom"]
[dependencies]
@@ -47,13 +45,13 @@ memoffset = "0.6"
# Enable the use of loom for concurrency testing.
#
-# NOTE: This feature is outside of the normal semver guarantees and minor or
-# patch versions of crossbeam may make breaking changes to them at any time.
+# This configuration option is outside of the normal semver guarantees: minor
+# versions of crossbeam may make breaking changes to it at any time.
[target.'cfg(crossbeam_loom)'.dependencies]
-loom-crate = { package = "loom", version = "0.5", optional = true }
+loom-crate = { package = "loom", version = "0.4", optional = true }
[dependencies.crossbeam-utils]
-version = "0.8.5"
+version = "0.8.3"
path = "../crossbeam-utils"
default-features = false
diff --git a/METADATA b/METADATA
index 1377873..fc37c40 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/crossbeam-epoch/crossbeam-epoch-0.9.7.crate"
+ value: "https://static.crates.io/crates/crossbeam-epoch/crossbeam-epoch-0.9.3.crate"
}
- version: "0.9.7"
+ version: "0.9.3"
license_type: NOTICE
last_upgrade_date {
- year: 2022
- month: 3
+ year: 2021
+ month: 4
day: 1
}
}
diff --git a/README.md b/README.md
index eb33bad..c8ebd87 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ https://crates.io/crates/crossbeam-epoch)
https://docs.rs/crossbeam-epoch)
[![Rust 1.36+](https://img.shields.io/badge/rust-1.36+-lightgray.svg)](
https://www.rust-lang.org)
-[![chat](https://img.shields.io/discord/569610676205781012.svg?logo=discord)](https://discord.com/invite/JXYwgWZ)
+[![chat](https://img.shields.io/discord/569610676205781012.svg?logo=discord)](https://discord.gg/BBYwKq)
This crate provides epoch-based garbage collection for building concurrent data structures.
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 161921c..25a9cdc 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -1,30 +1,8 @@
// Generated by update_crate_tests.py for tests that depend on this crate.
{
- "imports": [
- {
- "path": "external/rust/crates/base64"
- },
- {
- "path": "external/rust/crates/crossbeam-deque"
- },
- {
- "path": "external/rust/crates/tinytemplate"
- },
- {
- "path": "external/rust/crates/tinyvec"
- },
- {
- "path": "external/rust/crates/unicode-xid"
- }
- ],
"presubmit": [
{
- "name": "crossbeam-epoch_test_src_lib"
- }
- ],
- "presubmit-rust": [
- {
- "name": "crossbeam-epoch_test_src_lib"
+ "name": "crossbeam-epoch_device_test_src_lib"
}
]
}
diff --git a/benches/pin.rs b/benches/pin.rs
index 8bf87e9..0dff4c5 100644
--- a/benches/pin.rs
+++ b/benches/pin.rs
@@ -8,7 +8,7 @@ use test::Bencher;
#[bench]
fn single_pin(b: &mut Bencher) {
- b.iter(epoch::pin);
+ b.iter(|| epoch::pin());
}
#[bench]
diff --git a/build.rs b/build.rs
deleted file mode 100644
index 587e058..0000000
--- a/build.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-// The rustc-cfg listed below are considered public API, but it is *unstable*
-// and outside of the normal semver guarantees:
-//
-// - `crossbeam_no_atomic_cas`
-// Assume the target does *not* support atomic CAS operations.
-// This is usually detected automatically by the build script, but you may
-// need to enable it manually when building for custom targets or using
-// non-cargo build systems that don't run the build script.
-//
-// With the exceptions mentioned above, the rustc-cfg emitted by the build
-// script are *not* public API.
-
-#![warn(rust_2018_idioms)]
-
-use std::env;
-
-include!("no_atomic.rs");
-
-fn main() {
- let target = match env::var("TARGET") {
- Ok(target) => target,
- Err(e) => {
- println!(
- "cargo:warning={}: unable to get TARGET environment variable: {}",
- env!("CARGO_PKG_NAME"),
- e
- );
- return;
- }
- };
-
- // Note that this is `no_*`, not `has_*`. This allows treating
- // `cfg(target_has_atomic = "ptr")` as true when the build script doesn't
- // run. This is needed for compatibility with non-cargo build systems that
- // don't run the build script.
- if NO_ATOMIC_CAS.contains(&&*target) {
- println!("cargo:rustc-cfg=crossbeam_no_atomic_cas");
- }
-
- println!("cargo:rerun-if-changed=no_atomic.rs");
-}
diff --git a/cargo2android.json b/cargo2android.json
deleted file mode 100644
index d36fb44..0000000
--- a/cargo2android.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "device": true,
- "run": true,
- "tests": true
-} \ No newline at end of file
diff --git a/no_atomic.rs b/no_atomic.rs
deleted file mode 100644
index 90ac60a..0000000
--- a/no_atomic.rs
+++ /dev/null
@@ -1,71 +0,0 @@
-// This file is @generated by no_atomic.sh.
-// It is not intended for manual editing.
-
-const NO_ATOMIC_CAS: &[&str] = &[
- "avr-unknown-gnu-atmega328",
- "bpfeb-unknown-none",
- "bpfel-unknown-none",
- "msp430-none-elf",
- "riscv32i-unknown-none-elf",
- "riscv32imc-unknown-none-elf",
- "thumbv4t-none-eabi",
- "thumbv6m-none-eabi",
-];
-
-#[allow(dead_code)] // Only crossbeam-utils uses this.
-const NO_ATOMIC_64: &[&str] = &[
- "arm-linux-androideabi",
- "armebv7r-none-eabi",
- "armebv7r-none-eabihf",
- "armv4t-unknown-linux-gnueabi",
- "armv5te-unknown-linux-gnueabi",
- "armv5te-unknown-linux-musleabi",
- "armv5te-unknown-linux-uclibceabi",
- "armv6k-nintendo-3ds",
- "armv7r-none-eabi",
- "armv7r-none-eabihf",
- "avr-unknown-gnu-atmega328",
- "hexagon-unknown-linux-musl",
- "m68k-unknown-linux-gnu",
- "mips-unknown-linux-gnu",
- "mips-unknown-linux-musl",
- "mips-unknown-linux-uclibc",
- "mipsel-sony-psp",
- "mipsel-unknown-linux-gnu",
- "mipsel-unknown-linux-musl",
- "mipsel-unknown-linux-uclibc",
- "mipsel-unknown-none",
- "mipsisa32r6-unknown-linux-gnu",
- "mipsisa32r6el-unknown-linux-gnu",
- "msp430-none-elf",
- "powerpc-unknown-freebsd",
- "powerpc-unknown-linux-gnu",
- "powerpc-unknown-linux-gnuspe",
- "powerpc-unknown-linux-musl",
- "powerpc-unknown-netbsd",
- "powerpc-unknown-openbsd",
- "powerpc-wrs-vxworks",
- "powerpc-wrs-vxworks-spe",
- "riscv32gc-unknown-linux-gnu",
- "riscv32gc-unknown-linux-musl",
- "riscv32i-unknown-none-elf",
- "riscv32imac-unknown-none-elf",
- "riscv32imc-esp-espidf",
- "riscv32imc-unknown-none-elf",
- "thumbv4t-none-eabi",
- "thumbv6m-none-eabi",
- "thumbv7em-none-eabi",
- "thumbv7em-none-eabihf",
- "thumbv7m-none-eabi",
- "thumbv8m.base-none-eabi",
- "thumbv8m.main-none-eabi",
- "thumbv8m.main-none-eabihf",
-];
-
-#[allow(dead_code)] // Only crossbeam-utils uses this.
-const NO_ATOMIC: &[&str] = &[
- "avr-unknown-gnu-atmega328",
- "msp430-none-elf",
- "riscv32i-unknown-none-elf",
- "riscv32imc-unknown-none-elf",
-];
diff --git a/src/atomic.rs b/src/atomic.rs
index f727387..e4ca23f 100644
--- a/src/atomic.rs
+++ b/src/atomic.rs
@@ -238,8 +238,7 @@ impl<T> Pointable for T {
// [`alloc::alloc::Layout::extend`] instead.
#[repr(C)]
struct Array<T> {
- /// The number of elements (not the number of bytes).
- len: usize,
+ size: usize,
elements: [MaybeUninit<T>; 0],
}
@@ -248,31 +247,28 @@ impl<T> Pointable for [MaybeUninit<T>] {
type Init = usize;
- unsafe fn init(len: Self::Init) -> usize {
- let size = mem::size_of::<Array<T>>() + mem::size_of::<MaybeUninit<T>>() * len;
+ unsafe fn init(size: Self::Init) -> usize {
+ let size = mem::size_of::<Array<T>>() + mem::size_of::<MaybeUninit<T>>() * size;
let align = mem::align_of::<Array<T>>();
let layout = alloc::Layout::from_size_align(size, align).unwrap();
let ptr = alloc::alloc(layout) as *mut Array<T>;
- if ptr.is_null() {
- alloc::handle_alloc_error(layout);
- }
- (*ptr).len = len;
+ (*ptr).size = size;
ptr as usize
}
unsafe fn deref<'a>(ptr: usize) -> &'a Self {
let array = &*(ptr as *const Array<T>);
- slice::from_raw_parts(array.elements.as_ptr() as *const _, array.len)
+ slice::from_raw_parts(array.elements.as_ptr() as *const _, array.size)
}
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut Self {
let array = &*(ptr as *mut Array<T>);
- slice::from_raw_parts_mut(array.elements.as_ptr() as *mut _, array.len)
+ slice::from_raw_parts_mut(array.elements.as_ptr() as *mut _, array.size)
}
unsafe fn drop(ptr: usize) {
let array = &*(ptr as *mut Array<T>);
- let size = mem::size_of::<Array<T>>() + mem::size_of::<MaybeUninit<T>>() * array.len;
+ let size = mem::size_of::<Array<T>>() + mem::size_of::<MaybeUninit<T>>() * array.size;
let align = mem::align_of::<Array<T>>();
let layout = alloc::Layout::from_size_align(size, align).unwrap();
alloc::dealloc(ptr as *mut u8, layout);
@@ -562,65 +558,6 @@ impl<T: ?Sized + Pointable> Atomic<T> {
})
}
- /// Fetches the pointer, and then applies a function to it that returns a new value.
- /// Returns a `Result` of `Ok(previous_value)` if the function returned `Some`, else `Err(_)`.
- ///
- /// Note that the given function may be called multiple times if the value has been changed by
- /// other threads in the meantime, as long as the function returns `Some(_)`, but the function
- /// will have been applied only once to the stored value.
- ///
- /// `fetch_update` takes two [`Ordering`] arguments to describe the memory
- /// ordering of this operation. The first describes the required ordering for
- /// when the operation finally succeeds while the second describes the
- /// required ordering for loads. These correspond to the success and failure
- /// orderings of [`Atomic::compare_exchange`] respectively.
- ///
- /// Using [`Acquire`] as success ordering makes the store part of this
- /// operation [`Relaxed`], and using [`Release`] makes the final successful
- /// load [`Relaxed`]. The (failed) load ordering can only be [`SeqCst`],
- /// [`Acquire`] or [`Relaxed`] and must be equivalent to or weaker than the
- /// success ordering.
- ///
- /// [`Relaxed`]: Ordering::Relaxed
- /// [`Acquire`]: Ordering::Acquire
- /// [`Release`]: Ordering::Release
- /// [`SeqCst`]: Ordering::SeqCst
- ///
- /// # Examples
- ///
- /// ```
- /// use crossbeam_epoch::{self as epoch, Atomic};
- /// use std::sync::atomic::Ordering::SeqCst;
- ///
- /// let a = Atomic::new(1234);
- /// let guard = &epoch::pin();
- ///
- /// let res1 = a.fetch_update(SeqCst, SeqCst, guard, |x| Some(x.with_tag(1)));
- /// assert!(res1.is_ok());
- ///
- /// let res2 = a.fetch_update(SeqCst, SeqCst, guard, |x| None);
- /// assert!(res2.is_err());
- /// ```
- pub fn fetch_update<'g, F>(
- &self,
- set_order: Ordering,
- fail_order: Ordering,
- guard: &'g Guard,
- mut func: F,
- ) -> Result<Shared<'g, T>, Shared<'g, T>>
- where
- F: FnMut(Shared<'g, T>) -> Option<Shared<'g, T>>,
- {
- let mut prev = self.load(fail_order, guard);
- while let Some(next) = func(prev) {
- match self.compare_exchange_weak(prev, next, set_order, fail_order, guard) {
- Ok(shared) => return Ok(shared),
- Err(next_prev) => prev = next_prev.current,
- }
- }
- Err(prev)
- }
-
/// Stores the pointer `new` (either `Shared` or `Owned`) into the atomic pointer if the current
/// value is the same as `current`. The tag is also taken into account, so two pointers to the
/// same object, but with different tags, will not be considered equal.
@@ -1284,6 +1221,7 @@ impl<'g, T> Shared<'g, T> {
/// let p = a.load(SeqCst, guard);
/// assert_eq!(p.as_raw(), raw);
/// ```
+ #[allow(clippy::trivially_copy_pass_by_ref)]
pub fn as_raw(&self) -> *const T {
let (raw, _) = decompose_tag::<T>(self.data);
raw as *const _
@@ -1322,6 +1260,7 @@ impl<'g, T: ?Sized + Pointable> Shared<'g, T> {
/// a.store(Owned::new(1234), SeqCst);
/// assert!(!a.load(SeqCst, guard).is_null());
/// ```
+ #[allow(clippy::trivially_copy_pass_by_ref)]
pub fn is_null(&self) -> bool {
let (raw, _) = decompose_tag::<T>(self.data);
raw == 0
@@ -1358,6 +1297,8 @@ impl<'g, T: ?Sized + Pointable> Shared<'g, T> {
/// assert_eq!(p.deref(), &1234);
/// }
/// ```
+ #[allow(clippy::trivially_copy_pass_by_ref)]
+ #[allow(clippy::should_implement_trait)]
pub unsafe fn deref(&self) -> &'g T {
let (raw, _) = decompose_tag::<T>(self.data);
T::deref(raw)
@@ -1399,6 +1340,7 @@ impl<'g, T: ?Sized + Pointable> Shared<'g, T> {
/// assert_eq!(p.deref(), &vec![1, 2, 3, 4, 5]);
/// }
/// ```
+ #[allow(clippy::should_implement_trait)]
pub unsafe fn deref_mut(&mut self) -> &'g mut T {
let (raw, _) = decompose_tag::<T>(self.data);
T::deref_mut(raw)
@@ -1435,6 +1377,7 @@ impl<'g, T: ?Sized + Pointable> Shared<'g, T> {
/// assert_eq!(p.as_ref(), Some(&1234));
/// }
/// ```
+ #[allow(clippy::trivially_copy_pass_by_ref)]
pub unsafe fn as_ref(&self) -> Option<&'g T> {
let (raw, _) = decompose_tag::<T>(self.data);
if raw == 0 {
@@ -1486,6 +1429,7 @@ impl<'g, T: ?Sized + Pointable> Shared<'g, T> {
/// let p = a.load(SeqCst, guard);
/// assert_eq!(p.tag(), 2);
/// ```
+ #[allow(clippy::trivially_copy_pass_by_ref)]
pub fn tag(&self) -> usize {
let (_, tag) = decompose_tag::<T>(self.data);
tag
@@ -1509,6 +1453,7 @@ impl<'g, T: ?Sized + Pointable> Shared<'g, T> {
/// assert_eq!(p2.tag(), 2);
/// assert_eq!(p1.as_raw(), p2.as_raw());
/// ```
+ #[allow(clippy::trivially_copy_pass_by_ref)]
pub fn with_tag(&self, tag: usize) -> Shared<'g, T> {
unsafe { Self::from_usize(compose_tag::<T>(self.data, tag)) }
}
@@ -1581,8 +1526,7 @@ impl<T: ?Sized + Pointable> Default for Shared<'_, T> {
#[cfg(all(test, not(crossbeam_loom)))]
mod tests {
- use super::{Owned, Shared};
- use std::mem::MaybeUninit;
+ use super::Shared;
#[test]
fn valid_tag_i8() {
@@ -1598,13 +1542,6 @@ mod tests {
#[test]
fn const_atomic_null() {
use super::Atomic;
- static _U: Atomic<u8> = Atomic::<u8>::null();
- }
-
- #[test]
- fn array_init() {
- let owned = Owned::<[MaybeUninit<usize>]>::init(10);
- let arr: &[MaybeUninit<usize>] = &*owned;
- assert_eq!(arr.len(), 10);
+ const _: Atomic<u8> = Atomic::<u8>::null();
}
}
diff --git a/src/collector.rs b/src/collector.rs
index 099a2ff..7cfb819 100644
--- a/src/collector.rs
+++ b/src/collector.rs
@@ -178,18 +178,13 @@ mod tests {
#[test]
fn pin_holds_advance() {
- #[cfg(miri)]
- const N: usize = 500;
- #[cfg(not(miri))]
- const N: usize = 500_000;
-
let collector = Collector::new();
thread::scope(|scope| {
for _ in 0..NUM_THREADS {
scope.spawn(|_| {
let handle = collector.register();
- for _ in 0..N {
+ for _ in 0..500_000 {
let guard = &handle.pin();
let before = collector.global.epoch.load(Ordering::Relaxed);
@@ -207,9 +202,6 @@ mod tests {
#[cfg(not(crossbeam_sanitize))] // TODO: assertions failed due to `cfg(crossbeam_sanitize)` reduce `internal::MAX_OBJECTS`
#[test]
fn incremental() {
- #[cfg(miri)]
- const COUNT: usize = 500;
- #[cfg(not(miri))]
const COUNT: usize = 100_000;
static DESTROYS: AtomicUsize = AtomicUsize::new(0);
@@ -238,16 +230,12 @@ mod tests {
let guard = &handle.pin();
collector.global.collect(guard);
}
- assert!(DESTROYS.load(Ordering::Relaxed) == COUNT);
+ assert!(DESTROYS.load(Ordering::Relaxed) == 100_000);
}
#[test]
fn buffering() {
const COUNT: usize = 10;
- #[cfg(miri)]
- const N: usize = 500;
- #[cfg(not(miri))]
- const N: usize = 100_000;
static DESTROYS: AtomicUsize = AtomicUsize::new(0);
let collector = Collector::new();
@@ -264,7 +252,7 @@ mod tests {
}
}
- for _ in 0..N {
+ for _ in 0..100_000 {
collector.global.collect(&handle.pin());
}
assert!(DESTROYS.load(Ordering::Relaxed) < COUNT);
@@ -280,9 +268,6 @@ mod tests {
#[test]
fn count_drops() {
- #[cfg(miri)]
- const COUNT: usize = 500;
- #[cfg(not(miri))]
const COUNT: usize = 100_000;
static DROPS: AtomicUsize = AtomicUsize::new(0);
@@ -316,9 +301,6 @@ mod tests {
#[test]
fn count_destroy() {
- #[cfg(miri)]
- const COUNT: usize = 500;
- #[cfg(not(miri))]
const COUNT: usize = 100_000;
static DESTROYS: AtomicUsize = AtomicUsize::new(0);
@@ -385,9 +367,6 @@ mod tests {
#[test]
fn destroy_array() {
- #[cfg(miri)]
- const COUNT: usize = 500;
- #[cfg(not(miri))]
const COUNT: usize = 100_000;
static DESTROYS: AtomicUsize = AtomicUsize::new(0);
@@ -423,9 +402,6 @@ mod tests {
#[test]
fn stress() {
const THREADS: usize = 8;
- #[cfg(miri)]
- const COUNT: usize = 500;
- #[cfg(not(miri))]
const COUNT: usize = 100_000;
static DROPS: AtomicUsize = AtomicUsize::new(0);
diff --git a/src/deferred.rs b/src/deferred.rs
index c33d515..d953c46 100644
--- a/src/deferred.rs
+++ b/src/deferred.rs
@@ -18,7 +18,7 @@ type Data = [usize; DATA_WORDS];
/// This is a handy way of keeping an unsized `FnOnce()` within a sized structure.
pub(crate) struct Deferred {
call: unsafe fn(*mut u8),
- data: MaybeUninit<Data>,
+ data: Data,
_marker: PhantomData<*mut ()>, // !Send + !Sync
}
@@ -46,7 +46,7 @@ impl Deferred {
Deferred {
call: call::<F>,
- data,
+ data: data.assume_init(),
_marker: PhantomData,
}
} else {
@@ -57,13 +57,14 @@ impl Deferred {
unsafe fn call<F: FnOnce()>(raw: *mut u8) {
// It's safe to cast `raw` from `*mut u8` to `*mut Box<F>`, because `raw` is
// originally derived from `*mut Box<F>`.
+ #[allow(clippy::cast_ptr_alignment)]
let b: Box<F> = ptr::read(raw as *mut Box<F>);
(*b)();
}
Deferred {
call: call::<F>,
- data,
+ data: data.assume_init(),
_marker: PhantomData,
}
}
@@ -74,14 +75,12 @@ impl Deferred {
#[inline]
pub(crate) fn call(mut self) {
let call = self.call;
- unsafe { call(self.data.as_mut_ptr() as *mut u8) };
+ unsafe { call(&mut self.data as *mut Data as *mut u8) };
}
}
#[cfg(all(test, not(crossbeam_loom)))]
mod tests {
- #![allow(clippy::drop_copy)]
-
use super::Deferred;
use std::cell::Cell;
diff --git a/src/internal.rs b/src/internal.rs
index de208b1..966bceb 100644
--- a/src/internal.rs
+++ b/src/internal.rs
@@ -101,7 +101,7 @@ impl Bag {
/// Seals the bag with the given epoch.
fn seal(self, epoch: Epoch) -> SealedBag {
- SealedBag { epoch, _bag: self }
+ SealedBag { epoch, bag: self }
}
}
@@ -216,7 +216,7 @@ fn no_op_func() {}
#[derive(Default, Debug)]
struct SealedBag {
epoch: Epoch,
- _bag: Bag,
+ bag: Bag,
}
/// It is safe to share `SealedBag` because `is_expired` only inspects the epoch.
@@ -311,7 +311,7 @@ impl Global {
// TODO(stjepang): `Local`s are stored in a linked list because linked lists are fairly
// easy to implement in a lock-free manner. However, traversal can be slow due to cache
// misses and data dependencies. We should experiment with other data structures as well.
- for local in self.locals.iter(guard) {
+ for local in self.locals.iter(&guard) {
match local {
Err(IterError::Stalled) => {
// A concurrent thread stalled this iteration. That thread might also try to
diff --git a/src/lib.rs b/src/lib.rs
index ba1d331..99da911 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -62,7 +62,8 @@
unreachable_pub
)]
#![cfg_attr(not(feature = "std"), no_std)]
-#![cfg_attr(feature = "nightly", feature(const_fn_trait_bound))]
+#![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))]
+#![cfg_attr(feature = "nightly", feature(const_fn))]
#[cfg(crossbeam_loom)]
extern crate loom_crate as loom;
@@ -104,11 +105,10 @@ mod primitive {
pub(crate) use loom::lazy_static;
pub(crate) use loom::thread_local;
}
-#[cfg(not(crossbeam_no_atomic_cas))]
#[cfg(not(crossbeam_loom))]
#[allow(unused_imports, dead_code)]
mod primitive {
- #[cfg(feature = "alloc")]
+ #[cfg(any(feature = "alloc", feature = "std"))]
pub(crate) mod cell {
#[derive(Debug)]
#[repr(transparent)]
@@ -136,13 +136,14 @@ mod primitive {
}
}
}
- #[cfg(feature = "alloc")]
+ #[cfg(any(feature = "alloc", feature = "std"))]
pub(crate) mod sync {
pub(crate) mod atomic {
pub(crate) use core::sync::atomic::compiler_fence;
pub(crate) use core::sync::atomic::fence;
pub(crate) use core::sync::atomic::AtomicUsize;
}
+ #[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))]
pub(crate) use alloc::sync::Arc;
}
@@ -153,7 +154,7 @@ mod primitive {
pub(crate) use lazy_static::lazy_static;
}
-#[cfg(not(crossbeam_no_atomic_cas))]
+#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))]
cfg_if! {
if #[cfg(feature = "alloc")] {
extern crate alloc;
diff --git a/src/sync/queue.rs b/src/sync/queue.rs
index 9500438..67c228d 100644
--- a/src/sync/queue.rs
+++ b/src/sync/queue.rs
@@ -259,9 +259,6 @@ mod test {
}
}
- #[cfg(miri)]
- const CONC_COUNT: i64 = 1000;
- #[cfg(not(miri))]
const CONC_COUNT: i64 = 1000000;
#[test]
@@ -425,8 +422,8 @@ mod test {
let mut vl2 = vl.clone();
let mut vr2 = vr.clone();
- vl2.sort_unstable();
- vr2.sort_unstable();
+ vl2.sort();
+ vr2.sort();
assert_eq!(vl, vl2);
assert_eq!(vr, vr2);