1
Fork 0

resolve: Rename some cstore methods to match queries and add comments

about costs associated with replacing them with query calls.
This commit is contained in:
Vadim Petrochenkov 2023-03-23 20:15:04 +04:00
parent 99c49d95cd
commit 71927ad083
4 changed files with 12 additions and 14 deletions

View file

@ -1041,13 +1041,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
self.root.tables.optimized_mir.get(self, id).is_some()
}
fn module_expansion(self, id: DefIndex, sess: &Session) -> ExpnId {
match self.def_kind(id) {
DefKind::Mod | DefKind::Enum | DefKind::Trait => self.get_expn_that_defined(id, sess),
_ => panic!("Expected module, found {:?}", self.local_def_id(id)),
}
}
fn get_fn_has_self_parameter(self, id: DefIndex, sess: &'a Session) -> bool {
self.root
.tables

View file

@ -537,16 +537,16 @@ impl CStore {
)
}
pub fn get_span_untracked(&self, def_id: DefId, sess: &Session) -> Span {
pub fn def_span_untracked(&self, def_id: DefId, sess: &Session) -> Span {
self.get_crate_data(def_id.krate).get_span(def_id.index, sess)
}
pub fn def_kind(&self, def: DefId) -> DefKind {
pub fn def_kind_untracked(&self, def: DefId) -> DefKind {
self.get_crate_data(def.krate).def_kind(def.index)
}
pub fn module_expansion_untracked(&self, def_id: DefId, sess: &Session) -> ExpnId {
self.get_crate_data(def_id.krate).module_expansion(def_id.index, sess)
pub fn expn_that_defined_untracked(&self, def_id: DefId, sess: &Session) -> ExpnId {
self.get_crate_data(def_id.krate).get_expn_that_defined(def_id.index, sess)
}
/// Only public-facing way to traverse all the definitions in a non-local crate.