liballoc's test_drain fails when run in Miri. The error occurs in the drain(...).collect() call:
collect is called with a vec_deque::Drain<usize> as argument. Drain contains Iter 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 calls from_iter calls extend calls for_each calls fold, which eventually drops the Drain.
Drain::drop calls source_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 in Iter 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.)
Cc @nikomatsakis @gankro
liballoc's
test_drainfails when run in Miri. The error occurs in thedrain(...).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
Drainholding (indirectly) a shared reference to something that it'll mutate during itsDrop. 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.)Cc @nikomatsakis @gankro