Fix unsoundness in Query::for_each_mut (#2045)

This commit is contained in:
TheRawMeatball 2021-04-29 18:12:07 +00:00
parent 85ab55a05b
commit dbf519c1d7

View File

@ -206,7 +206,7 @@ where
/// Runs `f` on each query result. This is faster than the equivalent iter() method, but cannot
/// be chained like a normal [`Iterator`].
#[inline]
pub fn for_each_mut(&self, f: impl FnMut(<Q::Fetch as Fetch<'w>>::Item)) {
pub fn for_each_mut(&mut self, f: impl FnMut(<Q::Fetch as Fetch<'w>>::Item)) {
// SAFE: system runs without conflicts with other systems. same-system queries have runtime
// borrow checks when they conflict
unsafe {