Commit f696f2a
committed
Tweak how we create raw views in accumulate_axis_inplace
We had:
1. let ptr1 = self.raw_view(); // Borrow &self
2. let ptr2 = self.raw_view_mut(); // Borrow &mut self
3. Use ptr1 and ptr2
While I'm not an expert at the unsafe coding guidelines for Rust, and
there are more places in ndarray to revisit, I think it's best to change
change 1 and 2 - they don't pass my internalized borrow checker.
It seems as though the steps 1, 2, 3 could be against the rules as ptr1
is borrowed from the array data, and its scope straddles the mut borrow
of the array data in 2.
For this reason, I think this would be better:
1. let ptr2 = self.raw_view_mut() // Borrow &mut self
2. let ptr1 = derive from ptr2
3. use ptr1 and ptr2
RawView should hopefully be our ally in making a better ndarray from the
foundation.1 parent bcd7078 commit f696f2a
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2268 | 2268 | | |
2269 | 2269 | | |
2270 | 2270 | | |
2271 | | - | |
| 2271 | + | |
| 2272 | + | |
2272 | 2273 | | |
2273 | | - | |
2274 | 2274 | | |
2275 | 2275 | | |
2276 | 2276 | | |
| |||
0 commit comments