From d0c979aaf12990da8c18927673356cdf6d0400aa Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Sun, 3 Sep 2023 21:25:33 +0200 Subject: [PATCH 1/7] chore: Remove no_btreemap_retain feature from build.rs --- build.rs | 6 ------ src/map.rs | 1 - tests/map.rs | 1 - 3 files changed, 8 deletions(-) diff --git a/build.rs b/build.rs index 0e12602e4..fca6c3b68 100644 --- a/build.rs +++ b/build.rs @@ -33,12 +33,6 @@ fn main() { if minor < 45 { println!("cargo:rustc-cfg=no_btreemap_remove_entry"); } - - // BTreeMap::retain - // https://blog.rust-lang.org/2021/06/17/Rust-1.53.0.html#stabilized-apis - if minor < 53 { - println!("cargo:rustc-cfg=no_btreemap_retain"); - } } fn rustc_minor_version() -> Option { diff --git a/src/map.rs b/src/map.rs index a1b622294..c088d02d0 100644 --- a/src/map.rs +++ b/src/map.rs @@ -276,7 +276,6 @@ impl Map { /// /// In other words, remove all pairs `(k, v)` such that `f(&k, &mut v)` /// returns `false`. - #[cfg(not(no_btreemap_retain))] #[inline] pub fn retain(&mut self, f: F) where diff --git a/tests/map.rs b/tests/map.rs index ae0196956..538cd16ae 100644 --- a/tests/map.rs +++ b/tests/map.rs @@ -35,7 +35,6 @@ fn test_append() { assert!(val.is_empty()); } -#[cfg(not(no_btreemap_retain))] #[test] fn test_retain() { let mut v: Value = from_str(r#"{"b":null,"a":null,"c":null}"#).unwrap(); From 716cb8fb3026152ae7399dd32e8b14f1b88c4f5c Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Sun, 3 Sep 2023 21:31:19 +0200 Subject: [PATCH 2/7] chore: Remove no_btreemap_get_key_value and no_btreemap_remove_entry. --- build.rs | 12 ------------ src/map.rs | 38 -------------------------------------- 2 files changed, 50 deletions(-) diff --git a/build.rs b/build.rs index fca6c3b68..bc2878cf2 100644 --- a/build.rs +++ b/build.rs @@ -21,18 +21,6 @@ fn main() { Some(minor) => minor, None => return, }; - - // BTreeMap::get_key_value - // https://blog.rust-lang.org/2019/12/19/Rust-1.40.0.html#additions-to-the-standard-library - if minor < 40 { - println!("cargo:rustc-cfg=no_btreemap_get_key_value"); - } - - // BTreeMap::remove_entry - // https://blog.rust-lang.org/2020/07/16/Rust-1.45.0.html#library-changes - if minor < 45 { - println!("cargo:rustc-cfg=no_btreemap_remove_entry"); - } } fn rustc_minor_version() -> Option { diff --git a/src/map.rs b/src/map.rs index c088d02d0..32a8cd01d 100644 --- a/src/map.rs +++ b/src/map.rs @@ -106,7 +106,6 @@ impl Map { /// The key may be any borrowed form of the map's key type, but the ordering /// on the borrowed form *must* match the ordering on the key type. #[inline] - #[cfg(any(feature = "preserve_order", not(no_btreemap_get_key_value)))] pub fn get_key_value(&self, key: &Q) -> Option<(&String, &Value)> where String: Borrow, @@ -153,44 +152,7 @@ impl Map { String: Borrow, Q: ?Sized + Ord + Eq + Hash, { - #[cfg(any(feature = "preserve_order", not(no_btreemap_remove_entry)))] return self.map.remove_entry(key); - #[cfg(all( - not(feature = "preserve_order"), - no_btreemap_remove_entry, - not(no_btreemap_get_key_value), - ))] - { - let (key, _value) = self.map.get_key_value(key)?; - let key = key.clone(); - let value = self.map.remove::(&key)?; - Some((key, value)) - } - #[cfg(all( - not(feature = "preserve_order"), - no_btreemap_remove_entry, - no_btreemap_get_key_value, - ))] - { - use core::ops::{Bound, RangeBounds}; - - struct Key<'a, Q: ?Sized>(&'a Q); - - impl<'a, Q: ?Sized> RangeBounds for Key<'a, Q> { - fn start_bound(&self) -> Bound<&Q> { - Bound::Included(self.0) - } - fn end_bound(&self) -> Bound<&Q> { - Bound::Included(self.0) - } - } - - let mut range = self.map.range(Key(key)); - let (key, _value) = range.next()?; - let key = key.clone(); - let value = self.map.remove::(&key)?; - Some((key, value)) - } } /// Moves all elements from other into self, leaving other empty. From c754f0344b61bf20fe76c205fd8d7a3d46138a96 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Sun, 3 Sep 2023 22:42:32 +0200 Subject: [PATCH 3/7] Remove limb_width32 and limb_width64 features Moved dispatch directly into the type system. --- build.rs | 36 ---------------------- src/lexical/math.rs | 60 +++++++++++++++++++++++-------------- src/lexical/mod.rs | 9 ++---- src/lexical/small_powers.rs | 3 -- 4 files changed, 40 insertions(+), 68 deletions(-) delete mode 100644 build.rs diff --git a/build.rs b/build.rs deleted file mode 100644 index bc2878cf2..000000000 --- a/build.rs +++ /dev/null @@ -1,36 +0,0 @@ -use std::env; -use std::process::Command; -use std::str::{self, FromStr}; - -fn main() { - println!("cargo:rerun-if-changed=build.rs"); - - // Decide ideal limb width for arithmetic in the float parser. Refer to - // src/lexical/math.rs for where this has an effect. - let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap(); - match target_arch.as_str() { - "aarch64" | "mips64" | "powerpc64" | "x86_64" => { - println!("cargo:rustc-cfg=limb_width_64"); - } - _ => { - println!("cargo:rustc-cfg=limb_width_32"); - } - } - - let minor = match rustc_minor_version() { - Some(minor) => minor, - None => return, - }; -} - -fn rustc_minor_version() -> Option { - let rustc = env::var_os("RUSTC")?; - let output = Command::new(rustc).arg("--version").output().ok()?; - let version = str::from_utf8(&output.stdout).ok()?; - let mut pieces = version.split('.'); - if pieces.next() != Some("rustc 1") { - return None; - } - let next = pieces.next()?; - u32::from_str(next).ok() -} diff --git a/src/lexical/math.rs b/src/lexical/math.rs index d7122bffa..9a2792b18 100644 --- a/src/lexical/math.rs +++ b/src/lexical/math.rs @@ -6,7 +6,6 @@ //! buffers, so for a `vec![0, 1, 2, 3]`, `3` is the most significant limb, //! and `0` is the least significant limb. -use super::large_powers; use super::num::*; use super::small_powers::*; use alloc::vec::Vec; @@ -36,31 +35,48 @@ use core::{cmp, iter, mem}; // requiring software emulation. // sparc64 (`UMUL` only supported double-word arguments). -// 32-BIT LIMB -#[cfg(limb_width_32)] -pub type Limb = u32; - -#[cfg(limb_width_32)] -pub const POW5_LIMB: &[Limb] = &POW5_32; - -#[cfg(limb_width_32)] -pub const POW10_LIMB: &[Limb] = &POW10_32; +#[doc(hidden)] +pub trait LimbConfig { + type Limb: 'static; + type Wide: 'static; + const POW5_LIMB: &'static [Self::Limb]; + const POW10_LIMB: &'static [Self::Limb]; + const LARGE_POWERS: &'static [&'static [Self::Limb]]; +} -#[cfg(limb_width_32)] -type Wide = u64; +// 32-BIT LIMB +#[doc(hidden)] +pub struct LimbConfig32; + +impl LimbConfig for LimbConfig32 { + type Limb = u32; + type Wide = u64; + const POW5_LIMB: &'static [Self::Limb] = &POW5_32; + const POW10_LIMB: &'static [Self::Limb] = &POW10_32; + const LARGE_POWERS: &'static [&'static [Self::Limb]] = &super::large_powers32::POW5; +} // 64-BIT LIMB -#[cfg(limb_width_64)] -pub type Limb = u64; - -#[cfg(limb_width_64)] -pub const POW5_LIMB: &[Limb] = &POW5_64; +#[doc(hidden)] +pub struct LimbConfig64; +impl LimbConfig for LimbConfig64 { + type Limb = u64; + type Wide = u128; + const POW5_LIMB: &'static [Self::Limb] = &POW5_64; + const POW10_LIMB: &'static [Self::Limb] = &POW10_64; + const LARGE_POWERS: &'static [&'static [Self::Limb]] = &super::large_powers64::POW5; +} -#[cfg(limb_width_64)] -pub const POW10_LIMB: &[Limb] = &POW10_64; +#[cfg(any(target_arch = "aarch64", target_arch = "mips64", target_arch = "powerpc64", target_arch = x86_64))] +type PlatformLimbConfig = LimbConfig64; +#[cfg(not(any(target_arch = "aarch64", target_arch = "mips64", target_arch = "powerpc64", target_arch = x86_64)))] +type PlatformLimbConfig = LimbConfig32; -#[cfg(limb_width_64)] -type Wide = u128; +pub type Limb = ::Limb; +type Wide = ::Wide; +pub const POW5_LIMB: &[Limb] = PlatformLimbConfig::POW5_LIMB; +pub const POW10_LIMB: &[Limb] = PlatformLimbConfig::POW10_LIMB; +const LARGE_POWERS: &'static [&'static [Limb]] = PlatformLimbConfig::LARGE_POWERS; /// Cast to limb type. #[inline] @@ -391,7 +407,7 @@ mod small { use super::large::KARATSUBA_CUTOFF; let small_powers = POW5_LIMB; - let large_powers = large_powers::POW5; + let large_powers = LARGE_POWERS; if n == 0 { // No exponent, just return. diff --git a/src/lexical/mod.rs b/src/lexical/mod.rs index b1a45e218..22784144a 100644 --- a/src/lexical/mod.rs +++ b/src/lexical/mod.rs @@ -20,7 +20,8 @@ mod digit; mod errors; pub(crate) mod exponent; pub(crate) mod float; -mod large_powers; +mod large_powers32; +mod large_powers64; pub(crate) mod math; pub(crate) mod num; pub(crate) mod parse; @@ -28,11 +29,5 @@ pub(crate) mod rounding; mod shift; mod small_powers; -#[cfg(limb_width_32)] -mod large_powers32; - -#[cfg(limb_width_64)] -mod large_powers64; - // API pub use self::parse::{parse_concise_float, parse_truncated_float}; diff --git a/src/lexical/small_powers.rs b/src/lexical/small_powers.rs index 219d82611..ac3f3aad7 100644 --- a/src/lexical/small_powers.rs +++ b/src/lexical/small_powers.rs @@ -3,19 +3,16 @@ //! Pre-computed small powers. // 32 BIT -#[cfg(limb_width_32)] pub(crate) const POW5_32: [u32; 14] = [ 1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625, 48828125, 244140625, 1220703125, ]; -#[cfg(limb_width_32)] pub(crate) const POW10_32: [u32; 10] = [ 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, ]; // 64 BIT -#[cfg(limb_width_64)] pub(crate) const POW5_64: [u64; 28] = [ 1, 5, From 16e04ceeddfdfad18fb1ae8530695a318fa9bc02 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com~> Date: Sun, 3 Sep 2023 23:17:27 +0200 Subject: [PATCH 4/7] fixup! Remove limb_width32 and limb_width64 features --- src/lexical/math.rs | 28 ++++++++++++++++++++++++---- tests/lexical/math.rs | 14 ++++++++++++-- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/lexical/math.rs b/src/lexical/math.rs index 9a2792b18..3c0ea0c34 100644 --- a/src/lexical/math.rs +++ b/src/lexical/math.rs @@ -67,9 +67,19 @@ impl LimbConfig for LimbConfig64 { const LARGE_POWERS: &'static [&'static [Self::Limb]] = &super::large_powers64::POW5; } -#[cfg(any(target_arch = "aarch64", target_arch = "mips64", target_arch = "powerpc64", target_arch = x86_64))] +#[cfg(any( + target_arch = "aarch64", + target_arch = "mips64", + target_arch = "powerpc64", + target_arch = "x86_64" +))] type PlatformLimbConfig = LimbConfig64; -#[cfg(not(any(target_arch = "aarch64", target_arch = "mips64", target_arch = "powerpc64", target_arch = x86_64)))] +#[cfg(not(any( + target_arch = "aarch64", + target_arch = "mips64", + target_arch = "powerpc64", + target_arch = "x86_64" +)))] type PlatformLimbConfig = LimbConfig32; pub type Limb = ::Limb; @@ -95,14 +105,24 @@ fn as_wide(t: T) -> Wide { /// Split u64 into limbs, in little-endian order. #[inline] -#[cfg(limb_width_32)] +#[cfg(not(any( + target_arch = "aarch64", + target_arch = "mips64", + target_arch = "powerpc64", + target_arch = "x86_64" +)))] fn split_u64(x: u64) -> [Limb; 2] { [as_limb(x), as_limb(x >> 32)] } /// Split u64 into limbs, in little-endian order. #[inline] -#[cfg(limb_width_64)] +#[cfg(any( + target_arch = "aarch64", + target_arch = "mips64", + target_arch = "powerpc64", + target_arch = "x86_64" +))] fn split_u64(x: u64) -> [Limb; 1] { [as_limb(x)] } diff --git a/tests/lexical/math.rs b/tests/lexical/math.rs index 79d3ef3ee..ce8ae502d 100644 --- a/tests/lexical/math.rs +++ b/tests/lexical/math.rs @@ -18,12 +18,22 @@ impl Math for Bigint { } } -#[cfg(limb_width_32)] +#[cfg(not(any( + target_arch = "aarch64", + target_arch = "mips64", + target_arch = "powerpc64", + target_arch = "x86_64" +)))] pub(crate) fn from_u32(x: &[u32]) -> Vec { x.iter().cloned().collect() } -#[cfg(limb_width_64)] +#[cfg(any( + target_arch = "aarch64", + target_arch = "mips64", + target_arch = "powerpc64", + target_arch = "x86_64" +))] pub(crate) fn from_u32(x: &[u32]) -> Vec { let mut v = Vec::::default(); for xi in x.chunks(2) { From 89a274195680d3ea6a2b442ff633b81ccf60bbe4 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Mon, 11 Sep 2023 11:19:34 +0200 Subject: [PATCH 5/7] Revert "Remove limb_width32 and limb_width64 features" This reverts commit c754f0344b61bf20fe76c205fd8d7a3d46138a96. --- build.rs | 36 ++++++++++++++++ src/lexical/math.rs | 86 +++++++++++-------------------------- src/lexical/mod.rs | 9 +++- src/lexical/small_powers.rs | 3 ++ tests/lexical/math.rs | 14 +----- 5 files changed, 73 insertions(+), 75 deletions(-) create mode 100644 build.rs diff --git a/build.rs b/build.rs new file mode 100644 index 000000000..bc2878cf2 --- /dev/null +++ b/build.rs @@ -0,0 +1,36 @@ +use std::env; +use std::process::Command; +use std::str::{self, FromStr}; + +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + + // Decide ideal limb width for arithmetic in the float parser. Refer to + // src/lexical/math.rs for where this has an effect. + let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap(); + match target_arch.as_str() { + "aarch64" | "mips64" | "powerpc64" | "x86_64" => { + println!("cargo:rustc-cfg=limb_width_64"); + } + _ => { + println!("cargo:rustc-cfg=limb_width_32"); + } + } + + let minor = match rustc_minor_version() { + Some(minor) => minor, + None => return, + }; +} + +fn rustc_minor_version() -> Option { + let rustc = env::var_os("RUSTC")?; + let output = Command::new(rustc).arg("--version").output().ok()?; + let version = str::from_utf8(&output.stdout).ok()?; + let mut pieces = version.split('.'); + if pieces.next() != Some("rustc 1") { + return None; + } + let next = pieces.next()?; + u32::from_str(next).ok() +} diff --git a/src/lexical/math.rs b/src/lexical/math.rs index 3c0ea0c34..d7122bffa 100644 --- a/src/lexical/math.rs +++ b/src/lexical/math.rs @@ -6,6 +6,7 @@ //! buffers, so for a `vec![0, 1, 2, 3]`, `3` is the most significant limb, //! and `0` is the least significant limb. +use super::large_powers; use super::num::*; use super::small_powers::*; use alloc::vec::Vec; @@ -35,58 +36,31 @@ use core::{cmp, iter, mem}; // requiring software emulation. // sparc64 (`UMUL` only supported double-word arguments). -#[doc(hidden)] -pub trait LimbConfig { - type Limb: 'static; - type Wide: 'static; - const POW5_LIMB: &'static [Self::Limb]; - const POW10_LIMB: &'static [Self::Limb]; - const LARGE_POWERS: &'static [&'static [Self::Limb]]; -} - // 32-BIT LIMB -#[doc(hidden)] -pub struct LimbConfig32; - -impl LimbConfig for LimbConfig32 { - type Limb = u32; - type Wide = u64; - const POW5_LIMB: &'static [Self::Limb] = &POW5_32; - const POW10_LIMB: &'static [Self::Limb] = &POW10_32; - const LARGE_POWERS: &'static [&'static [Self::Limb]] = &super::large_powers32::POW5; -} +#[cfg(limb_width_32)] +pub type Limb = u32; + +#[cfg(limb_width_32)] +pub const POW5_LIMB: &[Limb] = &POW5_32; + +#[cfg(limb_width_32)] +pub const POW10_LIMB: &[Limb] = &POW10_32; + +#[cfg(limb_width_32)] +type Wide = u64; // 64-BIT LIMB -#[doc(hidden)] -pub struct LimbConfig64; -impl LimbConfig for LimbConfig64 { - type Limb = u64; - type Wide = u128; - const POW5_LIMB: &'static [Self::Limb] = &POW5_64; - const POW10_LIMB: &'static [Self::Limb] = &POW10_64; - const LARGE_POWERS: &'static [&'static [Self::Limb]] = &super::large_powers64::POW5; -} +#[cfg(limb_width_64)] +pub type Limb = u64; + +#[cfg(limb_width_64)] +pub const POW5_LIMB: &[Limb] = &POW5_64; + +#[cfg(limb_width_64)] +pub const POW10_LIMB: &[Limb] = &POW10_64; -#[cfg(any( - target_arch = "aarch64", - target_arch = "mips64", - target_arch = "powerpc64", - target_arch = "x86_64" -))] -type PlatformLimbConfig = LimbConfig64; -#[cfg(not(any( - target_arch = "aarch64", - target_arch = "mips64", - target_arch = "powerpc64", - target_arch = "x86_64" -)))] -type PlatformLimbConfig = LimbConfig32; - -pub type Limb = ::Limb; -type Wide = ::Wide; -pub const POW5_LIMB: &[Limb] = PlatformLimbConfig::POW5_LIMB; -pub const POW10_LIMB: &[Limb] = PlatformLimbConfig::POW10_LIMB; -const LARGE_POWERS: &'static [&'static [Limb]] = PlatformLimbConfig::LARGE_POWERS; +#[cfg(limb_width_64)] +type Wide = u128; /// Cast to limb type. #[inline] @@ -105,24 +79,14 @@ fn as_wide(t: T) -> Wide { /// Split u64 into limbs, in little-endian order. #[inline] -#[cfg(not(any( - target_arch = "aarch64", - target_arch = "mips64", - target_arch = "powerpc64", - target_arch = "x86_64" -)))] +#[cfg(limb_width_32)] fn split_u64(x: u64) -> [Limb; 2] { [as_limb(x), as_limb(x >> 32)] } /// Split u64 into limbs, in little-endian order. #[inline] -#[cfg(any( - target_arch = "aarch64", - target_arch = "mips64", - target_arch = "powerpc64", - target_arch = "x86_64" -))] +#[cfg(limb_width_64)] fn split_u64(x: u64) -> [Limb; 1] { [as_limb(x)] } @@ -427,7 +391,7 @@ mod small { use super::large::KARATSUBA_CUTOFF; let small_powers = POW5_LIMB; - let large_powers = LARGE_POWERS; + let large_powers = large_powers::POW5; if n == 0 { // No exponent, just return. diff --git a/src/lexical/mod.rs b/src/lexical/mod.rs index 22784144a..b1a45e218 100644 --- a/src/lexical/mod.rs +++ b/src/lexical/mod.rs @@ -20,8 +20,7 @@ mod digit; mod errors; pub(crate) mod exponent; pub(crate) mod float; -mod large_powers32; -mod large_powers64; +mod large_powers; pub(crate) mod math; pub(crate) mod num; pub(crate) mod parse; @@ -29,5 +28,11 @@ pub(crate) mod rounding; mod shift; mod small_powers; +#[cfg(limb_width_32)] +mod large_powers32; + +#[cfg(limb_width_64)] +mod large_powers64; + // API pub use self::parse::{parse_concise_float, parse_truncated_float}; diff --git a/src/lexical/small_powers.rs b/src/lexical/small_powers.rs index ac3f3aad7..219d82611 100644 --- a/src/lexical/small_powers.rs +++ b/src/lexical/small_powers.rs @@ -3,16 +3,19 @@ //! Pre-computed small powers. // 32 BIT +#[cfg(limb_width_32)] pub(crate) const POW5_32: [u32; 14] = [ 1, 5, 25, 125, 625, 3125, 15625, 78125, 390625, 1953125, 9765625, 48828125, 244140625, 1220703125, ]; +#[cfg(limb_width_32)] pub(crate) const POW10_32: [u32; 10] = [ 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000, ]; // 64 BIT +#[cfg(limb_width_64)] pub(crate) const POW5_64: [u64; 28] = [ 1, 5, diff --git a/tests/lexical/math.rs b/tests/lexical/math.rs index ce8ae502d..79d3ef3ee 100644 --- a/tests/lexical/math.rs +++ b/tests/lexical/math.rs @@ -18,22 +18,12 @@ impl Math for Bigint { } } -#[cfg(not(any( - target_arch = "aarch64", - target_arch = "mips64", - target_arch = "powerpc64", - target_arch = "x86_64" -)))] +#[cfg(limb_width_32)] pub(crate) fn from_u32(x: &[u32]) -> Vec { x.iter().cloned().collect() } -#[cfg(any( - target_arch = "aarch64", - target_arch = "mips64", - target_arch = "powerpc64", - target_arch = "x86_64" -))] +#[cfg(limb_width_64)] pub(crate) fn from_u32(x: &[u32]) -> Vec { let mut v = Vec::::default(); for xi in x.chunks(2) { From 83bdc5fd4213d94201a3d9ad0f2943da7eba1dd6 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Mon, 11 Sep 2023 11:21:00 +0200 Subject: [PATCH 6/7] Omit return keyword in `remove_entry` Co-authored-by: David Tolnay --- src/map.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/map.rs b/src/map.rs index 32a8cd01d..675058ba1 100644 --- a/src/map.rs +++ b/src/map.rs @@ -152,7 +152,7 @@ impl Map { String: Borrow, Q: ?Sized + Ord + Eq + Hash, { - return self.map.remove_entry(key); + self.map.remove_entry(key) } /// Moves all elements from other into self, leaving other empty. From 04f7758b6eae935237574b25a1e63cf5e281e19e Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Mon, 11 Sep 2023 11:23:47 +0200 Subject: [PATCH 7/7] fixup! chore: Remove no_btreemap_get_key_value and no_btreemap_remove_entry. --- build.rs | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/build.rs b/build.rs index bc2878cf2..1a8c89828 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,4 @@ use std::env; -use std::process::Command; -use std::str::{self, FromStr}; fn main() { println!("cargo:rerun-if-changed=build.rs"); @@ -16,21 +14,4 @@ fn main() { println!("cargo:rustc-cfg=limb_width_32"); } } - - let minor = match rustc_minor_version() { - Some(minor) => minor, - None => return, - }; -} - -fn rustc_minor_version() -> Option { - let rustc = env::var_os("RUSTC")?; - let output = Command::new(rustc).arg("--version").output().ok()?; - let version = str::from_utf8(&output.stdout).ok()?; - let mut pieces = version.split('.'); - if pieces.next() != Some("rustc 1") { - return None; - } - let next = pieces.next()?; - u32::from_str(next).ok() }