Skip to content

Calculate span info on-demand - #80339

Merged
bors merged 4 commits into
rust-lang:masterfrom
jyn514:no-span
Apr 25, 2021
Merged

Calculate span info on-demand#80339
bors merged 4 commits into
rust-lang:masterfrom
jyn514:no-span

Conversation

@jyn514

@jyn514jyn514 commented Dec 23, 2020

Copy link
Copy Markdown
Member
  • Add helper attr_span for common reused function
  • Stop storing Spans on Item directly; calculate them on demand instead
  • Special case modules, which have different spans depending on whether
    you use inner or outer attributes
  • Special case impls with fake IDs, which can have either dummy spans (for auto traits) or the DefId of the impl block (for blanket impls)
  • Use a fake ID for primitives instead of the ID of the crate; this lets
    source() know that it should use a dummy span instead of the span of
    the crate.

This shrinks Item from 48 to 40 bytes.

Helps with #76382.

@jyn514jyn514 added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Dec 23, 2020
@rust-highfive

This comment has been minimized.

@rust-highfive

Copy link
Copy Markdown
Contributor

r? @GuillaumeGomez

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 23, 2020
@rust-log-analyzer

This comment has been minimized.

@jyn514

Copy link
Copy Markdown
MemberAuthor

The failure is strange - it looks like the file src/core/slice/ascii.rs.html is no longer being generated? Not sure what that has to do with my changes ... let me try reverting the change to primitive IDs.

@jyn514

Copy link
Copy Markdown
MemberAuthor

let me try reverting the change to primitive IDs.

that did not help :(

@jyn514jyn514 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 Dec 23, 2020
@bors

This comment has been minimized.

@jyn514jyn514 mentioned this pull request Dec 31, 2020
@jyn514
jyn514force-pushed the no-span branch 2 times, most recently from 5d3d456 to 30d2b24CompareJanuary 8, 2021 01:15
@jyn514jyn514 mentioned this pull request Jan 8, 2021
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 14, 2021
Box Item::Attributes
This reduces the size of Item from 128 to 40 bytes. I think this is as small as it needs to get 🎉
Builds on rust-lang#80339 and should not be merged before.
r? `@GuillaumeGomez`
@bors

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@jyn514jyn514 added I-compilemem Issue: Problems and improvements with respect to memory usage during compilation. I-compiletime Issue: Problems and improvements with respect to compile times. labels Feb 19, 2021
@bors

This comment has been minimized.

@rustbotrustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 24, 2021
@jyn514

Copy link
Copy Markdown
MemberAuthor

Up to -1.2% in instruction counts on many of the -doc benchmarks. Max-rss looks like noise.

@bors r=GuillaumeGomez

@bors

bors commented Apr 24, 2021

Copy link
Copy Markdown
Collaborator

📌 Commit 63a08e6d29463892a0dbdb828aa193454e7c79d8 has been approved by GuillaumeGomez

@borsbors 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 Apr 24, 2021
@GuillaumeGomez

Copy link
Copy Markdown
Member

Less than what I was hoping for but still great!

@bors

This comment has been minimized.

@borsbors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 24, 2021
The only bit failing was the module, so change that before removing the
`span` field.
- Remove `span` field, adding `Item::span()` instead
- Special-case `Impl` and `Module` items
- Use dummy spans for primitive items
@jyn514

Copy link
Copy Markdown
MemberAuthor

@bors r=GuillaumeGomez

@bors

bors commented Apr 24, 2021

Copy link
Copy Markdown
Collaborator

📌 Commit ba36142 has been approved by GuillaumeGomez

@borsbors 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 Apr 24, 2021
@bors

bors commented Apr 25, 2021

Copy link
Copy Markdown
Collaborator

⌛ Testing commit ba36142 with merge f7c468f...

@bors

bors commented Apr 25, 2021

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: GuillaumeGomez
Pushing f7c468f to master...

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

I-compilememIssue: Problems and improvements with respect to memory usage during compilation.I-compiletimeIssue: Problems and improvements with respect to compile times.merged-by-borsThis PR was explicitly merged by bors.S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants

@jyn514@rust-highfive@rust-log-analyzer@bors@rust-timer@GuillaumeGomez@JohnCSimon@camelid@rustbot