Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

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

Closed

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.

Activity

  1. added
    A-NLL
    C-bug
    T-compiler
    on Jun 27, 2019
  2. matthewjasper commented on Jun 27, 2019

    @matthewjasper
    Contributor

    Minimised:

    #![feature(nll, never_type)]
    
    pub fn main() {
        loop {
            match None {
                None => return,
                Some(val) => val,
            };
        };
    }
  3. added a commit that references this issue on Jul 10, 2019
    5760bc6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-NLLC-bugT-compiler

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions