Remove std feature from cranelift-entity

This commit is contained in:
bjorn3
2019-09-28 15:46:03 +02:00
committed by Dan Gohman
parent d25e611946
commit a114423d0a
13 changed files with 20 additions and 32 deletions

View File

@@ -14,7 +14,7 @@ edition = "2018"
[dependencies] [dependencies]
cranelift-codegen-shared = { path = "./shared", version = "0.44.0" } cranelift-codegen-shared = { path = "./shared", version = "0.44.0" }
cranelift-entity = { path = "../cranelift-entity", version = "0.44.0", default-features = false } cranelift-entity = { path = "../cranelift-entity", version = "0.44.0" }
cranelift-bforest = { path = "../cranelift-bforest", version = "0.44.0" } cranelift-bforest = { path = "../cranelift-bforest", version = "0.44.0" }
failure = { version = "0.1.1", default-features = false, features = ["derive"] } failure = { version = "0.1.1", default-features = false, features = ["derive"] }
failure_derive = { version = "0.1.1", default-features = false } failure_derive = { version = "0.1.1", default-features = false }
@@ -37,10 +37,7 @@ default = ["std"]
# The "std" feature enables use of libstd. The "core" feature enables use # The "std" feature enables use of libstd. The "core" feature enables use
# of some minimal std-like replacement libraries. At least one of these two # of some minimal std-like replacement libraries. At least one of these two
# features need to be enabled. # features need to be enabled.
std = [ std = ["cranelift-codegen-meta/std"]
"cranelift-entity/std",
"cranelift-codegen-meta/std"
]
# The "core" features enables use of "hashbrown" since core doesn't have # The "core" features enables use of "hashbrown" since core doesn't have
# a HashMap implementation, and a workaround for Cargo #4866. # a HashMap implementation, and a workaround for Cargo #4866.

View File

@@ -10,7 +10,7 @@ edition = "2018"
[dependencies] [dependencies]
cranelift-codegen-shared = { path = "../shared", version = "0.44.0" } cranelift-codegen-shared = { path = "../shared", version = "0.44.0" }
cranelift-entity = { path = "../../cranelift-entity", version = "0.44.0", default-features = false } cranelift-entity = { path = "../../cranelift-entity", version = "0.44.0" }
[badges] [badges]
maintenance = { status = "experimental" } maintenance = { status = "experimental" }
@@ -18,6 +18,6 @@ travis-ci = { repository = "CraneStation/cranelift" }
[features] [features]
default = ["std"] default = ["std"]
std = ["cranelift-entity/std"] std = []
# The "core" feature enables a workaround for Cargo #4866. # The "core" feature enables a workaround for Cargo #4866.
core = ["cranelift-entity/core"] core = []

View File

@@ -15,9 +15,6 @@ edition = "2018"
serde = { version = "1.0.94", features = ["derive"], optional = true } serde = { version = "1.0.94", features = ["derive"], optional = true }
[features] [features]
default = ["std"]
std = []
core = []
enable-serde = ["serde"] enable-serde = ["serde"]
[badges] [badges]

View File

@@ -6,7 +6,7 @@ use crate::EntityRef;
use core::marker::PhantomData; use core::marker::PhantomData;
use core::ops::{Index, IndexMut}; use core::ops::{Index, IndexMut};
use core::slice; use core::slice;
use std::boxed::Box; use alloc::boxed::Box;
/// A slice mapping `K -> V` allocating dense entity references. /// A slice mapping `K -> V` allocating dense entity references.
/// ///
@@ -141,7 +141,7 @@ where
mod tests { mod tests {
use super::*; use super::*;
use crate::primary::PrimaryMap; use crate::primary::PrimaryMap;
use std::vec::Vec; use alloc::vec::Vec;
// `EntityRef` impl for testing. // `EntityRef` impl for testing.
#[derive(Clone, Copy, Debug, PartialEq, Eq)] #[derive(Clone, Copy, Debug, PartialEq, Eq)]

View File

@@ -31,7 +31,6 @@
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)] #![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)] #![warn(unused_import_braces)]
#![cfg_attr(feature = "std", deny(unstable_features))]
#![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))] #![cfg_attr(feature = "clippy", plugin(clippy(conf_file = "../../clippy.toml")))]
#![cfg_attr( #![cfg_attr(
feature = "cargo-clippy", feature = "cargo-clippy",
@@ -52,12 +51,7 @@
)] )]
#![no_std] #![no_std]
#[cfg(not(feature = "std"))] extern crate alloc;
#[macro_use]
extern crate alloc as std;
#[cfg(feature = "std")]
#[macro_use]
extern crate std;
// Re-export core so that the macros works with both std and no_std crates // Re-export core so that the macros works with both std and no_std crates
#[doc(hidden)] #[doc(hidden)]

View File

@@ -3,7 +3,7 @@ use crate::packed_option::ReservedValue;
use crate::EntityRef; use crate::EntityRef;
use core::marker::PhantomData; use core::marker::PhantomData;
use core::mem; use core::mem;
use std::vec::Vec; use alloc::vec::Vec;
/// A small list of entity references allocated from a pool. /// A small list of entity references allocated from a pool.
/// ///

View File

@@ -13,7 +13,7 @@ use serde::{
ser::{SerializeSeq, Serializer}, ser::{SerializeSeq, Serializer},
Deserialize, Serialize, Deserialize, Serialize,
}; };
use std::vec::Vec; use alloc::vec::Vec;
/// A mapping `K -> V` for densely indexed entity references. /// A mapping `K -> V` for densely indexed entity references.
/// ///
@@ -222,7 +222,7 @@ where
where where
D: Deserializer<'de>, D: Deserializer<'de>,
{ {
use std::fmt; use alloc::fmt;
struct SecondaryMapVisitor<K, V> { struct SecondaryMapVisitor<K, V> {
unused: PhantomData<fn(K) -> V>, unused: PhantomData<fn(K) -> V>,
} }

View File

@@ -9,8 +9,8 @@ use core::ops::{Index, IndexMut};
use core::slice; use core::slice;
#[cfg(feature = "enable-serde")] #[cfg(feature = "enable-serde")]
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::boxed::Box; use alloc::boxed::Box;
use std::vec::Vec; use alloc::vec::Vec;
/// A primary mapping `K -> V` allocating dense entity references. /// A primary mapping `K -> V` allocating dense entity references.
/// ///

View File

@@ -3,7 +3,7 @@
use crate::keys::Keys; use crate::keys::Keys;
use crate::EntityRef; use crate::EntityRef;
use core::marker::PhantomData; use core::marker::PhantomData;
use std::vec::Vec; use alloc::vec::Vec;
/// A set of `K` for densely indexed entity references. /// A set of `K` for densely indexed entity references.
/// ///

View File

@@ -12,7 +12,7 @@ use crate::EntityRef;
use core::mem; use core::mem;
use core::slice; use core::slice;
use core::u32; use core::u32;
use std::vec::Vec; use alloc::vec::Vec;
/// Trait for extracting keys from values stored in a `SparseMap`. /// Trait for extracting keys from values stored in a `SparseMap`.
/// ///

View File

@@ -12,14 +12,14 @@ edition = "2018"
[dependencies] [dependencies]
cranelift-codegen = { path = "../cranelift-codegen", version = "0.44.0", default-features = false } cranelift-codegen = { path = "../cranelift-codegen", version = "0.44.0", default-features = false }
cranelift-entity = { path = "../cranelift-entity", version = "0.44.0", default-features = false } cranelift-entity = { path = "../cranelift-entity", version = "0.44.0" }
hashbrown = { version = "0.6", optional = true } hashbrown = { version = "0.6", optional = true }
failure = { version = "0.1.1", default-features = false } failure = { version = "0.1.1", default-features = false }
log = { version = "0.4.6", default-features = false } log = { version = "0.4.6", default-features = false }
[features] [features]
default = ["std"] default = ["std"]
std = ["cranelift-codegen/std", "cranelift-entity/std"] std = ["cranelift-codegen/std"]
core = ["hashbrown", "cranelift-codegen/core"] core = ["hashbrown", "cranelift-codegen/core"]
[badges] [badges]

View File

@@ -13,14 +13,14 @@ edition = "2018"
[dependencies] [dependencies]
cranelift-codegen = { path = "../cranelift-codegen", version = "0.44.0", default-features = false } cranelift-codegen = { path = "../cranelift-codegen", version = "0.44.0", default-features = false }
cranelift-entity = { path = "../cranelift-entity", version = "0.44.0", default-features = false } cranelift-entity = { path = "../cranelift-entity", version = "0.44.0" }
# This is commented out because it doesn't build on Rust 1.25.0, which # This is commented out because it doesn't build on Rust 1.25.0, which
# cranelift currently supports. # cranelift currently supports.
# rustc_apfloat = { version = "0.1.2", default-features = false } # rustc_apfloat = { version = "0.1.2", default-features = false }
[features] [features]
default = ["std"] default = ["std"]
std = ["cranelift-codegen/std", "cranelift-entity/std"] std = ["cranelift-codegen/std"]
core = ["cranelift-codegen/core"] core = ["cranelift-codegen/core"]
[badges] [badges]

View File

@@ -13,7 +13,7 @@ edition = "2018"
[dependencies] [dependencies]
wasmparser = { version = "0.39.1", default-features = false } wasmparser = { version = "0.39.1", default-features = false }
cranelift-codegen = { path = "../cranelift-codegen", version = "0.44.0", default-features = false } cranelift-codegen = { path = "../cranelift-codegen", version = "0.44.0", default-features = false }
cranelift-entity = { path = "../cranelift-entity", version = "0.44.0", default-features = false } cranelift-entity = { path = "../cranelift-entity", version = "0.44.0" }
cranelift-frontend = { path = "../cranelift-frontend", version = "0.44.0", default-features = false } cranelift-frontend = { path = "../cranelift-frontend", version = "0.44.0", default-features = false }
hashbrown = { version = "0.6", optional = true } hashbrown = { version = "0.6", optional = true }
failure = { version = "0.1.1", default-features = false, features = ["derive"] } failure = { version = "0.1.1", default-features = false, features = ["derive"] }