mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-06 20:28:33 +00:00
collector: extract upstream_crates
This commit is contained in:
parent
bcb98bdc34
commit
adaa521feb
@ -11,7 +11,7 @@ use rustc_hir::def_id::{CrateNum, DefIndex, LOCAL_CRATE};
|
|||||||
use rustc_index::vec::IndexVec;
|
use rustc_index::vec::IndexVec;
|
||||||
use rustc_session::{CrateDisambiguator, Session};
|
use rustc_session::{CrateDisambiguator, Session};
|
||||||
use rustc_span::source_map::SourceMap;
|
use rustc_span::source_map::SourceMap;
|
||||||
use rustc_span::Span;
|
use rustc_span::{Span, Symbol};
|
||||||
use std::iter::repeat;
|
use std::iter::repeat;
|
||||||
use syntax::ast::NodeId;
|
use syntax::ast::NodeId;
|
||||||
|
|
||||||
@ -98,6 +98,21 @@ where
|
|||||||
(sig, full)
|
(sig, full)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn upstream_crates(cstore: &dyn CrateStore) -> Vec<(Symbol, Fingerprint, Svh)> {
|
||||||
|
let mut upstream_crates: Vec<_> = cstore
|
||||||
|
.crates_untracked()
|
||||||
|
.iter()
|
||||||
|
.map(|&cnum| {
|
||||||
|
let name = cstore.crate_name_untracked(cnum);
|
||||||
|
let disambiguator = cstore.crate_disambiguator_untracked(cnum).to_fingerprint();
|
||||||
|
let hash = cstore.crate_hash_untracked(cnum);
|
||||||
|
(name, disambiguator, hash)
|
||||||
|
})
|
||||||
|
.collect();
|
||||||
|
upstream_crates.sort_unstable_by_key(|&(name, dis, _)| (name.as_str(), dis));
|
||||||
|
upstream_crates
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a, 'hir> NodeCollector<'a, 'hir> {
|
impl<'a, 'hir> NodeCollector<'a, 'hir> {
|
||||||
pub(super) fn root(
|
pub(super) fn root(
|
||||||
sess: &'a Session,
|
sess: &'a Session,
|
||||||
@ -190,18 +205,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut upstream_crates: Vec<_> = cstore
|
let upstream_crates = upstream_crates(cstore);
|
||||||
.crates_untracked()
|
|
||||||
.iter()
|
|
||||||
.map(|&cnum| {
|
|
||||||
let name = cstore.crate_name_untracked(cnum);
|
|
||||||
let disambiguator = cstore.crate_disambiguator_untracked(cnum).to_fingerprint();
|
|
||||||
let hash = cstore.crate_hash_untracked(cnum);
|
|
||||||
(name, disambiguator, hash)
|
|
||||||
})
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
upstream_crates.sort_unstable_by_key(|&(name, dis, _)| (name.as_str(), dis));
|
|
||||||
|
|
||||||
// We hash the final, remapped names of all local source files so we
|
// We hash the final, remapped names of all local source files so we
|
||||||
// don't have to include the path prefix remapping commandline args.
|
// don't have to include the path prefix remapping commandline args.
|
||||||
|
Loading…
Reference in New Issue
Block a user