Skip to content

incorrect "cannot assign twice to immutable variable _" with try_blocks + never_type + nll #62165

Closed
@goffrie

Description

@goffrie

The following program:

#![feature(nll)]
#![feature(never_type)]
#![feature(try_blocks)]

fn main() {
    loop {
        let _x: Result<_, ()> = try {
            Err(())?;
        };
    }
}

now produces the following error, as of 2019-06-27:

error[E0384]: cannot assign twice to immutable variable `_`
 --> src/main.rs:8:13
  |
8 |             Err(())?;
  |             ^^^^^^^^ cannot assign twice to immutable variable

error: aborting due to previous error

For more information about this error, try `rustc --explain E0384`.

(note that the playground link currently compiles; I think it's on an older nightly?)

From bisection, this appears to be a regression from #61872 (cc @matthewjasper).

Oddly, removing #![feature(never_type)] causes the problem to disappear.

Metadata

Metadata

Assignees

Labels

A-NLLArea: Non-lexical lifetimes (NLL)C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions