]> git.proxmox.com Git - rustc.git/blame - src/tools/rustfmt/tests/target/cfg_if/lib.rs
New upstream version 1.52.1+dfsg1
[rustc.git] / src / tools / rustfmt / tests / target / cfg_if / lib.rs
CommitLineData
f20569fa
XL
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#![allow(clippy::shadow_reuse)]
17#![deny(clippy::missing_inline_in_public_items)]
18#![cfg_attr(target_os = "linux", feature(linkage))]
19#![cfg_attr(all(target_os = "freebsd", target_arch = "aarch64"), feature(asm))]
20#![cfg_attr(stdsimd_strict, deny(warnings))]
21#![cfg_attr(test, allow(unused_imports))]
22#![no_std]
23
24#[macro_use]
25extern crate cfg_if;
26
27cfg_if! {
28 if #[cfg(feature = "std_detect_file_io")] {
29 #[cfg_attr(test, macro_use(println))]
30 extern crate std;
31
32 #[allow(unused_imports)]
33 use std::{arch, fs, io, mem, sync};
34 } else {
35 #[cfg(test)]
36 #[macro_use(println)]
37 extern crate std;
38
39 #[allow(unused_imports)]
40 use core::{arch, mem, sync};
41 }
42}
43
44#[cfg(feature = "std_detect_dlsym_getauxval")]
45extern crate libc;
46
47#[doc(hidden)]
48#[unstable(feature = "stdsimd", issue = "27731")]
49pub mod detect;