Skip to content
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

Cannot have static tuple structs #17649

Closed
carllerche opened this issue Sep 30, 2014 · 0 comments · Fixed by #17722
Closed

Cannot have static tuple structs #17649

carllerche opened this issue Sep 30, 2014 · 0 comments · Fixed by #17722

Comments

@carllerche
Copy link
Member

Right now, if I have the following:

struct Foo(pub uint);

I cannot have a static instance of the struct like so:

static FOO: Foo = Foo(1);

I get the following error:

function calls in constants are limited to struct and enum constructors

Edit: This seems like a dup of #17169

lnicola pushed a commit to lnicola/rust that referenced this issue Jul 28, 2024
fix: Panic in debug profile for tuple deconstruct with arity mismatch

Fixes rust-lang#17585, which doesn't affect daily use cases but quite annoying in development of r-a itself like writing tests.

This PR applies similar approach as in rust-lang#17534, skipping match usefulness check for patterns containing errors
RalfJung pushed a commit to RalfJung/rust that referenced this issue Aug 1, 2024
fix: Panic in debug profile for tuple deconstruct with arity mismatch

Fixes rust-lang#17585, which doesn't affect daily use cases but quite annoying in development of r-a itself like writing tests.

This PR applies similar approach as in rust-lang#17534, skipping match usefulness check for patterns containing errors
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

Successfully merging a pull request may close this issue.

1 participant