Skip to content

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

Closed
@pnkfelix

Description

@pnkfelix
Member

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.

Activity

pnkfelix

pnkfelix commented on Oct 24, 2018

@pnkfelix
MemberAuthor

(This is obviously one particular instance of #53004)

added
A-NLLArea: Non-lexical lifetimes (NLL)
NLL-diagnosticsWorking towards the "diagnostic parity" goal
on Oct 24, 2018
pnkfelix

pnkfelix commented on Oct 24, 2018

@pnkfelix
MemberAuthor

This should be fixed by PR #55221

matthewjasper

matthewjasper commented on Oct 30, 2018

@matthewjasper
Contributor

Fixed in the latest nightly

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

Metadata

Metadata

Assignees

Labels

A-NLLArea: Non-lexical lifetimes (NLL)NLL-diagnosticsWorking towards the "diagnostic parity" goal

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @pnkfelix@matthewjasper

      Issue actions

        NLL migrate mode: issues two errors for move out of single static item · Issue #55309 · rust-lang/rust