Skip to content

Using a named constant in an alt branch binds the value to that name instead #1688

Closed
@jdm

Description

@jdm
const FOO: int = 0;
const BAR: int = 1;

fn main() {
    alt 1 {
      FOO { #debug("FOO") }
      BAR { #debug("BAR") }
    };
}

yields the following error:

constalt.rs:7:6: 7:9 error: unreachable pattern
constalt.rs:7       BAR { #debug("BAR") }
                    ^~~

If this is expected, it's counter-intuitive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions