mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Remove definitions field that is only needed for one method
This commit is contained in:
parent
4953d70e2f
commit
1202fce40e
@ -8,7 +8,7 @@ use rustc_ast::expand::allocator::AllocatorKind;
|
||||
use rustc_ast::{self as ast, *};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_data_structures::svh::Svh;
|
||||
use rustc_data_structures::sync::{MappedReadGuard, ReadGuard};
|
||||
use rustc_data_structures::sync::MappedReadGuard;
|
||||
use rustc_expand::base::SyntaxExtension;
|
||||
use rustc_hir::def_id::{CrateNum, LocalDefId, StableCrateId, LOCAL_CRATE};
|
||||
use rustc_hir::definitions::Definitions;
|
||||
@ -64,7 +64,6 @@ pub struct CrateLoader<'a> {
|
||||
// Immutable configuration.
|
||||
sess: &'a Session,
|
||||
metadata_loader: &'a MetadataLoaderDyn,
|
||||
definitions: ReadGuard<'a, Definitions>,
|
||||
local_crate_name: Symbol,
|
||||
// Mutable output.
|
||||
cstore: &'a mut CStore,
|
||||
@ -261,17 +260,9 @@ impl<'a> CrateLoader<'a> {
|
||||
metadata_loader: &'a MetadataLoaderDyn,
|
||||
local_crate_name: Symbol,
|
||||
cstore: &'a mut CStore,
|
||||
definitions: ReadGuard<'a, Definitions>,
|
||||
used_extern_options: &'a mut FxHashSet<Symbol>,
|
||||
) -> Self {
|
||||
CrateLoader {
|
||||
sess,
|
||||
metadata_loader,
|
||||
local_crate_name,
|
||||
cstore,
|
||||
used_extern_options,
|
||||
definitions,
|
||||
}
|
||||
CrateLoader { sess, metadata_loader, local_crate_name, cstore, used_extern_options }
|
||||
}
|
||||
pub fn cstore(&self) -> &CStore {
|
||||
&self.cstore
|
||||
@ -989,6 +980,7 @@ impl<'a> CrateLoader<'a> {
|
||||
&mut self,
|
||||
item: &ast::Item,
|
||||
def_id: LocalDefId,
|
||||
definitions: &Definitions,
|
||||
) -> Option<CrateNum> {
|
||||
match item.kind {
|
||||
ast::ItemKind::ExternCrate(orig_name) => {
|
||||
@ -1011,7 +1003,7 @@ impl<'a> CrateLoader<'a> {
|
||||
|
||||
let cnum = self.resolve_crate(name, item.span, dep_kind)?;
|
||||
|
||||
let path_len = self.definitions.def_path(def_id).data.len();
|
||||
let path_len = definitions.def_path(def_id).data.len();
|
||||
self.update_extern_crate(
|
||||
cnum,
|
||||
ExternCrate {
|
||||
|
@ -855,7 +855,10 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
|
||||
} else if orig_name == Some(kw::SelfLower) {
|
||||
Some(self.r.graph_root)
|
||||
} else {
|
||||
let crate_id = self.r.crate_loader(|c| c.process_extern_crate(item, local_def_id));
|
||||
let tcx = self.r.tcx;
|
||||
let crate_id = self.r.crate_loader(|c| {
|
||||
c.process_extern_crate(item, local_def_id, &tcx.definitions_untracked())
|
||||
});
|
||||
crate_id.map(|crate_id| {
|
||||
self.r.extern_crate_map.insert(local_def_id, crate_id);
|
||||
self.r.expect_module(crate_id.as_def_id())
|
||||
|
@ -1470,7 +1470,6 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
&*self.metadata_loader,
|
||||
self.local_crate_name,
|
||||
&mut *self.tcx.untracked().cstore.write().untracked_as_any().downcast_mut().unwrap(),
|
||||
self.tcx.definitions_untracked(),
|
||||
&mut self.used_extern_options,
|
||||
))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user