docs: document ownership contract for GpmSample raw handle APIs - #143
Merged
Conversation
Expand the safety docs on from_handle to spell out the full contract (handle provenance and the double-free hazard), clarify that handle() returns a borrowed handle, and add into_handle() as an explicit ownership-transfer path that doesn't require callers to mem::forget the wrapper themselves. Follow-up to rust-nvml#141. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012YY5qSm6ERJ4gheYggH22M
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.
Follow-up to #141.
# Safetydocs onGpmSample::from_handleto spell out the full contract: the handle must come fromnvmlGpmSampleAllocon the same loaded NVML library, must not already be freed, and nothing else may free it afterward (double-free hazard).handle()'s docs that the returned handle is borrowed and cross-link the related APIs.GpmSample::into_handle()as an explicit ownership-transfer path, so thehandle()+mem::forgetdance isn't needed to round-trip a sample throughfrom_handle.🤖 Generated with Claude Code
https://claude.ai/code/session_012YY5qSm6ERJ4gheYggH22M