Skip to content

Compiler keeps running after it emits a compilation error #51374

Closed
@DutchGhost

Description

@DutchGhost

The following code does not compile, however the compiler keeps running after emitting a message it could not compile:
https://play.rust-lang.org/?gist=7dc801439d22e1d11c9025092d757099&version=stable&mode=debug

const q: () = 'a: while (continue 'a != break 'a) {};

fn main() {
    let q: ();
}

The error is:

|                                         ^^^^^^^^
  |
  = note: #[warn(unreachable_code)] on by default

error[E0019]: constant contains unimplemented expression type
 --> src/main.rs:1:26
  |
1 | const q: () = 'a: while (continue 'a != break 'a) {};
  |                          ^^^^^^^^^^^

warning: Constant evaluating a complex constant, this might take some time
 --> src/main.rs:1:1
  |
1 | const q: () = 'a: while (continue 'a != break 'a) {};
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

when let q: (); is removed, it just fails to compile, and rustc stops running.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions