thread_local! doc improvements + tests for operational pedantics - #163387
Open
clarfonthey wants to merge 1 commit into
Open
clarfonthey wants to merge 1 commit into
clarfonthey wants to merge 1 commit into
Conversation
clarfonthey
commented
Sep 26, 2026
Contributor
Author
There was a problem hiding this comment.
cc @RalfJung since you mentioned having tests for this. Admittedly, I kind of struggled to come up with anything for this that might be even remotely sensible (and these aren't that), but, please feel free to comment whether this is satisfactory.
Member
There was a problem hiding this comment.
Yeah that's fair, I wasn't sure either. It just felt like something we should test for.
This comment has been minimized.
This comment has been minimized.
clarfonthey
force-pushed
the
thread-local
branch
from
September 26, 2026 23:48
fc67aee to
b5bce80
Compare
clarfonthey
marked this pull request as ready for review
September 26, 2026 23:49
RalfJung
reviewed
Sep 27, 2026
Comment on lines
+84
to
+87
| // NOTE: The `PhantomData` here is a nice trick to ensure that *all* usages of `$t` can be | ||
| // inferred to have static lifetimes. This function definition would normally *not* be such | ||
| // a definition, but because lifetime elision tends to prefer lifetimes matching arguments | ||
| // to a function, the `'static` lifetime inside the `PhantomData` qualifies here. |
Member
There was a problem hiding this comment.
Suggested change
| // NOTE: The `PhantomData` here is a nice trick to ensure that *all* usages of `$t` can be | |
| // inferred to have static lifetimes. This function definition would normally *not* be such | |
| // a definition, but because lifetime elision tends to prefer lifetimes matching arguments | |
| // to a function, the `'static` lifetime inside the `PhantomData` qualifies here. | |
| // NOTE: The `PhantomData` here is a nice trick to ensure that *all* usages of `$t` can be | |
| // inferred to have static lifetimes: if `$t` has missing lifetimes, like `&str`, | |
| // then lifetime elision will pick up the only lifetime in the argument, | |
| // `'static`. The we type-check `$init` against that expanded type. |
This branch has not been deployed
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.
cc @RalfJung who requested these in #159564.
r? libs