Skip to content

static tuple used as a match arm yields weird error #14576

Closed
@alan-andrade

Description

@alan-andrade

hello rusties,

I have a program similar to this:

type Foo = (i32, i32);
static ON: Foo = (1, 1);
static OFF: Foo = (0, 0);

fn main() {
    match (1, 1) {
        ON => { println!("{}" , ON) },
        OFF => { println!("{}" , OFF) }
    }
}

When I try to compile I get the following error:

<anon>:2:18: 2:24 error: unsupported constant expr
<anon>:2 static ON: Foo = (1, 1);
                          ^~~~~~

Is this behavior expected?
http://j.mp/1kjSiMc

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