-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
fmt::Arguments is Send+Sync regardless of its captured arguments #45197
Copy link
Copy link
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-highHigh priorityHigh priorityT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessP-highHigh priorityHigh priorityT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
fmt::Arguments<'a>is only parameterized on lifetime. The types of the captured arguments are erased in the contained[ArgumentV1<'a>]. Nothing restricts theArgumentsaggregate from beingSendorSync, so by OIBIT it's both. Thus this compiles:I'm not sure if there are any realistic ways to accidentally abuse this, but here's a deliberate example. The spawned thread will read the
Cellthrough the arguments, even while the main thread modifies it.playground