mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-07 01:05:39 +03:00
resolve: Remove fn_has_self_parameter_untracked
This commit is contained in:
@@ -555,10 +555,6 @@ pub fn load_macro_untracked(&self, id: DefId, sess: &Session) -> LoadedMacro {
|
||||
)
|
||||
}
|
||||
|
||||
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> {
|
||||
self.get_crate_data(cnum).source.clone()
|
||||
}
|
||||
|
||||
@@ -1008,11 +1008,6 @@ fn build_reduced_graph_for_external_crate_res(&mut self, child: ModChild) {
|
||||
match res {
|
||||
Res::Def(DefKind::Struct, def_id) => self.insert_field_names_extern(def_id),
|
||||
Res::Def(DefKind::Union, def_id) => self.insert_field_names_extern(def_id),
|
||||
Res::Def(DefKind::AssocFn, def_id) => {
|
||||
if self.r.cstore().fn_has_self_parameter_untracked(def_id, self.r.tcx.sess) {
|
||||
self.r.has_self.insert(def_id);
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
@@ -1411,7 +1406,7 @@ fn visit_assoc_item(&mut self, item: &'b AssocItem, ctxt: AssocCtxt) {
|
||||
AssocItemKind::Const(..) => (DefKind::AssocConst, ValueNS),
|
||||
AssocItemKind::Fn(box Fn { ref sig, .. }) => {
|
||||
if sig.decl.has_self() {
|
||||
self.r.has_self.insert(def_id);
|
||||
self.r.has_self.insert(local_def_id);
|
||||
}
|
||||
(DefKind::AssocFn, ValueNS)
|
||||
}
|
||||
|
||||
@@ -1649,7 +1649,17 @@ fn extract_node_id(t: &Ty) -> Option<NodeId> {
|
||||
) {
|
||||
let res = binding.res();
|
||||
if filter_fn(res) {
|
||||
if self.r.has_self.contains(&res.def_id()) {
|
||||
let def_id = res.def_id();
|
||||
let has_self = match def_id.as_local() {
|
||||
Some(def_id) => self.r.has_self.contains(&def_id),
|
||||
None => self
|
||||
.r
|
||||
.tcx
|
||||
.fn_arg_names(def_id)
|
||||
.first()
|
||||
.map_or(false, |ident| ident.name == kw::SelfLower),
|
||||
};
|
||||
if has_self {
|
||||
return Some(AssocSuggestion::MethodWithSelf { called });
|
||||
} else {
|
||||
match res {
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
use rustc_expand::base::{DeriveResolutions, SyntaxExtension, SyntaxExtensionKind};
|
||||
use rustc_hir::def::Namespace::{self, *};
|
||||
use rustc_hir::def::{self, CtorOf, DefKind, DocLinkResMap, LifetimeRes, PartialRes, PerNS};
|
||||
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LocalDefIdMap};
|
||||
use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LocalDefIdMap, LocalDefIdSet};
|
||||
use rustc_hir::def_id::{CRATE_DEF_ID, LOCAL_CRATE};
|
||||
use rustc_hir::definitions::DefPathData;
|
||||
use rustc_hir::TraitCandidate;
|
||||
@@ -881,7 +881,7 @@ pub struct Resolver<'a, 'tcx> {
|
||||
extern_prelude: FxHashMap<Ident, ExternPreludeEntry<'a>>,
|
||||
|
||||
/// N.B., this is used only for better diagnostics, not name resolution itself.
|
||||
has_self: FxHashSet<DefId>,
|
||||
has_self: LocalDefIdSet,
|
||||
|
||||
/// Names of fields of an item `DefId` accessible with dot syntax.
|
||||
/// Used for hints during error reporting.
|
||||
@@ -1249,7 +1249,7 @@ pub fn new(
|
||||
prelude: None,
|
||||
extern_prelude,
|
||||
|
||||
has_self: FxHashSet::default(),
|
||||
has_self: Default::default(),
|
||||
field_names: FxHashMap::default(),
|
||||
field_visibility_spans: FxHashMap::default(),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user