docs: add missing safety sections for public unsafe APIs#45
Merged
jiegec merged 2 commits intorcore-os:masterfrom Mar 26, 2026
Merged
docs: add missing safety sections for public unsafe APIs#45jiegec merged 2 commits intorcore-os:masterfrom
jiegec merged 2 commits intorcore-os:masterfrom
Conversation
There was a problem hiding this comment.
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.
Contributor
Author
|
Updated to make this safety requirement explicit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds missing
# Safetysections to the public unsafe APIs exposed by the crate.Specific changes include:
# Safetysection toLinkedList::push.# Safetysection toHeap::add_to_heap.# Safetysection toHeap::init.# Safetysection toHeap::dealloc.Why this is useful:
clippy::missing_safety_docfindings for these APIs.Testing:
cargo test.cargo clippy --all-targets --all-features -- -D warnings.Note:
After this change, the
missing_safety_docfindings are resolved. The remaining Clippy failure isclippy::result_unit_errinHeap::alloc, which involves a public API change and is intentionally left for a separate discussion.