Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/method_resolution.rs')
| -rw-r--r-- | crates/hir-ty/src/method_resolution.rs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/crates/hir-ty/src/method_resolution.rs b/crates/hir-ty/src/method_resolution.rs index 59299f2c35..9a6adedb99 100644 --- a/crates/hir-ty/src/method_resolution.rs +++ b/crates/hir-ty/src/method_resolution.rs @@ -15,6 +15,7 @@ use base_db::Crate; use hir_def::{ AssocItemId, BlockId, ConstId, FunctionId, GenericParamId, HasModule, ImplId, ItemContainerId, ModuleId, TraitId, + attrs::AttrFlags, expr_store::path::GenericArgs as HirGenericArgs, hir::ExprId, nameres::{DefMap, block_def_map, crate_def_map}, @@ -80,7 +81,7 @@ pub struct MethodResolutionContext<'a, 'db> { pub unstable_features: &'a MethodResolutionUnstableFeatures, } -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, salsa::Update)] pub enum CandidateId { FunctionId(FunctionId), ConstId(ConstId), @@ -418,7 +419,7 @@ pub(crate) fn lookup_impl_method_query<'db>( func: FunctionId, fn_subst: GenericArgs<'db>, ) -> (FunctionId, GenericArgs<'db>) { - let interner = DbInterner::new_with(db, Some(env.krate), env.block); + let interner = DbInterner::new_with(db, env.krate); let infcx = interner.infer_ctxt().build(TypingMode::PostAnalysis); let ItemContainerId::TraitId(trait_id) = func.loc(db).container else { @@ -509,9 +510,8 @@ fn crates_containing_incoherent_inherent_impls(db: &dyn HirDatabase) -> Box<[Cra pub fn incoherent_inherent_impls(db: &dyn HirDatabase, self_ty: SimplifiedType) -> &[ImplId] { let has_incoherent_impls = match self_ty.def() { Some(def_id) => match def_id.try_into() { - Ok(def_id) => { - db.attrs(def_id).by_key(sym::rustc_has_incoherent_inherent_impls).exists() - } + Ok(def_id) => AttrFlags::query(db, def_id) + .contains(AttrFlags::RUSTC_HAS_INCOHERENT_INHERENT_IMPLS), Err(()) => true, }, _ => true, @@ -597,7 +597,7 @@ impl InherentImpls { continue; } - let interner = DbInterner::new_with(db, None, None); + let interner = DbInterner::new_no_crate(db); let self_ty = db.impl_self_ty(impl_id); let self_ty = self_ty.instantiate_identity(); if let Some(self_ty) = @@ -715,7 +715,9 @@ impl TraitImpls { // FIXME: Reservation impls should be considered during coherence checks. If we are // (ever) to implement coherence checks, this filtering should be done by the trait // solver. - if db.attrs(impl_id.into()).by_key(sym::rustc_reservation_impl).exists() { + if AttrFlags::query(db, impl_id.into()) + .contains(AttrFlags::RUSTC_RESERVATION_IMPL) + { continue; } let trait_ref = match db.impl_trait(impl_id) { @@ -723,7 +725,7 @@ impl TraitImpls { None => continue, }; let self_ty = trait_ref.self_ty(); - let interner = DbInterner::new_with(db, None, None); + let interner = DbInterner::new_no_crate(db); let entry = map.entry(trait_ref.def_id.0).or_default(); match simplify_type(interner, self_ty, TreatParams::InstantiateWithInfer) { Some(self_ty) => { |