Skip to content

Make all thir types implement clone #96226

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Apr 22, 2022
Merged

Conversation

xldenis
Copy link
Contributor

@xldenis xldenis commented Apr 19, 2022

This PR adds Clone impl to all of the Thir<'tcx> types.

I would like to be able to clone a Thir body so that I can make a copy in my rustc driver without breaking further compilation. Without this my driver is forced to run in the after_expansion callback and thus doesn't benefit from running all the safety checks that rustc usually does, instead i need to do them all myself.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 19, 2022
@rust-highfive
Copy link
Contributor

r? @petrochenkov

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 19, 2022
@petrochenkov
Copy link
Contributor

I don't know what invariants THIR is supposed to have and why it's not Clone now.
r? @LeSeulArtichaut (as suggested by git blame)

If the Clone impls are added, then you'll need to add a comment to struct Thir explaining why they are necessary, otherwise someone will remove them in some next cleanup.

@petrochenkov
Copy link
Contributor

r? @b-naber

@petrochenkov
Copy link
Contributor

Ok.
r? rust-lang/compiler

@oli-obk
Copy link
Contributor

oli-obk commented Apr 22, 2022

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Apr 22, 2022

📌 Commit eed91ee has been approved by oli-obk

@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 Apr 22, 2022
@bors
Copy link
Collaborator

bors commented Apr 22, 2022

⌛ Testing commit eed91ee with merge 41ef767...

@bors
Copy link
Collaborator

bors commented Apr 22, 2022

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing 41ef767 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 22, 2022
@bors bors merged commit 41ef767 into rust-lang:master Apr 22, 2022
@rustbot rustbot added this to the 1.62.0 milestone Apr 22, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (41ef767): comparison url.

Summary:

  • Primary benchmarks: 😿 relevant regressions found
  • Secondary benchmarks: no relevant changes found
Regressions 😿
(primary)
Regressions 😿
(secondary)
Improvements 🎉
(primary)
Improvements 🎉
(secondary)
All 😿 🎉
(primary)
count1 2 0 0 0 2
mean2 0.5% N/A N/A N/A 0.5%
max 0.6% N/A N/A N/A 0.6%

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

Footnotes

  1. number of relevant changes

  2. the arithmetic mean of the percent change

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.

7 participants