Skip to content

regression: cannot borrow ... as immutable because it is also borrowed as mutable #135671

Closed
@BoxyUwU

Description

@BoxyUwU
[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

Metadata

Metadata

Assignees

Labels

P-criticalCritical priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions