1
Fork 0

Move encode_metadata out of CrateStore.

This commit is contained in:
Camille GILLOT 2020-11-14 01:59:00 +01:00
parent 11491938f8
commit df54d3980b
9 changed files with 14 additions and 21 deletions

View file

@ -2,8 +2,6 @@
//! are *mostly* used as a part of that interface, but these should
//! probably get a better home if someone can find one.
use crate::ty::TyCtxt;
use rustc_ast as ast;
use rustc_data_structures::sync::{self, MetadataRef};
use rustc_hir::def_id::{CrateNum, DefId, StableCrateId, LOCAL_CRATE};
@ -204,9 +202,6 @@ pub trait CrateStore: std::fmt::Debug {
/// Fetch a DefId from a DefPathHash for a foreign crate.
fn def_path_hash_to_def_id(&self, cnum: CrateNum, hash: DefPathHash) -> DefId;
fn expn_hash_to_expn_id(&self, cnum: CrateNum, index_guess: u32, hash: ExpnHash) -> ExpnId;
// utility functions
fn encode_metadata(&self, tcx: TyCtxt<'_>) -> EncodedMetadata;
}
pub type CrateStoreDyn = dyn CrateStore + sync::Sync;

View file

@ -7,7 +7,6 @@ use crate::ich::{NodeIdHashingMode, StableHashingContext};
use crate::infer::canonical::{Canonical, CanonicalVarInfo, CanonicalVarInfos};
use crate::lint::{struct_lint_level, LintDiagnosticBuilder, LintLevelSource};
use crate::middle;
use crate::middle::cstore::EncodedMetadata;
use crate::middle::resolve_lifetime::{self, LifetimeScopeForPath, ObjectLifetimeDefault};
use crate::middle::stability;
use crate::mir::interpret::{self, AllocId, Allocation, ConstValue, Scalar};
@ -1324,11 +1323,6 @@ impl<'tcx> TyCtxt<'tcx> {
)
}
pub fn encode_metadata(self) -> EncodedMetadata {
let _prof_timer = self.prof.verbose_generic_activity("generate_crate_metadata");
self.untracked_resolutions.cstore.encode_metadata(self)
}
/// Note that this is *untracked* and should only be used within the query
/// system if the result is otherwise tracked through queries
pub fn cstore_untracked(self) -> &'tcx ty::CrateStoreDyn {