Skip to content

Commit

Permalink
Merge #508
Browse files Browse the repository at this point in the history
508: Make std feature to depend on alloc feature r=jeehoonkang a=taiki-e

`alloc` crate is available on 1.36, see #368 (comment) for why it was previously separated.

This is a breaking change proposed in #503.

Co-authored-by: Taiki Endo <[email protected]>
  • Loading branch information
bors[bot] and taiki-e authored May 22, 2020
2 parents 24ab0fd + 86a6aa6 commit c5df6cf
Show file tree
Hide file tree
Showing 16 changed files with 2,143 additions and 2,075 deletions.
23 changes: 19 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,48 @@ travis-ci = { repository = "crossbeam-rs/crossbeam" }

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

# Enable to use APIs that require `std`.
# This is enabled by default.
std = [
"crossbeam-channel",
"crossbeam-deque",
"alloc",
"crossbeam-channel/std",
"crossbeam-deque/std",
"crossbeam-epoch/std",
"crossbeam-queue/std",
"crossbeam-utils/std",
]
alloc = ["crossbeam-epoch/alloc", "crossbeam-utils/alloc", "crossbeam-queue/alloc"]

# Enable to use APIs that require `alloc`.
# This is enabled by default and also enabled if the `std` feature is enabled.
alloc = ["crossbeam-epoch/alloc", "crossbeam-queue/alloc"]

# Enable to use of unstable functionality.
# This is disabled by default and requires recent nightly compiler.
# 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-epoch/nightly", "crossbeam-utils/nightly", "crossbeam-queue/nightly"]

[dependencies]
cfg-if = "0.1.2"

[dependencies.crossbeam-channel]
version = "0.4"
path = "./crossbeam-channel"
default-features = false
optional = true

[dependencies.crossbeam-deque]
version = "0.7.0"
path = "./crossbeam-deque"
default-features = false
optional = true

[dependencies.crossbeam-epoch]
version = "0.8"
path = "./crossbeam-epoch"
default-features = false
optional = true

[dependencies.crossbeam-queue]
version = "0.2"
Expand Down
3 changes: 0 additions & 3 deletions ci/crossbeam-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,5 @@ if [[ "$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 alloc
cargo check --target thumbv7m-none-eabi --no-default-features --features alloc,nightly
cargo check --target thumbv6m-none-eabi --no-default-features --features nightly
cargo check --target thumbv6m-none-eabi --no-default-features --features alloc,nightly
fi
12 changes: 12 additions & 0 deletions crossbeam-channel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,21 @@ description = "Multi-producer multi-consumer channels for message passing"
keywords = ["channel", "mpmc", "select", "golang", "message"]
categories = ["algorithms", "concurrency", "data-structures"]

[features]
default = ["std"]

# Enable to use APIs that require `std`.
# This is enabled by default.
std = ["crossbeam-utils/std"]

[dependencies]
cfg-if = "0.1.2"

[dependencies.crossbeam-utils]
version = "0.7"
path = "../crossbeam-utils"
default-features = false
optional = true

[dev-dependencies]
num_cpus = "1.10.0"
Expand Down
56 changes: 32 additions & 24 deletions crossbeam-channel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,33 +346,41 @@

#![warn(missing_docs)]
#![warn(missing_debug_implementations)]
#![cfg_attr(not(feature = "std"), no_std)]

extern crate crossbeam_utils;
#[macro_use]
extern crate cfg_if;

mod channel;
mod context;
mod counter;
mod err;
mod flavors;
mod select;
mod select_macro;
mod utils;
mod waker;
cfg_if! {
if #[cfg(feature = "std")] {
extern crate crossbeam_utils;

/// Crate internals used by the `select!` macro.
#[doc(hidden)]
pub mod internal {
pub use select::SelectHandle;
pub use select::{select, select_timeout, try_select};
}
mod channel;
mod context;
mod counter;
mod err;
mod flavors;
mod select;
mod select_macro;
mod utils;
mod waker;

/// Crate internals used by the `select!` macro.
#[doc(hidden)]
pub mod internal {
pub use select::SelectHandle;
pub use select::{select, select_timeout, try_select};
}

pub use channel::{after, never, tick};
pub use channel::{bounded, unbounded};
pub use channel::{IntoIter, Iter, TryIter};
pub use channel::{Receiver, Sender};
pub use channel::{after, never, tick};
pub use channel::{bounded, unbounded};
pub use channel::{IntoIter, Iter, TryIter};
pub use channel::{Receiver, Sender};

pub use select::{Select, SelectedOperation};
pub use select::{Select, SelectedOperation};

pub use err::{ReadyTimeoutError, SelectTimeoutError, TryReadyError, TrySelectError};
pub use err::{RecvError, RecvTimeoutError, TryRecvError};
pub use err::{SendError, SendTimeoutError, TrySendError};
pub use err::{ReadyTimeoutError, SelectTimeoutError, TryReadyError, TrySelectError};
pub use err::{RecvError, RecvTimeoutError, TryRecvError};
pub use err::{SendError, SendTimeoutError, TrySendError};
}
}
14 changes: 14 additions & 0 deletions crossbeam-deque/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,27 @@ description = "Concurrent work-stealing deque"
keywords = ["chase-lev", "lock-free", "scheduler", "scheduling"]
categories = ["algorithms", "concurrency", "data-structures"]

[features]
default = ["std"]

# Enable to use APIs that require `std`.
# This is enabled by default.
std = ["crossbeam-epoch/std", "crossbeam-utils/std"]

[dependencies]
cfg-if = "0.1.2"

[dependencies.crossbeam-epoch]
version = "0.8"
path = "../crossbeam-epoch"
default-features = false
optional = true

[dependencies.crossbeam-utils]
version = "0.7"
path = "../crossbeam-utils"
default-features = false
optional = true

[dev-dependencies]
rand = "0.6"
Loading

0 comments on commit c5df6cf

Please sign in to comment.