Skip to content

Commit a9cbf14

Browse files
authored
Merge pull request #287 from rust-osdev/fix-cargo-doc-warnings
Use `#[cfg(doc)]` instead of docs.rs-specific cfg flag
2 parents 62b7895 + 5354b02 commit a9cbf14

File tree

8 files changed

+26
-10
lines changed

8 files changed

+26
-10
lines changed

.github/workflows/build.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,18 @@ jobs:
6565
with:
6666
command: build
6767

68+
- name: "Run cargo doc"
69+
uses: actions-rs/cargo@v1
70+
with:
71+
command: doc
72+
73+
- name: "Run cargo doc for stable"
74+
uses: actions-rs/cargo@v1
75+
with:
76+
command: doc
77+
args: --no-default-features --features external_asm,instructions
78+
if: runner.os != 'Windows'
79+
6880
- name: "Run cargo build for stable without instructions"
6981
uses: actions-rs/cargo@v1
7082
with:

Cargo.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,11 @@ cc = { version = "1.0.37", optional = true }
3737
default = [ "nightly", "instructions" ]
3838
instructions = []
3939
external_asm = [ "cc" ]
40-
nightly = [ "inline_asm", "const_fn", "abi_x86_interrupt" ]
40+
nightly = [ "inline_asm", "const_fn", "abi_x86_interrupt", "doc_cfg" ]
4141
inline_asm = []
4242
abi_x86_interrupt = []
4343
const_fn = []
44-
45-
[package.metadata.docs.rs]
46-
rustdoc-args = ["--cfg", "docsrs"]
44+
doc_cfg = []
4745

4846
[package.metadata.release]
4947
no-dev-version = true

src/instructions/interrupts.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@ pub fn int3() {
153153
/// immediate. This macro will be replaced by a generic function when support for
154154
/// const generics is implemented in Rust.
155155
#[cfg(feature = "inline_asm")]
156-
#[cfg_attr(docsrs, doc(cfg(any(feature = "nightly", feature = "inline_asm"))))]
156+
#[cfg_attr(
157+
feature = "doc_cfg",
158+
doc(cfg(any(feature = "nightly", feature = "inline_asm")))
159+
)]
157160
#[macro_export]
158161
macro_rules! software_interrupt {
159162
($x:expr) => {{

src/instructions/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ pub fn bochs_breakpoint() {
5454
/// Gets the current instruction pointer. Note that this is only approximate as it requires a few
5555
/// instructions to execute.
5656
#[cfg(feature = "inline_asm")]
57-
#[cfg_attr(docsrs, doc(cfg(any(feature = "nightly", feature = "inline_asm"))))]
57+
#[cfg_attr(
58+
feature = "doc_cfg",
59+
doc(cfg(any(feature = "nightly", feature = "inline_asm")))
60+
)]
5861
#[inline(always)]
5962
pub fn read_rip() -> crate::VirtAddr {
6063
let rip: u64;

src/instructions/segmentation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Provides functions to read and write segment registers.
22
3-
#[cfg(docsrs)]
3+
#[cfg(doc)]
44
use crate::{
55
registers::control::Cr4Flags,
66
structures::gdt::{Descriptor, GlobalDescriptorTable},

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#![cfg_attr(feature = "const_fn", feature(const_fn_trait_bound))] // PageSize marker trait
99
#![cfg_attr(feature = "inline_asm", feature(asm))]
1010
#![cfg_attr(feature = "abi_x86_interrupt", feature(abi_x86_interrupt))]
11-
#![cfg_attr(docsrs, feature(doc_cfg))]
11+
#![cfg_attr(feature = "doc_cfg", feature(doc_cfg))]
1212
#![warn(missing_docs)]
1313
#![deny(missing_debug_implementations)]
1414

src/registers/control.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Functions to read and write control registers.
22
33
pub use super::model_specific::{Efer, EferFlags};
4-
#[cfg(docsrs)]
4+
#[cfg(doc)]
55
use crate::{registers::rflags::RFlags, structures::paging::PageTableFlags};
66

77
use bitflags::bitflags;

src/registers/model_specific.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Functions to read and write model specific registers.
22
3-
#[cfg(docsrs)]
3+
#[cfg(doc)]
44
use crate::{
55
instructions::segmentation::{Segment64, FS, GS},
66
registers::control::Cr4Flags,

0 commit comments

Comments
 (0)