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

Provide a Shorthand for adding Send bounds

Open
#18 1 comment 16 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

Hey everyone,

it would be great if we could have a shorthand for making a trait Send only, like this:

#[trait_variant::only_send]
pub trait SomeTrait {
  async fn hello() -> i32;
}

desugaring to

pub trait SomeTrait: Send {
  fn hello() -> impl Future<Output = i32> + Send;
}

(no second variant)

The rationale behind it being that with the mostly Multithreaded Executors that are used widely right now (like tokio), this will probably be the default case once AFIT is becoming stable on 28th.

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

No files or tests are named. Start by reading the repository's existing trait_variant handling and compare it with the requested #[trait_variant::only_send] syntax and desugaring; done means the shorthand produces a single Send-bound trait variant with the stated async method behavior and has coverage for that transformation.

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
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.