Skip to content

Conversation

hkBst
Copy link
Member

@hkBst hkBst commented Sep 5, 2025

Fixes clippy warning:

warning: non-canonical implementation of `clone` on a `Copy` type
  --> compiler/rustc_query_impl/src/lib.rs:60:29
   |
60 |       fn clone(&self) -> Self {
   |  _____________________________^
61 | |         DynamicConfig { dynamic: self.dynamic }
62 | |     }
   | |_____^ help: change this to: `{ *self }`

@rustbot
Copy link
Collaborator

rustbot commented Sep 5, 2025

r? @SparrowLii

rustbot has assigned @SparrowLii.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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 Sep 5, 2025
@hkBst
Copy link
Member Author

hkBst commented Sep 5, 2025

I tried changing the manual Copy and Clone impls to a derive clause, but that ends up causing lots of unsatisfied trait bounds. I don't understand why that does not work. The single shared reference member should impl Copy, and the automatically derived impls should be identical to the manual impls AFAICT. Apparently I'm wrong about this somehow. Would love to understand!

@cjgillot
Copy link
Contributor

cjgillot commented Sep 6, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Sep 6, 2025

📌 Commit a641cfc has been approved by cjgillot

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 Sep 6, 2025
@cjgillot
Copy link
Contributor

cjgillot commented Sep 6, 2025

Just using a derive will introduce a C: Clone or a C: Copy bound. That bound fails because a QueryCache is not meant to be cloned.

bors added a commit that referenced this pull request Sep 7, 2025
Rollup of 4 pull requests

Successful merges:

 - #146200 (Simplify rustdoc-gui tester by calling directly browser-ui-test)
 - #146236 (gpu offload: change suspicious map into filter)
 - #146240 (DynamicConfig: use canonical clone impl)
 - #146251 (rustc_middle: clippy fixes)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit bb27a2b into rust-lang:master Sep 7, 2025
10 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Sep 7, 2025
rust-timer added a commit that referenced this pull request Sep 7, 2025
Rollup merge of #146240 - hkBst:query-1, r=cjgillot

DynamicConfig: use canonical clone impl

Fixes clippy warning:
```text
warning: non-canonical implementation of `clone` on a `Copy` type
  --> compiler/rustc_query_impl/src/lib.rs:60:29
   |
60 |       fn clone(&self) -> Self {
   |  _____________________________^
61 | |         DynamicConfig { dynamic: self.dynamic }
62 | |     }
   | |_____^ help: change this to: `{ *self }`
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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