-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Intern predicates #72055
Intern predicates #72055
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good thus far!
Noting down some notes from Zulip: I actually started with
|
4a0e5af
to
6df0cd6
Compare
Should be ready for review. r? @eddyb |
☔ The latest upstream changes (presumably #71451) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably #72251) made this pull request unmergeable. Please resolve the merge conflicts. |
rebased |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@bors r+ I'm going to snipe this review from @eddyb since they seem busy and, while I did author the first commit or two here, they're also fairly rote, and the majority of the work came afterwards anyhow. (And it follows more-or-less the rust-lang/compiler-team#285 MCP, although the FCP there has not fully expired.) |
📌 Commit 99483282a6da51f71bdc663bf26fe416bbd02464 has been approved by |
🌲 The tree is currently closed for pull requests below priority 1000, this pull request will be tested once the tree is reopened |
This is once again ready 😅 |
@bors r+ |
📌 Commit 3dd830b has been approved by |
@bors delegate+ |
✌️ @lcnr can now approve this pull request |
Intern predicates Implements the first step of rust-lang/compiler-team#285 Renames `ty::Predicate` to `ty::PredicateKind`, which is now interned. To ease the transition, `ty::Predicate` is now a struct containing a reference to `ty::PredicateKind`. r? @ghost
Rollup of 7 pull requests Successful merges: - rust-lang#72055 (Intern predicates) - rust-lang#72149 (Don't `type_of` on trait assoc ty without default) - rust-lang#72347 (Make intra-link resolve links for both trait and impl items) - rust-lang#72350 (Improve documentation of `slice::from_raw_parts`) - rust-lang#72382 (Show default values for debug-assertions & debug-assertions-std) - rust-lang#72421 (Fix anchor display when hovering impl) - rust-lang#72425 (fix discriminant_value sign extension) Failed merges: r? @ghost
@lcnr The rollup containing this PR caused a large perf regression in trait solving. Was this expected? |
Not by this much 😅 There is one problem which I should be able to get a PR ready today, but a small regression is probably expected... |
@lcnr @nikomatsakis please use |
Note that this was also a max-rss regression. max-rss measurements are noisy, but the change was big enough for the regression to be clear on the graphs. |
@lcnr: please do a perf CI run before landing if a PR is expected/suspected to affect performance.
What is the status of this? |
It ended up being part of #72494 which fixes about 1/3 of of this regression if I understand it correctly. |
(I didn't really expect there to be much perf regression, but it would've been prudent to test.) |
Pass more `Copy` types by value. There are a lot of locations where we pass `&T where T: Copy` by reference, which should both be slightly less performant and less readable IMO. This PR currently consists of three fairly self contained commits: - passes `ty::Predicate` by value and stops depending on `AsRef<ty::Predicate>`. - changes `<&List<_>>::into_iter` to iterate over the elements by value. This would break `List`s of non copy types. But as the only list constructor requires `T` to be copy anyways, I think the improved readability is worth this potential future restriction. - passes `mir::PlaceElem` by value. Mir currently has quite a few copy types which are passed by reference, e.g. `Local`. As I don't have a lot of experience working with MIR, I mostly did this to get some feedback from people who use MIR more frequently - tries to reuse `ty::Predicate` in case it did not change in some places, which should hopefully fix the regression caused by rust-lang#72055 r? @nikomatsakis for the first commit, which continues the work of rust-lang#72055 and makes adding `PredicateKind::ForAll` slightly more pleasant. Feel free to reassign though
Implements the first step of rust-lang/compiler-team#285
Renames
ty::Predicate
toty::PredicateKind
, which is now interned.To ease the transition,
ty::Predicate
is now a struct containing a referenceto
ty::PredicateKind
.r? @ghost