Skip to content

Commit

Permalink
Emit the full is_{arch}_feature_detected! macro on all arches when bu…
Browse files Browse the repository at this point in the history
…ilding docs (rust-lang#1276)
  • Loading branch information
Amanieu authored Jan 28, 2022
1 parent f4c5507 commit 0c4890a
Showing 1 changed file with 45 additions and 1 deletion.
46 changes: 45 additions & 1 deletion crates/std_detect/src/detect/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,58 @@
use cfg_if::cfg_if;

#[cfg(not(doc))]
#[macro_use]
mod error_macros;

#[macro_use]
mod macros;

cfg_if! {
if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
if #[cfg(doc)] {
// When building docs, emit the full macro for all supported arches.
#[allow(dead_code)]
mod arch {
#[path = "x86.rs"]
#[macro_use]
mod x86;
#[path = "arm.rs"]
#[macro_use]
mod arm;
#[path = "aarch64.rs"]
#[macro_use]
mod aarch64;
#[path = "riscv.rs"]
#[macro_use]
mod riscv;
#[path = "powerpc.rs"]
#[macro_use]
mod powerpc;
#[path = "powerpc64.rs"]
#[macro_use]
mod powerpc64;
#[path = "mips.rs"]
#[macro_use]
mod mips;
#[path = "mips64.rs"]
#[macro_use]
mod mips64;

#[doc(hidden)]
pub(crate) enum Feature {
Null
}
#[doc(hidden)]
pub mod __is_feature_detected {}

impl Feature {
#[doc(hidden)]
pub(crate) fn from_str(_s: &str) -> Result<Feature, ()> { Err(()) }
#[doc(hidden)]
pub(crate) fn to_str(self) -> &'static str { "" }
}
}
} else if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
#[path = "arch/x86.rs"]
#[macro_use]
mod arch;
Expand Down

0 comments on commit 0c4890a

Please sign in to comment.