fn fork_join(mut A: Mat<f64>) {
let mut guards = vec![];
for stripe in A.hstripes_mut(100) {
for block in stripe.vstripes_mut(100) {
//~^ error: `stripe` does not live long enough
guards.push(thread::scoped(|| { block; }));
}
}
}
The problem is the signature of iter_mut, it borrows the sub-matrix rather than re-borrowing the original data. Two ways to fix this:
Add user-defined unsized types to get proper re-borrow semantics.
Change the signature of iter_mut (and several other similar functions) to take the caller by value.
The problem is the signature of
iter_mut
, it borrows the sub-matrix rather than re-borrowing the original data. Two ways to fix this:iter_mut
(and several other similar functions) to take the caller by value.