Remove fn_has_self_parameter table.
This commit is contained in:
parent
b0b46c0a10
commit
b94d421d08
@ -32,7 +32,7 @@
|
||||
use rustc_session::Session;
|
||||
use rustc_span::hygiene::{ExpnIndex, MacroKind};
|
||||
use rustc_span::source_map::{respan, Spanned};
|
||||
use rustc_span::symbol::{sym, Ident, Symbol};
|
||||
use rustc_span::symbol::{kw, sym, Ident, Symbol};
|
||||
use rustc_span::{self, BytePos, ExpnId, Pos, Span, SyntaxContext, DUMMY_SP};
|
||||
|
||||
use proc_macro::bridge::client::ProcMacro;
|
||||
@ -1087,8 +1087,15 @@ fn module_expansion(self, id: DefIndex, sess: &Session) -> ExpnId {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_fn_has_self_parameter(self, id: DefIndex) -> bool {
|
||||
self.root.tables.fn_has_self_parameter.get(self, id).is_some()
|
||||
fn get_fn_has_self_parameter(self, id: DefIndex, sess: &'a Session) -> bool {
|
||||
self.root
|
||||
.tables
|
||||
.fn_arg_names
|
||||
.get(self, id)
|
||||
.unwrap_or_else(LazyArray::empty)
|
||||
.decode((self, sess))
|
||||
.nth(0)
|
||||
.map_or(false, |ident| ident.name == kw::SelfLower)
|
||||
}
|
||||
|
||||
fn get_associated_item_def_ids(
|
||||
@ -1105,7 +1112,7 @@ fn get_associated_item_def_ids(
|
||||
.map(move |child_index| self.local_def_id(child_index))
|
||||
}
|
||||
|
||||
fn get_associated_item(self, id: DefIndex) -> ty::AssocItem {
|
||||
fn get_associated_item(self, id: DefIndex, sess: &'a Session) -> ty::AssocItem {
|
||||
let name = self.item_name(id);
|
||||
|
||||
let kind = match self.def_kind(id) {
|
||||
@ -1114,7 +1121,7 @@ fn get_associated_item(self, id: DefIndex) -> ty::AssocItem {
|
||||
DefKind::AssocTy => ty::AssocKind::Type,
|
||||
_ => bug!("cannot get associated-item of `{:?}`", self.def_key(id)),
|
||||
};
|
||||
let has_self = self.get_fn_has_self_parameter(id);
|
||||
let has_self = self.get_fn_has_self_parameter(id, sess);
|
||||
let container = self.root.tables.assoc_container.get(self, id).unwrap();
|
||||
|
||||
ty::AssocItem {
|
||||
|
@ -233,7 +233,7 @@ fn into_args(self) -> (DefId, SimplifiedType) {
|
||||
associated_item_def_ids => {
|
||||
tcx.arena.alloc_from_iter(cdata.get_associated_item_def_ids(def_id.index, tcx.sess))
|
||||
}
|
||||
associated_item => { cdata.get_associated_item(def_id.index) }
|
||||
associated_item => { cdata.get_associated_item(def_id.index, tcx.sess) }
|
||||
inherent_impls => { cdata.get_inherent_implementations_for_type(tcx, def_id.index) }
|
||||
is_foreign_item => { cdata.is_foreign_item(def_id.index) }
|
||||
item_attrs => { tcx.arena.alloc_from_iter(cdata.get_item_attrs(def_id.index, tcx.sess)) }
|
||||
@ -535,8 +535,8 @@ pub fn load_macro_untracked(&self, id: DefId, sess: &Session) -> LoadedMacro {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn fn_has_self_parameter_untracked(&self, def: DefId) -> bool {
|
||||
self.get_crate_data(def.krate).get_fn_has_self_parameter(def.index)
|
||||
pub fn fn_has_self_parameter_untracked(&self, def: DefId, sess: &Session) -> bool {
|
||||
self.get_crate_data(def.krate).get_fn_has_self_parameter(def.index, sess)
|
||||
}
|
||||
|
||||
pub fn crate_source_untracked(&self, cnum: CrateNum) -> Lrc<CrateSource> {
|
||||
|
@ -1335,9 +1335,6 @@ fn encode_info_for_trait_item(&mut self, def_id: DefId) {
|
||||
};
|
||||
self.tables.asyncness.set(def_id.index, m_sig.header.asyncness);
|
||||
self.tables.constness.set(def_id.index, hir::Constness::NotConst);
|
||||
if trait_item.fn_has_self_parameter {
|
||||
self.tables.fn_has_self_parameter.set(def_id.index, ());
|
||||
}
|
||||
}
|
||||
ty::AssocKind::Type => {
|
||||
self.encode_explicit_item_bounds(def_id);
|
||||
@ -1369,9 +1366,6 @@ fn encode_info_for_impl_item(&mut self, def_id: DefId) {
|
||||
hir::Constness::NotConst
|
||||
};
|
||||
self.tables.constness.set(def_id.index, constness);
|
||||
if impl_item.fn_has_self_parameter {
|
||||
self.tables.fn_has_self_parameter.set(def_id.index, ());
|
||||
}
|
||||
}
|
||||
ty::AssocKind::Const | ty::AssocKind::Type => {}
|
||||
}
|
||||
|
@ -398,8 +398,6 @@ fn encode(&self, buf: &mut FileEncoder) -> LazyTables {
|
||||
macro_rules: Table<DefIndex, ()>,
|
||||
macro_definition: Table<DefIndex, LazyValue<ast::MacArgs>>,
|
||||
proc_macro: Table<DefIndex, MacroKind>,
|
||||
// Slot is full when there is a self parameter.
|
||||
fn_has_self_parameter: Table<DefIndex, ()>,
|
||||
module_reexports: Table<DefIndex, LazyArray<ModChild>>,
|
||||
}
|
||||
|
||||
|
@ -1030,7 +1030,7 @@ fn build_reduced_graph_for_external_crate_res(&mut self, child: ModChild) {
|
||||
self.insert_field_names(def_id, field_names);
|
||||
}
|
||||
Res::Def(DefKind::AssocFn, def_id) => {
|
||||
if cstore.fn_has_self_parameter_untracked(def_id) {
|
||||
if cstore.fn_has_self_parameter_untracked(def_id, self.r.session) {
|
||||
self.r.has_self.insert(def_id);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user