regression: cannot borrow ... as immutable because it is also borrowed as mutable · Issue #135671 · rust-lang/rust (original) (raw)
[INFO] [stdout] error[E0502]: cannot borrow `*inputs` as immutable because it is also borrowed as mutable
[INFO] [stdout] --> examples/basic.rs:267:27
[INFO] [stdout] |
[INFO] [stdout] 263 | if let Some(grd) = inputs[0].grad.as_mut() {
[INFO] [stdout] | -------------- mutable borrow occurs here
[INFO] [stdout] 264 | / *grd += output_grad
[INFO] [stdout] 265 | | * if inputs[0].val > 0.0 {
[INFO] [stdout] 266 | | 1.0
[INFO] [stdout] 267 | | } else if inputs[0].val == 0.0 {
[INFO] [stdout] | | ^^^^^^^^^ immutable borrow occurs here
[INFO] [stdout] ... |
[INFO] [stdout] 270 | | -1.0
[INFO] [stdout] 271 | | };
[INFO] [stdout] | |_________________- mutable borrow later used here