Skip to content

docs: add missing safety sections for public unsafe APIs#45

Merged
jiegec merged 2 commits intorcore-os:masterfrom
mevinagrise:docs-safety-sections
Mar 26, 2026
Merged

docs: add missing safety sections for public unsafe APIs#45
jiegec merged 2 commits intorcore-os:masterfrom
mevinagrise:docs-safety-sections

Conversation

@mevinagrise
Copy link
Copy Markdown
Contributor

This PR adds missing # Safety sections to the public unsafe APIs exposed by the crate.

Specific changes include:

  • Added a # Safety section to LinkedList::push.
  • Added a # Safety section to Heap::add_to_heap.
  • Added a # Safety section to Heap::init.
  • Added a # Safety section to Heap::dealloc.

Why this is useful:

  • These functions are public and unsafe, so their caller obligations should be stated explicitly.
  • This improves the generated documentation for downstream users.
  • It also resolves the clippy::missing_safety_doc findings for these APIs.

Testing:

  • Ran cargo test.
  • Ran cargo clippy --all-targets --all-features -- -D warnings.

Note:
After this change, the missing_safety_doc findings are resolved. The remaining Clippy failure is clippy::result_unit_err in Heap::alloc, which involves a public API change and is intentionally left for a separate discussion.

Copy link
Copy Markdown

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 improves the crate’s public API documentation by adding missing Rustdoc # Safety sections to public unsafe functions, addressing clippy::missing_safety_doc for those APIs.

Changes:

  • Documented caller safety requirements for LinkedList::push.
  • Documented caller safety requirements for Heap::{add_to_heap, init, dealloc}.
  • Minor Rustdoc formatting/punctuation improvements around those APIs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/linked_list.rs Adds a # Safety section to the intrusive list push operation to clarify caller obligations.
src/lib.rs Adds # Safety sections to heap initialization/growth and deallocation entry points to improve unsafe API docs.

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

@mevinagrise
Copy link
Copy Markdown
Contributor Author

Updated to make this safety requirement explicit.

@jiegec jiegec merged commit 70703b0 into rcore-os:master Mar 26, 2026
2 checks passed
@mevinagrise mevinagrise deleted the docs-safety-sections branch March 30, 2026 08:08
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.

3 participants