rustc: Use tcx.used_crates(()) more by petrochenkov · Pull Request #124976 · rust-lang/rust (original) (raw)

crates_including_speculative looks fine to me.
Not sure about required_crates.

Ideally I'd turn the used bool in crate loader into a 3-variant enum:

enum WhatCrateIsLoadedFor { ForRealThings, // Need to be encoded into metadata in any case ForDocLinksAndDiagnosticsOnly, // It may be possible to drop these ones from metadata, if we clean their traces from source map somehow ForDiagnosticsOnly, }

Maybe even merge it with existing enum CrateDepKind which is sort of similar.

Let's keep its pre-existing naming for now.