dimforge / dimforge/nalgebra

1.36 borrow checker warns about possible undefined behavior

Open
#616 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Rust
Stars
4.8k
Forks
565
PR merge metrics
No merged PRs in 30d

Description

Rust 1.36 (stable) raises a warning from the new borrow checker that will be come an error in the future, and represents potentially undefined behavior. Maybe related to this issue: https://github.com/rustsim/nalgebra/issues/561

See also: https://blog.rust-lang.org/2019/07/04/Rust-1.36.0.html#nll-for-rust-2015

```
warning[E0502]: cannot borrow `*self` as immutable because it is also borrowed as mutable
--> /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/nalgebra-0.16.13/src/base/cg.rs:291:44
|
291 | self[(j, i)] += shift[j] * self[(D::dim() - 1, i)];
| ---------------------------^^^^-------------------
| | |
| | immutable borrow occurs here
| mutable borrow occurs here
| mutable borrow later used here
|
= warning: this error has been downgraded to a warning for backwards compatibility with previous releases
= warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.