diff options
| author | Amanieu d'Antras <amanieu@gmail.com> | 2022-01-28 09:49:43 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-28 09:49:43 +0000 |
| commit | 3030730d048d1aaba2a8debafa6a77943a645462 (patch) | |
| tree | ee41a24305b68228049e1baadf52b5fed694aa48 /library/stdarch/crates/std_detect | |
| parent | 929f6e84099de2ba0f9ca15ef513416a77a1f019 (diff) | |
| download | rust-3030730d048d1aaba2a8debafa6a77943a645462.tar.gz rust-3030730d048d1aaba2a8debafa6a77943a645462.zip | |
Emit the full is_{arch}_feature_detected! macro on all arches when building docs (#1276)
Diffstat (limited to 'library/stdarch/crates/std_detect')
| -rw-r--r-- | library/stdarch/crates/std_detect/src/detect/mod.rs | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/library/stdarch/crates/std_detect/src/detect/mod.rs b/library/stdarch/crates/std_detect/src/detect/mod.rs index e4eea72d458..7937417f526 100644 --- a/library/stdarch/crates/std_detect/src/detect/mod.rs +++ b/library/stdarch/crates/std_detect/src/detect/mod.rs @@ -19,6 +19,7 @@ use cfg_if::cfg_if; +#[cfg(not(doc))] #[macro_use] mod error_macros; @@ -26,7 +27,50 @@ mod error_macros; 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; |
