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

Move things to rustc_type_ir #97287

Merged
merged 5 commits into from
May 29, 2022
Merged

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented May 22, 2022

Finishes some work proposed in rust-lang/compiler-team#341.

r? @ghost

@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels May 22, 2022
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request May 23, 2022
…idtwco

Lifetime variance fixes for rustc

rust-lang#97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be unified by shortening both to some common lifetime.

This is doable, since many lifetimes are already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`.

Split out from rust-lang#97287 so the compiler team can review independently.
JohnTitor added a commit to JohnTitor/rust that referenced this pull request May 24, 2022
…rk-Simulacrum

Lifetime variance fixes for clippy

rust-lang#97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be shortened to some common lifetime.

This is doable, since everything is already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`.

Split out from rust-lang#97287 so the clippy team can review independently.
@bors
Copy link
Contributor

bors commented May 24, 2022

☔ The latest upstream changes (presumably #97342) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 24, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request May 24, 2022
…ylan-DPC

Lifetime variance fixes for rustdoc

rust-lang#97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be unified by shortening both to some common lifetime.

This is doable, since everything is already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`.

Split out from rust-lang#97287 so the rustdoc team can review independently.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request May 24, 2022
…ylan-DPC

Lifetime variance fixes for rustdoc

rust-lang#97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be unified by shortening both to some common lifetime.

This is doable, since everything is already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`.

Split out from rust-lang#97287 so the rustdoc team can review independently.
bors added a commit to rust-lang-ci/rust that referenced this pull request May 24, 2022
…pes-in-a-trenchcoat, r=cjgillot

Split out the various responsibilities of `rustc_metadata::Lazy`

`Lazy<T>` actually acts like three different types -- a pointer in the crate metadata to a single value, a pointer to a list/array of values, and an indexable pointer of a list of values (a table).

We currently overload `Lazy<T>` to work differently than `Lazy<[T]>` and the same for `Lazy<Table<I, T>>`. All is well with some helper adapter traits such as [`LazyQueryDecodable`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/decoder/trait.LazyQueryDecodable.html) and [`EncodeContentsForLazy`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_metadata/rmeta/encoder/trait.EncodeContentsForLazy.html).

Well, changes in rust-lang#97287 that make `Lazy` work with the now invariant lifetime `'tcx` make these adapters fall apart because of coherence reasons. So we split out these three types and rework some of the helper traits so it's both 1. more clear to understand, and 2. compatible with the changes later in that PR.

Split out from rust-lang#97287 so it can be reviewed separately, since this PR stands on its own.
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request May 24, 2022
…ylan-DPC

Lifetime variance fixes for rustdoc

rust-lang#97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be unified by shortening both to some common lifetime.

This is doable, since everything is already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`.

Split out from rust-lang#97287 so the rustdoc team can review independently.
compiler/rustc_middle/src/ty/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_type_ir/src/sty.rs Show resolved Hide resolved
compiler/rustc_middle/src/ty/vtable.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/sty.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_type_ir/src/sty.rs Outdated Show resolved Hide resolved
@compiler-errors
Copy link
Member Author

@rustbot author

Will address @jackh726's comments and need to fix the clippy lint.

@rust-log-analyzer

This comment has been minimized.

@jackh726
Copy link
Member

I think the "Make Lazy not care about lifetimes until decode" commit can also be split out into a separate PR?

@compiler-errors compiler-errors removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels May 28, 2022
Comment on lines +102 to +103
type Mutability = hir::Mutability;
type Movability = hir::Movability;
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably check if we can start moving some of these types into rustc_type_ir

Copy link
Member

Choose a reason for hiding this comment

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

Yes, we can. When I originally wrote this, the idea was to be as small as possible by trading extra associated types.

@oli-obk
Copy link
Contributor

oli-obk commented May 29, 2022

@bors r=jackh726,oli-obk

@bors
Copy link
Contributor

bors commented May 29, 2022

📌 Commit 4638915 has been approved by jackh726,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 May 29, 2022
@bors
Copy link
Contributor

bors commented May 29, 2022

⌛ Testing commit 4638915 with merge 0f06824...

@bors
Copy link
Contributor

bors commented May 29, 2022

☀️ Test successful - checks-actions
Approved by: jackh726,oli-obk
Pushing 0f06824 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 29, 2022
@bors bors merged commit 0f06824 into rust-lang:master May 29, 2022
@rustbot rustbot added this to the 1.63.0 milestone May 29, 2022
@rust-highfive
Copy link
Collaborator

📣 Toolstate changed by #97287!

Tested on commit 0f06824.
Direct link to PR: #97287

💔 miri on windows: test-fail → build-fail (cc @eddyb @oli-obk @RalfJung).
💔 miri on linux: test-fail → build-fail (cc @eddyb @oli-obk @RalfJung).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request May 29, 2022
Tested on commit rust-lang/rust@0f06824.
Direct link to PR: <rust-lang/rust#97287>

💔 miri on windows: test-fail → build-fail (cc @eddyb @oli-obk @RalfJung).
💔 miri on linux: test-fail → build-fail (cc @eddyb @oli-obk @RalfJung).
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (0f06824): comparison url.

Instruction count

  • Primary benchmarks: 😿 relevant regressions found
  • Secondary benchmarks: 😿 relevant regressions found
mean1 max count2
Regressions 😿
(primary)
0.5% 0.7% 9
Regressions 😿
(secondary)
1.1% 1.1% 3
Improvements 🎉
(primary)
N/A N/A 0
Improvements 🎉
(secondary)
N/A N/A 0
All 😿🎉 (primary) 0.5% 0.7% 9

Max RSS (memory usage)

Results
  • Primary benchmarks: mixed results
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
2.8% 3.2% 2
Regressions 😿
(secondary)
3.2% 4.7% 3
Improvements 🎉
(primary)
-2.3% -2.3% 1
Improvements 🎉
(secondary)
-1.3% -1.4% 2
All 😿🎉 (primary) 1.1% 3.2% 3

Cycles

Results
  • Primary benchmarks: 🎉 relevant improvement found
  • Secondary benchmarks: mixed results
mean1 max count2
Regressions 😿
(primary)
N/A N/A 0
Regressions 😿
(secondary)
3.9% 3.9% 1
Improvements 🎉
(primary)
-3.1% -3.1% 1
Improvements 🎉
(secondary)
-2.9% -3.4% 2
All 😿🎉 (primary) -3.1% -3.1% 1

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

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

@jackh726
Copy link
Member

Yay

@pnkfelix
Copy link
Member

  • During development, this PR was identified as regressing one primary benchmark, bitmaps (in a variety of contexts), and the PR author said better to take that perf hit and deal with it later.
  • In the PR that landed, the number of regressing variants was smaller, but the affected set of benchmarks slightly larger: both bitmaps and unicode-normalization are affected, regressing by 0.35% to 0.70%.
  • My very brief inpsection of the flamegraphs (old, new) didn't show any smoking guns.
  • At this point I think we can just live with this performance hit.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label May 31, 2022
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 4, 2022
…rk-Simulacrum

Lifetime variance fixes for clippy

rust-lang#97287 migrates rustc to a `Ty` type that is invariant over its lifetime `'tcx`, so I need to fix a bunch of places that assume that `Ty<'a>` and `Ty<'b>` can be shortened to some common lifetime.

This is doable, since everything is already `'tcx`, so all this PR does is be a bit more explicit that elided lifetimes are actually `'tcx`.

Split out from rust-lang#97287 so the clippy team can review independently.
JohnTitor added a commit to JohnTitor/rustc-dev-guide that referenced this pull request Feb 2, 2023
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
tshepang pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Feb 3, 2023
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
@compiler-errors compiler-errors deleted the type-interner branch August 11, 2023 20:21
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. perf-regression-triaged The performance regression has been triaged. 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.