mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
resolve: Remove fn_has_self_parameter_untracked
This commit is contained in:
parent
c05b7bd7d0
commit
c7f424b80a
@ -555,10 +555,6 @@ impl CStore {
|
||||
)
|
||||
}
|
||||
|
||||
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 @@ impl<'a, 'b, 'tcx> BuildReducedGraphVisitor<'a, 'b, 'tcx> {
|
||||
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 @@ impl<'a, 'b, 'tcx> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b, 'tcx> {
|
||||
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 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
|
||||
) {
|
||||
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_errors::{
|
||||
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 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
prelude: None,
|
||||
extern_prelude,
|
||||
|
||||
has_self: FxHashSet::default(),
|
||||
has_self: Default::default(),
|
||||
field_names: FxHashMap::default(),
|
||||
field_visibility_spans: FxHashMap::default(),
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user