rust-lang / rust-lang/rfcs

Enum of named structs boilerplate

Open
#3,661 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Markdown
Stars
6.6k
Forks
1.7k
Avg merge
16h 14m
Merged PRs (30d)
1

Description

Enum of named structs is one of usual patterns:

struct Foo {}
struct Bar {}

enum FooBar {
    Foo(Foo),
    Bar(Bar),
}

Are there any ways to reduce the amount of boilerplate if it's ever needed? I've thought of something like this:

enum FooBar {
    Foo(_),
    Bar(_),
}

I'm not sure if it's appropriate to denote it this way using InferredType.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue contains only illustrative Rust enum and struct snippets, with no implementation file or test named. Start by clarifying the intended syntax and semantics for inferred payload types, then determine whether the resolved proposal belongs in an RFC; done means the design has a clear decision and documented behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.