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

Include rustc version in rustc_span::StableCrateId #89836

Merged
merged 2 commits into from
Dec 16, 2021

Conversation

pierwill
Copy link
Member

@pierwill pierwill commented Oct 13, 2021

rustc_span::def_id::StableCrateId is a hash of various data about a crate during compilation. This PR includes the version of rustc in the input when computing this hash. From a cursory reading of RFC 2603, this appears to be acceptable within that design.

In order to pass the mir-opt and ui test suites, this adds new normalization for hashes and symbol names in compiletest. These are enabled by default, but we might prefer it to be configurable.

In the UI tests, I had to truncate a significant amount of error annotations in v0 symbols (and maybe some legacy) in order to get the normalization to work correctly. (See #90116.)

Closes #85142.

@rust-highfive
Copy link
Collaborator

r? @nagisa

(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 Oct 13, 2021
@pierwill
Copy link
Member Author

@bjorn3

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@pierwill pierwill requested a review from bjorn3 October 13, 2021 21:38
@rust-log-analyzer

This comment has been minimized.

@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 14, 2021
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@pierwill pierwill force-pushed the fix-85142-crate-hash branch 2 times, most recently from 0d810e2 to e8e6c99 Compare October 15, 2021 22:42
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@nagisa nagisa left a comment

Choose a reason for hiding this comment

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

There are still a number of tests that seem like they would need some normalization to not require updating every time trains roll over?

Comment on lines 157 to 162
metadata.sort();
// Every distinct -C metadata value is only incorporated once:
metadata.dedup();
Copy link
Member

Choose a reason for hiding this comment

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

Preexisting, but I feel like this logic is better placed in argument parsing, so that this is applied everywhere and consistently. As it is right now, it is very plausible that other places in the code won't dedup and consider -Cmetadata=a distinct from -Cmetadata=a -Cmetadata=a.

Copy link
Member

Choose a reason for hiding this comment

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

I believe this is the only code reading -Cmetadata. I would rather prefer to keep all logic for computing the stable crate id together like it is now.

@pierwill pierwill changed the base branch from master to beta October 18, 2021 17:22
@bors
Copy link
Contributor

bors commented Dec 15, 2021

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 15, 2021
@pierwill
Copy link
Member Author

pierwill commented Dec 15, 2021

Grrr! 🤯 #89836 (comment):

- thread 'main' panicked at 'd was called', $DIR/panic-short-backtrace-windows-x86_64.rs:48:5
+ thread 'main' panicked at 'd was called', $DIR/panic-short-backtrace-windows-x86_64.rs:43:5
3    0: std::panicking::begin_panic
4    1: d

5    2: c
5    2: c
6    3: b
7    4: a
+    5: <T as core::any::Any>::type_id
8 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
9 

@pierwill
Copy link
Member Author

Guess we need to keep some normalization the panic-short-backtrace-windows-x86_64.rs test?

@wesleywiser
Copy link
Member

It's the same target x86_64-pc-windows-msvc as before so I'd suggest just undoing that change. It's possible some other PR has landed in the mean time which rejiggers the layout of functions in the test binary enough that we (once again) have some function other than __rust_begin_short_backtrace as the 5th frame in the stack.

@pierwill
Copy link
Member Author

Done. 👍

@wesleywiser
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Dec 15, 2021

📌 Commit 535278a has been approved by wesleywiser

@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 15, 2021
@bors
Copy link
Contributor

bors commented Dec 16, 2021

⌛ Testing commit 535278a with merge 9e1aff8...

@bors
Copy link
Contributor

bors commented Dec 16, 2021

☀️ Test successful - checks-actions
Approved by: wesleywiser
Pushing 9e1aff8 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 16, 2021
@bors bors merged commit 9e1aff8 into rust-lang:master Dec 16, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 16, 2021
@pierwill pierwill deleted the fix-85142-crate-hash branch December 16, 2021 05:17
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (9e1aff8): comparison url.

Summary: This change led to very large relevant mixed results 🤷 in compiler performance.

  • Very large improvement in instruction counts (up to -11.6% on incr-unchanged builds of tuple-stress)
  • Large regression in instruction counts (up to 4.7% on incr-unchanged builds of unicode_normalization)

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

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression

@rustbot rustbot added the perf-regression Performance regression. label Dec 16, 2021
Mark-Simulacrum added a commit to Mark-Simulacrum/rustc-perf that referenced this pull request Dec 20, 2021
Since rust-lang/rust#89836, rustc stable crate IDs include a hash of the
rustc version (including the git commit it's built from), which means
that hashmaps or other structures have different behavior when comparing
different rustc builds. This is bad for rustc-perf, as it means that
comparing two commits has a source of noise that makes it harder to know
what the actual change between two artifacts is.
Mark-Simulacrum added a commit to Mark-Simulacrum/rustc-perf that referenced this pull request Dec 21, 2021
Since rust-lang/rust#89836, rustc stable crate IDs include a hash of the
rustc version (including the git commit it's built from), which means
that hashmaps or other structures have different behavior when comparing
different rustc builds. This is bad for rustc-perf, as it means that
comparing two commits has a source of noise that makes it harder to know
what the actual change between two artifacts is.
Mark-Simulacrum added a commit to Mark-Simulacrum/rustc-perf that referenced this pull request Dec 21, 2021
Since rust-lang/rust#89836, rustc stable crate IDs include a hash of the
rustc version (including the git commit it's built from), which means
that hashmaps or other structures have different behavior when comparing
different rustc builds. This is bad for rustc-perf, as it means that
comparing two commits has a source of noise that makes it harder to know
what the actual change between two artifacts is.
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. perf-regression Performance regression. 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.

Include rustc version in crate disambiguator