Turn std_detect into a no_std crate (#1005)

This commit is contained in:
Amanieu d'Antras
2021-02-14 22:14:37 +00:00
committed by GitHub
parent b7acc2e1da
commit f32f7cb899
13 changed files with 165 additions and 95 deletions

View File

@@ -15,30 +15,17 @@
#![feature(const_fn, staged_api, stdsimd, doc_cfg, allow_internal_unstable)]
#![allow(clippy::shadow_reuse)]
#![deny(clippy::missing_inline_in_public_items)]
#![cfg_attr(target_os = "linux", feature(linkage))]
#![cfg_attr(all(target_os = "freebsd", target_arch = "aarch64"), feature(llvm_asm))]
#![cfg_attr(test, allow(unused_imports))]
#![cfg_attr(feature = "std_detect_file_io", feature(vec_spare_capacity))]
#![no_std]
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;
#[cfg(feature = "std_detect_file_io")]
extern crate alloc;
#[allow(unused_imports)]
use std::{arch, env, fs, io, mem, sync};
} else {
#[cfg(test)]
#[macro_use(println)]
extern crate std;
#[allow(unused_imports)]
use core::{arch, mem, sync};
}
}
#[cfg(feature = "std_detect_dlsym_getauxval")]
extern crate libc;
#[cfg(test)]
#[macro_use]
extern crate std;
#[doc(hidden)]
#[unstable(feature = "stdsimd", issue = "27731")]