Closed
Description
openedon Apr 18, 2019
liballoc's test_drain
fails when run in Miri. The error occurs in the drain(...).collect()
call:
collect
is called with avec_deque::Drain<usize>
as argument.Drain
containsIter
contains a shared reference to a slice; that slice is thus marked as "must not be mutated for the entire duration of this function call".collect
callsfrom_iter
callsextend
callsfor_each
callsfold
, which eventually drops theDrain
.Drain::drop
callssource_deque.wrap_copy
to re-arrange stuff (I have not fully understood this yet), and in some cases this will end up writing to memory that the slice inIter
points 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.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment