rust-lang / rust-lang/rust

TrivialClone is not derived for generic types (Performance regression)

Open
#149,752 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-macros A-specialization C-bug P-high regression-from-stable-to-stable T-compiler T-libs T-types
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I used the "expand macros" button on the following code on the playground:

#[derive(Clone, Copy)]
struct Thing<T>(T);

I expected the expanded code to contain a TrivialClone impl of some sort, as per https://github.com/rust-lang/rust/pull/135634. Instead, there is no such impl.

cc @joboet

Meta

Reproducible on the playground with version 1.94.0-nightly (2025-12-06 ba86c0460b0233319e01)

Contributor guide

Open the contributing guide

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

Reproduce the expansion of the generic Thing example in the Rust Playground using nightly 1.94.0 (2025-12-06 ba86c0460b0233319e01). Read the behavior described in PR 135634 and trace the compiler's derive expansion for Clone and Copy. Done means the expanded generic type includes the expected TrivialClone implementation without regressing the existing expansion.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.