]> git.proxmox.com Git - rustc.git/blob - src/stdsimd/crates/std_detect/src/lib.rs
New upstream version 1.34.2+dfsg1
[rustc.git] / src / stdsimd / crates / std_detect / src / lib.rs
1 //! Run-time feature detection for the Rust standard library.
2 //!
3 //! To detect whether a feature is enabled in the system running the binary
4 //! use one of the appropriate macro for the target:
5 //!
6 //! * `x86` and `x86_64`: [`is_x86_feature_detected`]
7 //! * `arm`: [`is_arm_feature_detected`]
8 //! * `aarch64`: [`is_aarch64_feature_detected`]
9 //! * `mips`: [`is_mips_feature_detected`]
10 //! * `mips64`: [`is_mips64_feature_detected`]
11 //! * `powerpc`: [`is_powerpc_feature_detected`]
12 //! * `powerpc64`: [`is_powerpc64_feature_detected`]
13
14 #![unstable(feature = "stdsimd", issue = "27731")]
15 #![feature(const_fn, staged_api, stdsimd, doc_cfg, allow_internal_unstable)]
16 #![cfg_attr(feature = "cargo-clippy", allow(clippy::shadow_reuse))]
17 #![cfg_attr(
18 feature = "cargo-clippy",
19 deny(clippy::missing_inline_in_public_items,)
20 )]
21 #![cfg_attr(target_os = "linux", feature(linkage))]
22 #![cfg_attr(all(target_os = "freebsd", target_arch = "aarch64"), feature(asm))]
23 #![cfg_attr(stdsimd_strict, deny(warnings))]
24 #![cfg_attr(test, allow(unused_imports))]
25 #![no_std]
26
27 #[macro_use]
28 extern crate cfg_if;
29
30 cfg_if! {
31 if #[cfg(feature = "std_detect_file_io")] {
32 #[cfg_attr(test, macro_use(println))]
33 extern crate std;
34
35 #[allow(unused_imports)]
36 use std::{arch, fs, io, mem, sync};
37 } else {
38 #[cfg(test)]
39 #[macro_use(println)]
40 extern crate std;
41
42 #[allow(unused_imports)]
43 use core::{arch, mem, sync};
44 }
45 }
46
47 #[cfg(feature = "std_detect_dlsym_getauxval")]
48 extern crate libc;
49
50 #[doc(hidden)]
51 #[unstable(feature = "stdsimd", issue = "27731")]
52 pub mod detect;