c-variadic: document Clone and Drop instances and require VaArgSafe: Copy#155821
Open
folkertdev wants to merge 3 commits intorust-lang:mainfrom
Open
c-variadic: document Clone and Drop instances and require VaArgSafe: Copy#155821folkertdev wants to merge 3 commits intorust-lang:mainfrom
Clone and Drop instances and require VaArgSafe: Copy#155821folkertdev wants to merge 3 commits intorust-lang:mainfrom
Conversation
Collaborator
|
|
kpreid
reviewed
Apr 26, 2026
Comment on lines
+252
to
+254
| /// Clone the [`VaList`] producing a second independent cursor into the variable argument list. | ||
| /// | ||
| /// Corresponds to `va_copy` in C. |
Contributor
There was a problem hiding this comment.
I think this documentation would be better placed on the fn than the impl.
- in rustdoc, the display of an
implon a type’s page is to show thefndocumentation, falling back to thetrait’sfn’s documentation if there is no documentation on theimpl’sfn. Putting documentation on thefnreplaces that boilerplate instead of adding more text next to it. - In rust-analyzer, function documentation can be accessed by hovering the
clone()call. So, overriding the function documentation here means that the user can quickly read about what this specificclone()means. - Also, semantically, this text specifies an effect of calling the function, so it should be function documentation.
| } | ||
| } | ||
|
|
||
| /// Clone the [`VaList`] producing a second independent cursor into the variable argument list. |
Contributor
There was a problem hiding this comment.
Suggested change
| /// Clone the [`VaList`] producing a second independent cursor into the variable argument list. | |
| /// Clone the [`VaList`], producing a second independent cursor into the variable argument list. |
because a VaList can be cloned, the same c-variadic argument can be read twice and that is only safe if the argument type is copy
2538ff2 to
d143239
Compare
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.
tracking issue: #44930
Fixing some things that came up in the stabilization PR
r? tgross35
cc @kpreid