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

borrow check doesn't distinguish different tuple elements in match expression #5362

Closed
thestinger opened this Issue Mar 13, 2013 · 4 comments

Comments

Projects
None yet
3 participants
@thestinger
Contributor

thestinger commented Mar 13, 2013

enum Foo {
    X, Y(uint, uint)
}

fn main() {
    // works
    let mut x = (1, 2);
    let (ref _k, ref mut _v) = x;

    // doesn't work
    let mut y = Y(1, 2);
    match y {
      Y(ref _v, ref mut _k) => {}

      // error: loan of enum content as mutable conflicts with prior loan
      // Y(ref _v, ref mut _k) => {}
      //           ^~~~~~~~~~~
      // note: prior loan as immutable granted here
      // Y(ref _v, ref mut _k) => {}
      //   ^~~~~~~

      X => ()
    }
}

@ghost ghost assigned nikomatsakis Mar 13, 2013

@nikomatsakis

This comment has been minimized.

Show comment
Hide comment
@nikomatsakis

nikomatsakis Mar 13, 2013

Contributor

problem is that the mem_categorization structures don't consider the index into a tuple

Contributor

nikomatsakis commented Mar 13, 2013

problem is that the mem_categorization structures don't consider the index into a tuple

@bstrie

This comment has been minimized.

Show comment
Hide comment
@bstrie

bstrie May 6, 2013

Contributor

Still reproduces, but try again once the new borrowck lands.

Contributor

bstrie commented May 6, 2013

Still reproduces, but try again once the new borrowck lands.

@nikomatsakis

This comment has been minimized.

Show comment
Hide comment
@nikomatsakis

nikomatsakis May 7, 2013

Contributor

This is not yet fixed, but it would be easy to do so. I was trying to avoid making the patch bigger than otherwise necessary.

Contributor

nikomatsakis commented May 7, 2013

This is not yet fixed, but it would be easy to do so. I was trying to avoid making the patch bigger than otherwise necessary.

@nikomatsakis

This comment has been minimized.

Show comment
Hide comment
@nikomatsakis

nikomatsakis May 22, 2013

Contributor

Fixed now.

Contributor

nikomatsakis commented May 22, 2013

Fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment