Skip to content

Skip most of create_substs_for_ast_path if type is not generic #78194

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

Merged
merged 1 commit into from
Nov 27, 2020

Conversation

bugadani
Copy link
Contributor

No description provided.

@rust-highfive
Copy link
Contributor

r? @varkor

(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 21, 2020
@varkor
Copy link
Member

varkor commented Oct 21, 2020

Let's check whether this makes a noticeable difference.

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Collaborator

bors commented Oct 21, 2020

⌛ Trying commit 4ff879a95a8c3d2b5af40d0e4f4fae1d2c285da1 with merge 4ed8fc0fbdb747ed9ee9a45505ddfc72d891cc08...

@bugadani
Copy link
Contributor Author

Given the results of my previous few PRs, I expect a huge regression, actually 😅

@bors
Copy link
Collaborator

bors commented Oct 21, 2020

☀️ Try build successful - checks-actions, checks-azure
Build commit: 4ed8fc0fbdb747ed9ee9a45505ddfc72d891cc08 (4ed8fc0fbdb747ed9ee9a45505ddfc72d891cc08)

@rust-timer
Copy link
Collaborator

Queued 4ed8fc0fbdb747ed9ee9a45505ddfc72d891cc08 with parent 22e6b9c, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (4ed8fc0fbdb747ed9ee9a45505ddfc72d891cc08): comparison url.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. Please note that if the perf results are neutral, you should likely undo the rollup=never given below by specifying rollup- to bors.

Importantly, though, if the results of this run are non-neutral do not roll this PR up -- it will mask other regressions or improvements in the roll up.

@bors rollup=never

@varkor
Copy link
Member

varkor commented Oct 21, 2020

I'll double-check this soon.

@bugadani
Copy link
Contributor Author

There are a lot of avg >= 0 results, and no clear wins anywhere.

@bugadani bugadani closed this Oct 22, 2020
@bugadani bugadani deleted the generic branch October 22, 2020 07:48
@varkor
Copy link
Member

varkor commented Oct 22, 2020

It looks like an improvement on serde, alloc and a couple of others to me. Am I misreading the results?

@bugadani
Copy link
Contributor Author

bugadani commented Oct 22, 2020

I was under the assumption that bootstrap times aren't really representative, but perhaps that has changed since. @Mark-Simulacrum I believe you know that?

@Mark-Simulacrum
Copy link
Member

The smaller bootstrap timings are less reliable (since it's wall times). I would not say that the bootstrap timings are unreliable, though, we usually see roughly 2-3% noise on smaller crates (<30 seconds) and ~1% noise at most on the longer crates. That's about what we're seeing here. I don't think I would call this a major improvement, but it might be a slight improvement.

@bugadani bugadani restored the generic branch October 22, 2020 23:03
@bugadani
Copy link
Contributor Author

Hmm, thanks for the explanation. I guess I misinterpreted a different comment on a random PR.

@bugadani bugadani reopened this Oct 22, 2020
@camelid camelid added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 6, 2020
@bugadani
Copy link
Contributor Author

Is this not ignoring associated type bindings?

I'm not entirely certain, but as far as I can see, every trait or trait ref should have a Self˙ generic param by default, so generic_params.params.len() =/= 0 in this case. This means I don't think I can conjure up a test that fails with the older PR code but not with the new. I'm not sure if it's possible to specify an assoc type for something that's not a trait, though, which can change this.

Note: If I force the assoc bindings to an empty vector, I get a nice (and wrong) error message while compiling core, so I think we're well covered on the not-generic-but-has-associated-type-binding case :)

error[E0191]: the value of the associated type `Item` (from trait `Iterator`) must be specified
   --> library/core/src/iter/traits/iterator.rs:16:35
    |
16  | fn _assert_is_object_safe(_: &dyn Iterator<Item = ()>) {}
    |                                   ^^^^^^^^^^^^^^^^^^^ help: specify the associated type: `Iterator<Item = (), Item = Type>`
...
100 |     type Item;
    |     ---------- `Item` defined here

@bugadani
Copy link
Contributor Author

@varkor a friendly ping just in case :) Let me know if my assesment sounds sane or I should try harder to find a test instead.

@varkor
Copy link
Member

varkor commented Nov 26, 2020

Sorry, I'll take a look soon; I've just been a bit snowed under for the past few days!

@bugadani
Copy link
Contributor Author

No worries, there's no rush here.

@varkor
Copy link
Member

varkor commented Nov 26, 2020

I'm not entirely certain, but as far as I can see, every trait or trait ref should have a Self˙ generic param by default, so generic_params.params.len() =/= 0 in this case.

Ah, yes, I think you're right. In this case, it ought to be safe to skip the rest of the body in this case. So I think the previous change was fine (but we should have a comment explaining why it's safe). Sorry for the false alarm: would you be able to change it back?

@varkor varkor added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 26, 2020
Co-authored-by: varkor <github@varkor.com>
@varkor
Copy link
Member

varkor commented Nov 26, 2020

Thanks for this, and sorry for taking so long with it!

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Nov 26, 2020

📌 Commit aebea52 has been approved by varkor

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 26, 2020
@bors
Copy link
Collaborator

bors commented Nov 27, 2020

⌛ Testing commit aebea52 with merge 72d2a7c...

@bors
Copy link
Collaborator

bors commented Nov 27, 2020

☀️ Test successful - checks-actions
Approved by: varkor
Pushing 72d2a7c to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 27, 2020
@bors bors merged commit 72d2a7c into rust-lang:master Nov 27, 2020
@rustbot rustbot added this to the 1.50.0 milestone Nov 27, 2020
@bugadani bugadani deleted the generic branch November 27, 2020 09:16
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.

8 participants