FEAT: Implement a "MaybeUninit" and use it conditionally
Use a build script to detect if we can use MaybeUninit or NoDrop. Enabling unstable features automatically is not ideal, but since it's a soundness issue we should do it. Use a MaybeUninit-like union on nightly when we can. We use a feature detection script in build.rs, so that we also go back to the fallback if the unstable feature changes in an unexpected way. We need to continue to use NoDrop for best working stable implementation, but we eagerly use our union solution where we can, currently only in nightlies. Rustc feature probe code written by Josh Stone (cuviper), taken from num-bigint.
This commit is contained in:
+5
-1
@@ -11,6 +11,8 @@ repository = "https://github.com/bluss/arrayvec"
|
||||
keywords = ["stack", "vector", "array", "data-structure", "no_std"]
|
||||
categories = ["data-structures", "no-std"]
|
||||
|
||||
[build-dependencies]
|
||||
|
||||
[dependencies]
|
||||
nodrop = { version = "0.1.12", path = "nodrop", default-features = false }
|
||||
|
||||
@@ -37,12 +39,14 @@ harness = false
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = []
|
||||
use_union = []
|
||||
serde-1 = ["serde"]
|
||||
|
||||
array-sizes-33-128 = []
|
||||
array-sizes-129-255 = []
|
||||
|
||||
# has no effect
|
||||
use_union = []
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
features = ["serde-1"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user