Skip to content

Conversation

@nnethercote
Copy link
Contributor

I think this is useful information. I have worked on derive impls quite a bit and didn't know about this issue until today.

r? @saethlin

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 11, 2025
@saethlin
Copy link
Member

@bors r+ rollup

Read the Zulip thread. I feel like I've heard of this problem before, but maybe just once.

@bors
Copy link
Collaborator

bors commented Nov 11, 2025

📌 Commit c6dbda8 has been approved by saethlin

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 11, 2025
//
// FIXME(#124794): unfortunately this doesn't work with `#[derive(Clone)] #[derive(Copy)]`.
// When the `Clone` impl is generated the `#[derive(Copy)]` hasn't been processed and
// `has_derive_copy` hasn't been set yet.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be done as a MIR pass, or something similar, IMO, instead of having a special hack in resolve.

The current optimization is a terrible hack, that is a best effort attempt to improve on the previous similar optimization hack that was both terrible and incorrect.

bors added a commit that referenced this pull request Nov 11, 2025
Rollup of 13 pull requests

Successful merges:

 - #148694 (std: support `RwLock` and thread parking on TEEOS)
 - #148712 (Port `cfg_select!` to the new attribute parsing system)
 - #148760 (rustc_target: hide TargetOptions::vendor)
 - #148771 (IAT: Reinstate early bailout)
 - #148775 (Fix a typo in the documentation for the strict_shr function)
 - #148779 (Implement DynSend and DynSync for std::panic::Location.)
 - #148781 ([rustdoc] Remove unneeded `allow(rustc::potential_query_instability)`)
 - #148783 (add test for assoc type norm wf check)
 - #148785 (Replace `master` branch references with `main`)
 - #148791 (fix "is_closure_like" doc comment)
 - #148792 (Prefer to use file.stable_id over file.name from source map)
 - #148805 (rustc-dev-guide subtree update)
 - #148807 (Document (and test) a problem with `Clone`/`Copy` deriving.)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 224ff38 into rust-lang:main Nov 11, 2025
11 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Nov 11, 2025
rust-timer added a commit that referenced this pull request Nov 11, 2025
Rollup merge of #148807 - nnethercote:doc-Copy-Clone-problem, r=saethlin

Document (and test) a problem with `Clone`/`Copy` deriving.

I think this is useful information. I have worked on `derive` impls quite a bit and didn't know about this issue until today.

r? `@saethlin`
@nnethercote nnethercote deleted the doc-Copy-Clone-problem branch November 11, 2025 23:41
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Nov 12, 2025
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#148694 (std: support `RwLock` and thread parking on TEEOS)
 - rust-lang/rust#148712 (Port `cfg_select!` to the new attribute parsing system)
 - rust-lang/rust#148760 (rustc_target: hide TargetOptions::vendor)
 - rust-lang/rust#148771 (IAT: Reinstate early bailout)
 - rust-lang/rust#148775 (Fix a typo in the documentation for the strict_shr function)
 - rust-lang/rust#148779 (Implement DynSend and DynSync for std::panic::Location.)
 - rust-lang/rust#148781 ([rustdoc] Remove unneeded `allow(rustc::potential_query_instability)`)
 - rust-lang/rust#148783 (add test for assoc type norm wf check)
 - rust-lang/rust#148785 (Replace `master` branch references with `main`)
 - rust-lang/rust#148791 (fix "is_closure_like" doc comment)
 - rust-lang/rust#148792 (Prefer to use file.stable_id over file.name from source map)
 - rust-lang/rust#148805 (rustc-dev-guide subtree update)
 - rust-lang/rust#148807 (Document (and test) a problem with `Clone`/`Copy` deriving.)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants