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

Setup proc-macro metadata at encoding instead of decoding #79353

Merged
merged 1 commit into from
Nov 28, 2020

Conversation

cjgillot
Copy link
Contributor

This should improve the common non-proc-macro case for metadata decoding.

@rust-highfive
Copy link
Collaborator

r? @lcnr

(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 Nov 23, 2020
@jonas-schievink
Copy link
Contributor

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion

@bors
Copy link
Contributor

bors commented Nov 23, 2020

⌛ Trying commit d9d6b836427f03853ee316391ddff4ff815e4e18 with merge a7328d96f1234b84898788717e82a5d0762c05a6...

@petrochenkov petrochenkov self-assigned this Nov 23, 2020
@bors
Copy link
Contributor

bors commented Nov 23, 2020

☀️ Try build successful - checks-actions
Build commit: a7328d96f1234b84898788717e82a5d0762c05a6 (a7328d96f1234b84898788717e82a5d0762c05a6)

@rust-timer
Copy link
Collaborator

Queued a7328d96f1234b84898788717e82a5d0762c05a6 with parent 40cf721, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit (a7328d96f1234b84898788717e82a5d0762c05a6): 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
@rustbot modify labels: +S-waiting-on-review -S-waiting-on-perf

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

lgtm

and it seems like a small perf improvement to me.

@lcnr
Copy link
Contributor

lcnr commented Nov 23, 2020

@petrochenkov assigned themselves, so leaving the final approval to them

r? @petrochenkov

@petrochenkov
Copy link
Contributor

Hmm, looks like this PR basically reverts recently landed #76897.
@cjgillot @Aaron1011 could you discuss this with each other?

@petrochenkov
Copy link
Contributor

I'm not sure which side is more important to optimize here.
Non-macro crates are more common, but macro crates are on the critical path in build graphs.

@petrochenkov petrochenkov 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 23, 2020
@cjgillot
Copy link
Contributor Author

I was not aware of @Aaron1011's PR.
@petrochenkov I don't really see how this reverts their PR, can you expand on what you mean here?

@petrochenkov
Copy link
Contributor

@cjgillot
This PR is "let's do everything at encoding time", that PR is "let's do everything at decoding time".
I'll look in more detail today/tomorrow.

@petrochenkov petrochenkov added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 24, 2020
@Aaron1011
Copy link
Member

Part of my motivation for #76897 was to stop encoding invalid metadata for proc macros (i.e. encoding CrateNums for upstream dependencies, which we can't decode). This PR leaves that logic untouched (e.g. the empty_proc_macro!(self) calls).

I have no objection to this PR.

compiler/rustc_metadata/src/rmeta/encoder.rs Outdated Show resolved Hide resolved
MacroKind::Derive
} else {
bug!("Unknown proc-macro type for item {:?}", id);
};
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nicer to pre-record macro kind and name into Crate::proc_macros, but seems ok as is.

@petrochenkov
Copy link
Contributor

Ok, I see what this PR does now, it's pretty different from #76897.

@petrochenkov petrochenkov 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
@petrochenkov
Copy link
Contributor

r=me after squashing commits.

Encode proc_macro name directly.

Do not store None values.
@cjgillot
Copy link
Contributor Author

Squashed.

@petrochenkov
Copy link
Contributor

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented Nov 27, 2020

📌 Commit 9dd32e1 has been approved by petrochenkov

@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 27, 2020
@bors
Copy link
Contributor

bors commented Nov 28, 2020

⌛ Testing commit 9dd32e1 with merge f8e5209...

@bors
Copy link
Contributor

bors commented Nov 28, 2020

☀️ Test successful - checks-actions
Approved by: petrochenkov
Pushing f8e5209 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 28, 2020
@bors bors merged commit f8e5209 into rust-lang:master Nov 28, 2020
@rustbot rustbot added this to the 1.50.0 milestone Nov 28, 2020
@cjgillot cjgillot deleted the procmacro branch December 5, 2020 14:57
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants