Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Specialize try_destructure_mir_constant for its sole user (pretty printing) #113291

Merged
merged 7 commits into from
Jul 6, 2023

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Jul 3, 2023

We can't remove the query, as we need to invoke it from rustc_middle, but can only implement it in mir interpretation/const eval.

r? @RalfJung for a first round.

While we could move all the logic into pretty printing, that would end up duplicating a bit of code with const eval, which doesn't seem great either.

@rustbot
Copy link
Collaborator

rustbot commented Jul 3, 2023

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @RalfJung (or someone else) soon.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@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 Jul 3, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jul 3, 2023

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

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

We can't remove the query, as we need to invoke it from rustc_middle, but can only implement it in mir interpretation/const eval.

Ah, that is unfortunate, but it makes sense.

Can you change the name and docs of the query to reflect that it is to be used for diagnostic purposes only?

compiler/rustc_middle/src/ty/print/pretty.rs Outdated Show resolved Hide resolved
@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Jul 5, 2023

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

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

LGTM. Feel free to r=me, or get someone else's review as well.

(I assume we have tests ensuring that the printed output is not affected.)

Comment on lines +1095 to +1096
no_hash
eval_always
Copy link
Member

Choose a reason for hiding this comment

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

I have no idea what these do so I will just trust they make sense. ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mostly turning the query into a glorified function pointer (caching disabled). I think we have a better way nowadays, but I need to look it up

@oli-obk
Copy link
Contributor Author

oli-obk commented Jul 5, 2023

@bors r=RalfJung

@bors
Copy link
Contributor

bors commented Jul 5, 2023

📌 Commit 3dfc7ec has been approved by RalfJung

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 Jul 5, 2023
@bors
Copy link
Contributor

bors commented Jul 6, 2023

⌛ Testing commit 3dfc7ec with merge bd8aabe...

@bors
Copy link
Contributor

bors commented Jul 6, 2023

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing bd8aabe to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 6, 2023
@bors bors merged commit bd8aabe into rust-lang:master Jul 6, 2023
11 checks passed
@rustbot rustbot added this to the 1.72.0 milestone Jul 6, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (bd8aabe): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.7% [-2.7%, -2.7%] 1
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 658.504s -> 657.658s (-0.13%)

@oli-obk oli-obk deleted the pretty_print_mir_const branch July 6, 2023 06:33
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jul 14, 2023
…lfJung

Specialize `try_destructure_mir_constant` for its sole user (pretty printing)

We can't remove the query, as we need to invoke it from rustc_middle, but can only implement it in mir interpretation/const eval.

r? `@RalfJung` for a first round.

While we could move all the logic into pretty printing, that would end up duplicating a bit of code with const eval, which doesn't seem great either.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

6 participants