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:
- Add functions
src_root, name, and location to ExternalCrate, using the same implementation that's currently in Cache::populate.
- Change all uses of
cache.extern_location to use the functions instead.
- Delete
cache.extern_location.
Originally posted by @jyn514 in #84494 (comment)
Right now,
extern_locationsis populated like this: https://github.com/rust-lang/rust/blob/d81d7ab203207c4110fbf1919a99345f7e9c1498/src/librustdoc/formats/cache.rs#L158-L171All 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:
src_root,name, andlocationtoExternalCrate, using the same implementation that's currently inCache::populate.cache.extern_locationto use the functions instead.cache.extern_location.Originally posted by @jyn514 in #84494 (comment)