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

Tweak short_ty_string to reduce number of files #118389

Merged
merged 1 commit into from
Dec 14, 2023

Conversation

estebank
Copy link
Contributor

When shortening types and writing them to disk, make short_ty_string capable of reusing the same file, instead of writing a file per shortened type.

@rustbot
Copy link
Collaborator

rustbot commented Nov 27, 2023

r? @b-naber

(rustbot has picked a reviewer for you, use r? to override)

@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 27, 2023
compiler/rustc_middle/src/ty/error.rs Outdated Show resolved Hide resolved
err.span_label(
span,
format!(
"the trait `{}` is not implemented for `{}`",
old_pred.print_modifiers_and_trait_path(),
old_pred.self_ty().skip_binder(),
self.tcx.short_ty_string(old_pred.self_ty().skip_binder(), &mut file),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why introduce short_ty_string here? I'm not sure that the lifetime bounds we get with this change are really preferable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Although I agree that the prior output is likely "better", if we let the full type leak anywhere we have the real risk of ending up with a "wall of text" in some case. We could as a follow up change it so short_ty_string has the same output we had prior instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

But did you really handle all occurrences where types are printed in diagnostics in this PR? I would have expected many more changes in the diffs in the tests if that was the case. And if you haven't, I find this change kind of arbitrary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@b-naber I addressed all that I could find searching the codebase. There are many that we had already handled and this was an effort to find any stragglers.

@b-naber
Copy link
Contributor

b-naber commented Dec 13, 2023

Thanks for clarifying. This looks good to me. r=me

When shortening types and writing them to disk, make `short_ty_string`
capable of reusing the same file, instead of writing a file per
shortened type.
@estebank
Copy link
Contributor Author

@bors r=b-naber

@bors
Copy link
Contributor

bors commented Dec 13, 2023

📌 Commit 9d846fc has been approved by b-naber

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 Dec 13, 2023
@bors
Copy link
Contributor

bors commented Dec 14, 2023

⌛ Testing commit 9d846fc with merge 5f73b00...

@bors
Copy link
Contributor

bors commented Dec 14, 2023

☀️ Test successful - checks-actions
Approved by: b-naber
Pushing 5f73b00 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 14, 2023
@bors bors merged commit 5f73b00 into rust-lang:master Dec 14, 2023
12 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Dec 14, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (5f73b00): 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)

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)
4.4% [4.4%, 4.4%] 1
Improvements ✅
(primary)
-1.5% [-3.2%, -0.5%] 5
Improvements ✅
(secondary)
-4.2% [-4.2%, -4.2%] 1
All ❌✅ (primary) -1.5% [-3.2%, -0.5%] 5

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)
1.0% [1.0%, 1.0%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.6% [-0.6%, -0.6%] 1
Improvements ✅
(secondary)
-3.5% [-4.6%, -2.5%] 3
All ❌✅ (primary) 0.2% [-0.6%, 1.0%] 2

Binary size

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

Bootstrap: 671.988s -> 673.133s (0.17%)
Artifact size: 312.40 MiB -> 312.44 MiB (0.01%)

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.

5 participants