Auto merge of #12841 - Veykril:query-fix, r=Veykril
fix: Fix `trait_impls_in_deps_query` being called directly instead of as a query Fixes the inlay hint performance regression introdcuced by https://github.com/rust-analyzer/rust-analyzer/issues/12549
This commit is contained in:
commit
84a6fac37a
@ -53,7 +53,7 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
|
||||
#[salsa::invoke(crate::lower::field_types_query)]
|
||||
fn field_types(&self, var: VariantId) -> Arc<ArenaMap<LocalFieldId, Binders<Ty>>>;
|
||||
|
||||
#[salsa::invoke(crate::callable_item_sig)]
|
||||
#[salsa::invoke(crate::lower::callable_item_sig)]
|
||||
fn callable_item_signature(&self, def: CallableDefId) -> PolyFnSig;
|
||||
|
||||
#[salsa::invoke(crate::lower::return_type_impl_traits)]
|
||||
|
@ -54,8 +54,8 @@ pub use infer::{
|
||||
};
|
||||
pub use interner::Interner;
|
||||
pub use lower::{
|
||||
associated_type_shorthand_candidates, callable_item_sig, CallableDefId, ImplTraitLoweringMode,
|
||||
TyDefId, TyLoweringContext, ValueTyDefId,
|
||||
associated_type_shorthand_candidates, CallableDefId, ImplTraitLoweringMode, TyDefId,
|
||||
TyLoweringContext, ValueTyDefId,
|
||||
};
|
||||
pub use mapping::{
|
||||
from_assoc_type_id, from_chalk_trait_id, from_foreign_def_id, from_placeholder_idx,
|
||||
|
@ -1033,7 +1033,7 @@ fn count_impl_traits(type_ref: &TypeRef) -> usize {
|
||||
}
|
||||
|
||||
/// Build the signature of a callable item (function, struct or enum variant).
|
||||
pub fn callable_item_sig(db: &dyn HirDatabase, def: CallableDefId) -> PolyFnSig {
|
||||
pub(crate) fn callable_item_sig(db: &dyn HirDatabase, def: CallableDefId) -> PolyFnSig {
|
||||
match def {
|
||||
CallableDefId::FunctionId(f) => fn_sig_for_fn(db, f),
|
||||
CallableDefId::StructId(s) => fn_sig_for_struct_constructor(db, s),
|
||||
|
@ -137,7 +137,7 @@ pub struct TraitImpls {
|
||||
|
||||
impl TraitImpls {
|
||||
pub(crate) fn trait_impls_in_crate_query(db: &dyn HirDatabase, krate: CrateId) -> Arc<Self> {
|
||||
let _p = profile::span("trait_impls_in_crate_query");
|
||||
let _p = profile::span("trait_impls_in_crate_query").detail(|| format!("{krate:?}"));
|
||||
let mut impls = Self { map: FxHashMap::default() };
|
||||
|
||||
let crate_def_map = db.crate_def_map(krate);
|
||||
@ -162,7 +162,7 @@ impl TraitImpls {
|
||||
}
|
||||
|
||||
pub(crate) fn trait_impls_in_deps_query(db: &dyn HirDatabase, krate: CrateId) -> Arc<Self> {
|
||||
let _p = profile::span("trait_impls_in_deps_query");
|
||||
let _p = profile::span("trait_impls_in_deps_query").detail(|| format!("{krate:?}"));
|
||||
let crate_graph = db.crate_graph();
|
||||
let mut res = Self { map: FxHashMap::default() };
|
||||
|
||||
@ -214,8 +214,7 @@ impl TraitImpls {
|
||||
for (trait_, other_map) in &other.map {
|
||||
let map = self.map.entry(*trait_).or_default();
|
||||
for (fp, impls) in other_map {
|
||||
let vec = map.entry(*fp).or_default();
|
||||
vec.extend(impls);
|
||||
map.entry(*fp).or_default().extend(impls);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -584,7 +583,7 @@ pub fn lookup_impl_method(
|
||||
name: &Name,
|
||||
) -> Option<FunctionId> {
|
||||
let self_ty_fp = TyFingerprint::for_trait_impl(self_ty)?;
|
||||
let trait_impls = TraitImpls::trait_impls_in_deps_query(db, env.krate);
|
||||
let trait_impls = db.trait_impls_in_deps(env.krate);
|
||||
let impls = trait_impls.for_trait_and_self_ty(trait_, self_ty_fp);
|
||||
let mut table = InferenceTable::new(db, env.clone());
|
||||
find_matching_impl(impls, &mut table, &self_ty).and_then(|data| {
|
||||
|
Loading…
x
Reference in New Issue
Block a user