Skip to content

Seemingly bogus "unsupported constant expr" #15315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
simias opened this issue Jul 1, 2014 · 3 comments
Closed

Seemingly bogus "unsupported constant expr" #15315

simias opened this issue Jul 1, 2014 · 3 comments

Comments

@simias
Copy link

simias commented Jul 1, 2014

The following code builds and runs fine:

struct S(i32);

static S0: S = S(0);

fn main() {
    let d = S0;

    println!("{}",
             match d {
                 S(0) => true,
                 _  => false,
             });
}

However attempting to match 'd' against 'S0' produces an error at the declaration of S0:

struct S(i32);

static S0: S = S(0);

fn main() {
    let d = S0;

    println!("{}",
             match d {
                 S0 => true,
                 _  => false,
             });
}
test.rs:3:16: 3:20 error: unsupported constant expr
test.rs:3 static S0: S = S(0);
                         ^~~~
@ghost
Copy link

ghost commented Jul 2, 2014

Duplicate of #6533 (and #13626 and #13731, really).

@simias
Copy link
Author

simias commented Jul 2, 2014

Thanks for the pointers, I'm closing then.

@simias simias closed this as completed Jul 2, 2014
@ghost
Copy link

ghost commented Jul 2, 2014

Thanks for the bug report! I have a plan on how to address this, probably this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant