rust-lang / rust-lang/impl-trait-utils

Support syn::Pat::Wild pattern in method signatures

Open
#21 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
134
Forks
13
PR merge metrics
No merged PRs in 30d

Description

This issue relevant after #20 merges, but is not a result of the PR.

Assuming #20, the following fails to compile:

enum Abort {
    Yes,
    No,
}

#[trait_variant::make(Example: Send)]
trait LocalExample {
    async fn should_abort(_: String) -> Abort {
        Abort::No
    }
}

The reason is the unsupported pattern _, tracing back to this error:

https://github.com/rust-lang/impl-trait-utils/blob/6a5e7abb09cfc689258a8cd630ceeb8597e4e3e9/trait-variant/src/variant.rs#L199

Giving the variable a name is possible, of course, but leads to the slight inconvenience of requiring allow(clippy::no_effect_underscore_binding) and allow(clippy::used_underscore_binding).

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

After #20 merges, reproduce the failing example and start at trait-variant/src/variant.rs around line 199, where the unsupported pattern is reported. Trace how method-signature patterns are handled and verify that the example with _ compiles successfully, adding focused coverage if the existing tests expose the relevant path.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.