Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/std_detect/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ readme = "README.md"
keywords = ["std", "run-time", "feature", "detection"]
categories = ["hardware-support"]
license = "MIT/Apache-2.0"
edition = "2015"
edition = "2018"

[badges]
azure-devops = { project = "stdarch", pipeline = "rust-lang2.stdarch" }
Expand All @@ -24,7 +24,7 @@ maintenance = { status = "experimental" }

[dependencies]
libc = { version = "0.2", optional = true, default-features = false }
cfg-if = "0.1"
cfg-if = "0.1.10"

[dev-dependencies]
auxv = "0.3.3"
Expand Down
2 changes: 1 addition & 1 deletion crates/std_detect/src/detect/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl Cache {
self.1.store(hi, Ordering::Relaxed);
}
}
cfg_if! {
cfg_if::cfg_if! {
if #[cfg(feature = "std_detect_env_override")] {
#[inline(never)]
fn initialize(mut value: Initializer) {
Expand Down
21 changes: 9 additions & 12 deletions crates/std_detect/src/detect/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
//! due to security concerns (x86 is the big exception). These functions are
//! implemented in the `os/{target_os}.rs` modules.

use cfg_if::cfg_if;

#[macro_use]
mod error_macros;

Expand Down Expand Up @@ -132,19 +134,14 @@ pub fn features() -> impl Iterator<Item = (&'static str, bool)> {
target_arch = "mips",
target_arch = "mips64",
))] {
fn impl_() -> impl Iterator<Item=(&'static str, bool)> {
(0_u8..Feature::_last as u8).map(|discriminant: u8| {
let f: Feature = unsafe { crate::mem::transmute(discriminant) };
let name: &'static str = f.to_str();
let enabled: bool = check_for(f);
(name, enabled)
})
}
(0_u8..Feature::_last as u8).map(|discriminant: u8| {
let f: Feature = unsafe { crate::mem::transmute(discriminant) };
let name: &'static str = f.to_str();
let enabled: bool = check_for(f);
(name, enabled)
})
} else {
fn impl_() -> impl Iterator<Item=(&'static str, bool)> {
(0_u8..0_u8).map(|_x: u8| ("", false))
}
None.into_iter()
}
}
impl_()
}
2 changes: 1 addition & 1 deletion crates/std_detect/src/detect/os/freebsd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

mod auxvec;

cfg_if! {
cfg_if::cfg_if! {
if #[cfg(target_arch = "aarch64")] {
mod aarch64;
pub use self::aarch64::check_for;
Expand Down
5 changes: 1 addition & 4 deletions crates/std_detect/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
#![cfg_attr(test, allow(unused_imports))]
#![no_std]

#[macro_use]
extern crate cfg_if;

cfg_if! {
cfg_if::cfg_if! {
if #[cfg(any(feature = "std_detect_file_io", feature = "std_detect_env_override"))] {
#[cfg_attr(test, macro_use(println))]
extern crate std;
Expand Down