Skip to content

Commit

Permalink
Make std feature to depend on alloc feature
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed May 20, 2020
1 parent 24ab0fd commit e782e91
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 48 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ travis-ci = { repository = "crossbeam-rs/crossbeam" }
default = ["std"]
nightly = ["crossbeam-epoch/nightly", "crossbeam-utils/nightly", "crossbeam-queue/nightly"]
std = [
"alloc",
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-epoch/std",
Expand Down
2 changes: 1 addition & 1 deletion crossbeam-epoch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ categories = ["concurrency", "memory-management", "no-std"]
[features]
default = ["std"]
nightly = ["crossbeam-utils/nightly"]
std = ["crossbeam-utils/std", "lazy_static"]
std = ["alloc", "crossbeam-utils/std", "lazy_static"]
alloc = ["crossbeam-utils/alloc"]
sanitize = [] # Makes it more likely to trigger any potential data races.

Expand Down
12 changes: 3 additions & 9 deletions crossbeam-epoch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,14 @@

#[macro_use]
extern crate cfg_if;
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "std")]
extern crate core;

cfg_if! {
if #[cfg(feature = "alloc")] {
extern crate alloc;
} else if #[cfg(feature = "std")] {
extern crate std as alloc;
}
}

#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))]
cfg_if! {
if #[cfg(any(feature = "alloc", feature = "std"))] {
if #[cfg(feature = "alloc")] {
extern crate crossbeam_utils;
#[macro_use]
extern crate memoffset;
Expand Down
2 changes: 1 addition & 1 deletion crossbeam-queue/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ categories = ["concurrency", "data-structures"]

[features]
default = ["std"]
std = ["crossbeam-utils/std"]
std = ["alloc", "crossbeam-utils/std"]
alloc = ["crossbeam-utils/alloc"]
nightly = []

Expand Down
13 changes: 4 additions & 9 deletions crossbeam-queue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,19 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))]

#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))]
#[macro_use]
extern crate cfg_if;
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "std")]
extern crate core;

cfg_if! {
if #[cfg(feature = "alloc")] {
extern crate alloc;
} else if #[cfg(feature = "std")] {
extern crate std as alloc;
}
}

extern crate crossbeam_utils;

#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))]
cfg_if! {
if #[cfg(any(feature = "alloc", feature = "std"))] {
if #[cfg(feature = "alloc")] {
mod array_queue;
mod err;
mod seg_queue;
Expand Down
2 changes: 1 addition & 1 deletion crossbeam-skiplist/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ categories = ["algorithms", "concurrency", "data-structures", "no-std"]
[features]
default = ["std"]
nightly = ["crossbeam-epoch/nightly", "crossbeam-utils/nightly"]
std = ["crossbeam-epoch/std", "crossbeam-utils/std"]
std = ["alloc", "crossbeam-epoch/std", "crossbeam-utils/std"]
alloc = ["crossbeam-epoch/alloc", "crossbeam-utils/alloc"]

[dependencies]
Expand Down
12 changes: 3 additions & 9 deletions crossbeam-skiplist/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,14 @@

#[macro_use]
extern crate cfg_if;
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "std")]
extern crate core;

cfg_if! {
if #[cfg(feature = "alloc")] {
extern crate alloc;
} else if #[cfg(feature = "std")] {
extern crate std as alloc;
}
}

#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))]
cfg_if! {
if #[cfg(any(feature = "alloc", feature = "std"))] {
if #[cfg(feature = "alloc")] {
extern crate crossbeam_epoch as epoch;
extern crate crossbeam_utils as utils;
extern crate scopeguard;
Expand Down
2 changes: 1 addition & 1 deletion crossbeam-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ categories = ["algorithms", "concurrency", "data-structures", "no-std"]
[features]
default = ["std"]
nightly = []
std = ["lazy_static"]
std = ["alloc", "lazy_static"]
alloc = []

[dependencies]
Expand Down
10 changes: 2 additions & 8 deletions crossbeam-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,11 @@

#[macro_use]
extern crate cfg_if;
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "std")]
extern crate core;

cfg_if! {
if #[cfg(feature = "alloc")] {
extern crate alloc;
} else if #[cfg(feature = "std")] {
extern crate std as alloc;
}
}

#[cfg_attr(feature = "nightly", cfg(target_has_atomic = "ptr"))]
pub mod atomic;

Expand Down
12 changes: 3 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,11 @@

#[macro_use]
extern crate cfg_if;
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "std")]
extern crate core;

cfg_if! {
if #[cfg(feature = "alloc")] {
extern crate alloc;
} else if #[cfg(feature = "std")] {
extern crate std as alloc;
}
}

mod _epoch {
pub extern crate crossbeam_epoch;
}
Expand All @@ -78,7 +72,7 @@ pub mod utils {
}

cfg_if! {
if #[cfg(any(feature = "std", feature = "alloc"))] {
if #[cfg(feature = "alloc")] {
mod _queue {
pub extern crate crossbeam_queue;
}
Expand Down

0 comments on commit e782e91

Please sign in to comment.