Skip to content

rustdoc: Get rid of Cache::extern_locations and calculate the info on-demand #84588

Closed
@jyn514

Description

@jyn514

Right now, extern_locations is populated like this: https://github.com/rust-lang/rust/blob/d81d7ab203207c4110fbf1919a99345f7e9c1498/src/librustdoc/formats/cache.rs#L158-L171

All of these can be computed on-demand with only the CrateNum, TyCtxt, and extern_html_root_urls. We should do so to avoid doing more work than necessary (and taking up lots of memory).

Mentoring instructions:

  1. Add functions src_root, name, and location to ExternalCrate, using the same implementation that's currently in Cache::populate.
  2. Change all uses of cache.extern_location to use the functions instead.
  3. Delete cache.extern_location.

Originally posted by @jyn514 in #84494 (comment)

Metadata

Metadata

Assignees

Labels

E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.I-compilememIssue: Problems and improvements with respect to memory usage during compilation.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions