-
Couldn't load subscription status.
- Fork 13.9k
Closed
Closed
Copy link
Labels
A-collectionsArea: `std::collections`Area: `std::collections`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/SoundnessT-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.
Description
liballoc's test_drain fails when run in Miri. The error occurs in the drain(...).collect() call:
collectis called with avec_deque::Drain<usize>as argument.DraincontainsItercontains a shared reference to a slice; that slice is thus marked as "must not be mutated for the entire duration of this function call".collectcallsfrom_itercallsextendcallsfor_eachcallsfold, which eventually drops theDrain.Drain::dropcallssource_deque.wrap_copyto re-arrange stuff (I have not fully understood this yet), and in some cases this will end up writing to memory that the slice inIterpoints to.
I am not sure what the best way to fix this is. We have to fix Drain holding (indirectly) a shared reference to something that it'll mutate during its Drop. The mutation is likely there for a reason, so I guess the shared reference has to go. (FWIW, this shared reference already caused other trouble, but that was fixed by #56161.)
scottmcm
Metadata
Metadata
Assignees
Labels
A-collectionsArea: `std::collections`Area: `std::collections`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/SoundnessT-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.