Skip to content

Conversation

@AsakuraMizu
Copy link
Contributor

This is an alternative to #26, applying the idea described in #26 (comment).

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR transitions from using --cfg doc to --cfg docsrs for documentation builds on docs.rs, following Rust's standard practice for conditional compilation during documentation generation. The change adds support for both doc and docsrs cfg flags in module definitions to ensure compatibility.

Key Changes:

  • Updates Cargo.toml files to use rustc-args = ["--cfg", "docsrs"] for docs.rs metadata and enables all-features
  • Adds docsrs alongside doc in conditional compilation attributes for architecture-specific modules
  • Adds #[cfg_attr(doc, doc(cfg(...)))] annotations to show platform-specific availability in documentation
  • Updates CI workflow to use --cfg docsrs for documentation builds

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
page_table_entry/Cargo.toml Updates docs.rs configuration to use docsrs flag and enables all features; adds docsrs to conditional dependencies
page_table_entry/src/arch/mod.rs Adds docsrs to cfg conditions and adds doc(cfg(...)) attributes for platform documentation
page_table_multiarch/Cargo.toml Updates docs.rs configuration to use docsrs flag and enables all features
page_table_multiarch/tests/alloc_tests.rs Adds cfg attributes to architecture-specific tests (but missing docsrs flag)
.github/workflows/ci.yml Updates doc job to use docsrs flag; adds comment for test workaround
Cargo.lock Updates dependency versions (bit_field, bitflags, log, memory_addr, rand, rustversion, x86_64)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AsakuraMizu
Copy link
Contributor Author

Note that the line #[cfg_attr(doc, doc(cfg(target_arch = "x86_64")))] is required; otherwise, the generated document will display the module x86_64 as "Available on x86-64 or docsrs only."

@AsakuraMizu
Copy link
Contributor Author

The "dirty trick" mentioned in #26 (comment) does not work since the quote issue described in #25.

Copy link

@Azure-stars Azure-stars left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@equation314 equation314 merged commit 93237a9 into main Nov 24, 2025
12 checks passed
@AsakuraMizu AsakuraMizu deleted the fix/docsrs branch November 24, 2025 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants