Skip to content

Commit 16834a5

Browse files
committed
doc: show feature-specific documents in rustdoc output
1 parent 0557371 commit 16834a5

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ authors = ["Yuekai Jia <[email protected]>"]
77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

99
[dependencies]
10-
cfg-if = "1.0"
1110
bitflags = "2.1"
1211
memory_addr = { path = "../memory_addr" }
1312

src/arch/mod.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
cfg_if::cfg_if! {
2-
if #[cfg(any(target_arch = "x86_64"))] {
3-
pub mod x86_64;
4-
} else if #[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))] {
5-
pub mod riscv;
6-
} else if #[cfg(target_arch = "aarch64")] {
7-
pub mod aarch64;
8-
}
9-
}
1+
#[cfg(target_arch = "x86_64")]
2+
pub mod x86_64;
3+
4+
#[doc(cfg(any(target_arch = "riscv32", target_arch = "riscv64")))]
5+
pub mod riscv;
6+
7+
// TODO: `#[cfg(any(target_arch = "aarch64", doc))]` does not work.
8+
#[doc(cfg(target_arch = "aarch64"))]
9+
pub mod aarch64;

src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#![no_std]
22
#![feature(const_trait_impl)]
3+
#![feature(doc_auto_cfg)]
4+
#![feature(doc_cfg)]
35

46
mod arch;
57

68
use core::fmt::Debug;
79
use memory_addr::PhysAddr;
810

9-
pub use arch::*;
11+
pub use self::arch::*;
1012

1113
bitflags::bitflags! {
1214
#[derive(Debug, Clone, Copy)]

0 commit comments

Comments
 (0)