Skip to content

cannot borrow *self as immutable #561

@est31

Description

@est31

Hi, as I'm seeing Rust developers getting serious about enabling the new borrow checker on the 2015 edition (rust-lang/rust#57804 / rust-lang/rust#59114), I compiled my local project with RUSTFLAGS="-Zborrowck=migrate -Ztwo-phase-borrows" cargo +nightly check to test for any possible future problems.

When it compiled nalgebra 0.16.13 for me, I got multiple newly introduced compiler warnings. Even on nalgebra master, I'm getting one compiler warning:

warning[E0502]: cannot borrow `*self` as immutable because it is also borrowed as mutable
   --> src/base/cg.rs:297:44
    |
297 |                 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

I'd love a fix of the issue and a new crates.io release soon after that. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions