Skip to content

Commit

Permalink
Add the alloc feature
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed May 11, 2019
1 parent 257c696 commit cafe143
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 18 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ std = [
"crossbeam-queue",
"crossbeam-utils/std",
]
alloc = ["crossbeam-epoch/alloc", "crossbeam-utils/alloc"]

[dependencies]
cfg-if = "0.1.2"
Expand Down
3 changes: 2 additions & 1 deletion ci/crossbeam-epoch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then

# Check for no_std environment.
cargo check --target thumbv7m-none-eabi --no-default-features
cargo check --target thumbv7m-none-eabi --no-default-features --features nightly
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc,nightly
fi
3 changes: 2 additions & 1 deletion ci/crossbeam-skiplist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then

# Check for no_std environment.
cargo check --target thumbv7m-none-eabi --no-default-features
cargo check --target thumbv7m-none-eabi --no-default-features --features nightly
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc,nightly
fi
3 changes: 2 additions & 1 deletion ci/crossbeam-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then

# Check for no_std environment.
cargo check --target thumbv7m-none-eabi --no-default-features
cargo check --target thumbv7m-none-eabi --no-default-features --features nightly
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc,nightly
fi
3 changes: 2 additions & 1 deletion ci/crossbeam.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ if [[ "$TRAVIS_RUST_VERSION" == "nightly" ]]; then

# Check for no_std environment.
cargo check --target thumbv7m-none-eabi --no-default-features
cargo check --target thumbv7m-none-eabi --no-default-features --features nightly
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc,nightly
fi
1 change: 1 addition & 0 deletions crossbeam-epoch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ categories = ["concurrency", "memory-management", "no-std"]
default = ["std"]
nightly = ["crossbeam-utils/nightly", "arrayvec/use_union"]
std = ["crossbeam-utils/std", "lazy_static"]
alloc = ["crossbeam-utils/alloc"]
sanitize = [] # Makes it more likely to trigger any potential data races.

[dependencies]
Expand Down
7 changes: 3 additions & 4 deletions crossbeam-epoch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,15 @@ extern crate cfg_if;
extern crate core;

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

cfg_if! {
if #[cfg(any(feature = "std", feature = "nightly"))] {
if #[cfg(any(feature = "alloc", feature = "std"))] {
extern crate arrayvec;
extern crate crossbeam_utils;
#[macro_use]
Expand Down
1 change: 1 addition & 0 deletions crossbeam-skiplist/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ categories = ["algorithms", "concurrency", "data-structures", "no-std"]
default = ["std"]
nightly = ["crossbeam-epoch/nightly", "crossbeam-utils/nightly"]
std = ["crossbeam-epoch/std", "crossbeam-utils/std"]
alloc = ["crossbeam-epoch/alloc", "crossbeam-utils/alloc"]

[dependencies]
cfg-if = "0.1.2"
Expand Down
7 changes: 3 additions & 4 deletions crossbeam-skiplist/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ extern crate cfg_if;
extern crate core;

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

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

[dependencies]
cfg-if = "0.1.2"
Expand Down
5 changes: 2 additions & 3 deletions crossbeam-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ extern crate cfg_if;
extern crate core;

cfg_if! {
if #[cfg(feature = "nightly")] {
if #[cfg(feature = "alloc")] {
extern crate alloc;
} else {
#[cfg(feature = "std")]
} else if #[cfg(feature = "std")] {
extern crate std as alloc;
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,9 @@ extern crate cfg_if;
extern crate core;

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

0 comments on commit cafe143

Please sign in to comment.