Skip to content

Calculate span info on-demand#80339

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

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

Conversation

@jyn514
Copy link
Member

@jyn514 jyn514 commented Dec 23, 2020

  • 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.

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

Labels

I-compilemem Issue: Problems and improvements with respect to memory usage during compilation. I-compiletime Issue: Problems and improvements with respect to compile times. 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-rustdoc Relevant 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