Auto merge of #126068 - lqd:revert-124976, r=petrochenkov
Revert "use `tcx.used_crates(())` more" before it reaches beta There are more open issues caused by #124976 than will be fixed by #125493 alone. The beta cut is soon, so let's revert it and buy some time to analyze and fix these issues in our own time. fixes https://github.com/rust-lang/rust/issues/125474 fixes https://github.com/rust-lang/rust/issues/125484 fixes https://github.com/rust-lang/rust/issues/125646 fixes https://github.com/rust-lang/rust/issues/125707 fixes #126066 fixes #125934 fixes https://github.com/rust-lang/rust/issues/126021 r? `@petrochenkov` `@bors` p=1
This commit is contained in:
commit
98489f2487
26 changed files with 75 additions and 54 deletions
|
|
@ -647,7 +647,7 @@ fn item_children_by_name(tcx: TyCtxt<'_>, def_id: DefId, name: Symbol) -> Vec<Re
|
|||
/// This function is expensive and should be used sparingly.
|
||||
pub fn def_path_res(cx: &LateContext<'_>, path: &[&str]) -> Vec<Res> {
|
||||
fn find_crates(tcx: TyCtxt<'_>, name: Symbol) -> impl Iterator<Item = DefId> + '_ {
|
||||
tcx.crates_including_speculative(())
|
||||
tcx.crates(())
|
||||
.iter()
|
||||
.copied()
|
||||
.filter(move |&num| tcx.crate_name(num) == name)
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ fn try_resolve_did(tcx: TyCtxt<'_>, path: &[&str], namespace: Option<Namespace>)
|
|||
// the one in the sysroot and the one locally built by `cargo test`.)
|
||||
// FIXME: can we prefer the one from the sysroot?
|
||||
'crates: for krate in
|
||||
tcx.used_crates(()).iter().filter(|&&krate| tcx.crate_name(krate).as_str() == crate_name)
|
||||
tcx.crates(()).iter().filter(|&&krate| tcx.crate_name(krate).as_str() == crate_name)
|
||||
{
|
||||
let mut cur_item = DefId { krate: *krate, index: CRATE_DEF_INDEX };
|
||||
// Go over the modules.
|
||||
|
|
@ -1364,7 +1364,7 @@ pub fn get_local_crates(tcx: TyCtxt<'_>) -> Vec<CrateNum> {
|
|||
.map(|crates| crates.split(',').map(|krate| krate.to_string()).collect::<Vec<_>>())
|
||||
.unwrap_or_default();
|
||||
let mut local_crates = Vec::new();
|
||||
for &crate_num in tcx.crates_including_speculative(()) {
|
||||
for &crate_num in tcx.crates(()) {
|
||||
let name = tcx.crate_name(crate_num);
|
||||
let name = name.as_str();
|
||||
if local_crate_names.iter().any(|local_name| local_name == name) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue