microsoft / microsoft/Windows-rust-driver-samples
SAFETY comments should document preconditions
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 356
- Forks
- 42
- PR merge metrics
- No merged PRs in 30d
Description
Reading through https://github.com/microsoft/Windows-rust-driver-samples/blob/d9cc3091625f2d3eb0d528b3e6e9ab2c0551c372/general/echo/kmdf/exe/src/main.rs#L4, I see unsafe blocks labeled with SAFETY comments, which is great! However, the comments focus on why the unsafe block is required (eg. a specific FFI call or unsafe API method), rather than what preconditions ensure the unsafe code is actually safe in practice.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading general/echo/kmdf/exe/src/main.rs around line 4 and inspect the SAFETY comments on its unsafe blocks. Update the comments to explain the preconditions that make each block safe in practice, rather than only why the unsafe operation is needed. Done means the relevant comments document those safety conditions clearly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100