Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive: "Cannot borrow immutable local variable as mutable" #2865

Closed
pwlodarczyk92 opened this issue Sep 18, 2018 · 0 comments
Closed
Assignees
Labels
bug subsystem::code insight General label for issues related to code understanding: highlighting, completion, annotation, etc.

Comments

@pwlodarczyk92
Copy link

pwlodarczyk92 commented Sep 18, 2018

Environment

  • Intellij-Rust plugin version: 0.2.0.2422-182-nightly
  • Rust toolchain version: rustc 1.30.0-nightly (cb6d2dfa8 2018-09-16)
  • IDE name and version: IntelliJ IDEA Ultimate 2018.2.3
  • Operating system: Ubuntu 16.04 LTS

Problem description

Mutably borrowing field from immutably bound mutable struct reference is incorrectly reported as an error.

Steps to reproduce

fn main() {
    let mut x = (0, 0);
    let y = &mut x;
    let _z = &mut y.0;
}

Cannot borrow immutable local variable y.0 as mutable

@Undin Undin added subsystem::code insight General label for issues related to code understanding: highlighting, completion, annotation, etc. bug labels Sep 18, 2018
@artemmukhin artemmukhin self-assigned this Sep 19, 2018
bors bot added a commit that referenced this issue Sep 27, 2018
2867: Fix tuple categorization: add deref adjustments, use index as field name r=vlad20012 a=ortem

Fixes #2865 

Co-authored-by: ortem <ortem00@gmail.com>
bors bot added a commit that referenced this issue Sep 27, 2018
2867: Fix tuple categorization: add deref adjustments, use index as field name r=vlad20012 a=ortem

Fixes #2865 

Co-authored-by: ortem <ortem00@gmail.com>
@bors bors bot closed this as completed in #2867 Sep 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug subsystem::code insight General label for issues related to code understanding: highlighting, completion, annotation, etc.
Projects
None yet
Development

No branches or pull requests

3 participants