Skip to content

Commit 931b891

Browse files
bors[bot]phil-opp
andauthored
Merge #480
480: Make the `queue` module available on no_std + alloc r=jeehoonkang a=phil-opp The crossbeam_queue crate is no_std compatible since #455. Co-authored-by: Philipp Oppermann <[email protected]>
2 parents e302030 + 89640f0 commit 931b891

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

Cargo.toml

+4-3
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ travis-ci = { repository = "crossbeam-rs/crossbeam" }
2121

2222
[features]
2323
default = ["std"]
24-
nightly = ["crossbeam-epoch/nightly", "crossbeam-utils/nightly"]
24+
nightly = ["crossbeam-epoch/nightly", "crossbeam-utils/nightly", "crossbeam-queue/nightly"]
2525
std = [
2626
"crossbeam-channel",
2727
"crossbeam-deque",
2828
"crossbeam-epoch/std",
29-
"crossbeam-queue",
29+
"crossbeam-queue/std",
3030
"crossbeam-utils/std",
3131
]
32-
alloc = ["crossbeam-epoch/alloc", "crossbeam-utils/alloc"]
32+
alloc = ["crossbeam-epoch/alloc", "crossbeam-utils/alloc", "crossbeam-queue/alloc"]
3333

3434
[dependencies]
3535
cfg-if = "0.1.2"
@@ -52,6 +52,7 @@ default-features = false
5252
[dependencies.crossbeam-queue]
5353
version = "0.2"
5454
path = "./crossbeam-queue"
55+
default-features = false
5556
optional = true
5657

5758
[dependencies.crossbeam-utils]

crossbeam-queue/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ categories = ["concurrency", "data-structures"]
1919
default = ["std"]
2020
std = ["crossbeam-utils/std"]
2121
alloc = ["crossbeam-utils/alloc"]
22+
nightly = []
2223

2324
[dependencies]
2425
cfg-if = "0.1.2"

crossbeam-queue/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#![warn(missing_docs)]
1212
#![warn(missing_debug_implementations)]
1313
#![cfg_attr(not(feature = "std"), no_std)]
14+
#![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))]
1415

1516
#[macro_use]
1617
extern crate cfg_if;
@@ -29,6 +30,7 @@ cfg_if! {
2930

3031
extern crate crossbeam_utils;
3132

33+
#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))]
3234
cfg_if! {
3335
if #[cfg(any(feature = "alloc", feature = "std"))] {
3436
mod array_queue;

src/lib.rs

+10-6
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ pub mod utils {
7777
pub use crossbeam_utils::CachePadded;
7878
}
7979

80+
cfg_if! {
81+
if #[cfg(any(feature = "std", feature = "alloc"))] {
82+
mod _queue {
83+
pub extern crate crossbeam_queue;
84+
}
85+
#[doc(inline)]
86+
pub use _queue::crossbeam_queue as queue;
87+
}
88+
}
89+
8090
cfg_if! {
8191
if #[cfg(feature = "std")] {
8292
mod _deque {
@@ -96,12 +106,6 @@ cfg_if! {
96106
#[doc(hidden)]
97107
pub use _channel::*;
98108

99-
mod _queue {
100-
pub extern crate crossbeam_queue;
101-
}
102-
#[doc(inline)]
103-
pub use _queue::crossbeam_queue as queue;
104-
105109
pub use crossbeam_utils::sync;
106110
pub use crossbeam_utils::thread;
107111
pub use crossbeam_utils::thread::scope;

0 commit comments

Comments
 (0)