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

NLL migrate mode: issues two errors for move out of single static item #55309

Closed
pnkfelix opened this issue Oct 24, 2018 · 3 comments
Closed
Assignees
Labels
A-NLL Area: Non-lexical lifetimes (NLL) NLL-diagnostics Working towards the "diagnostic parity" goal

Comments

@pnkfelix
Copy link
Member

pnkfelix commented Oct 24, 2018

This code (play)

struct S;
pub fn main() {
    let _y = { static x: S = S; x };
}

issues the following diagnostics under migrate mode:

error[E0507]: cannot move out of static item
 --> src/main.rs:3:33
  |
3 |     let _y = { static x: S = S; x };
  |                                 ^
  |                                 |
  |                                 cannot move out of static item
  |                                 help: consider borrowing here: `&x`

error[E0507]: cannot move out of immutable static item `x`
 --> src/main.rs:3:33
  |
3 |     let _y = { static x: S = S; x };
  |                                 ^
  |                                 |
  |                                 cannot move out of immutable static item `x`
  |                                 cannot move

error: aborting due to 2 previous errors

It issues only a single error under either of AST-borrowck or pure NLL.

@pnkfelix
Copy link
Member Author

(This is obviously one particular instance of #53004)

@pnkfelix
Copy link
Member Author

pnkfelix commented Oct 24, 2018

This should be fixed by PR #55221

@matthewjasper matthewjasper self-assigned this Oct 26, 2018
@matthewjasper
Copy link
Contributor

Fixed in the latest nightly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-NLL Area: Non-lexical lifetimes (NLL) NLL-diagnostics Working towards the "diagnostic parity" goal
Projects
None yet
Development

No branches or pull requests

2 participants