Assignee expressions can be enums
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- rust
- Domain
- documentation
Research direction
Start with the assignee expressions section of the Rust Reference linked in the issue, and read issue #2208 for related context. Compare the documented struct rule with the enum examples shown here, then update the reference so the supported enum case and its irrefutability condition are accurately described.
Written by the indexing model from the issue text.
Description
See also #2208 for more on assignee expressions.
The following code compiles:
enum Never {}
enum Foo {
Variant,
}
enum Bar {
One,
Two(Never),
}
fn main() {
Foo::Variant = Foo::Variant;
Bar::One = Bar::One;
}
However, the reference doesn't say that enums can be used in assignee expressions. It only mentions that structs can be used there.
But based on how the compiler behaves, it seems that enums can be used in assignee expressions, as long as it's "irrefutable".
- Dominant language
- Rust
- Stars
- 1.6k
- Forks
- 607
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 12
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rust-lang/reference
-
A-const-eval A-undefined-behavior
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
A-resolve
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
A-coercions
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Define *target* OpenA-glossary
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
All issues in rust-lang/reference
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug team:backend track:services-maintenance
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
cowprotocol/services#4950 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·