Merge pull request #19566 from flodiebold/push-vzpyzvpkwkyt

Fix dyn compatibility code bypassing callable_item_signature query
This commit is contained in:
Florian Diebold 2025-04-10 15:11:34 +00:00 committed by GitHub
commit 1bf840bb50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 5 deletions

View File

@ -150,7 +150,7 @@ pub trait HirDatabase: DefDatabase + std::fmt::Debug {
#[salsa::invoke_actual(crate::lower::field_types_query)] #[salsa::invoke_actual(crate::lower::field_types_query)]
fn field_types(&self, var: VariantId) -> Arc<ArenaMap<LocalFieldId, Binders<Ty>>>; fn field_types(&self, var: VariantId) -> Arc<ArenaMap<LocalFieldId, Binders<Ty>>>;
#[salsa::invoke_actual(crate::lower::callable_item_sig)] #[salsa::invoke_actual(crate::lower::callable_item_signature_query)]
fn callable_item_signature(&self, def: CallableDefId) -> PolyFnSig; fn callable_item_signature(&self, def: CallableDefId) -> PolyFnSig;
#[salsa::invoke_actual(crate::lower::return_type_impl_traits)] #[salsa::invoke_actual(crate::lower::return_type_impl_traits)]

View File

@ -21,7 +21,6 @@ use crate::{
db::HirDatabase, db::HirDatabase,
from_assoc_type_id, from_chalk_trait_id, from_assoc_type_id, from_chalk_trait_id,
generics::{generics, trait_self_param_idx}, generics::{generics, trait_self_param_idx},
lower::callable_item_sig,
to_chalk_trait_id, to_chalk_trait_id,
utils::elaborate_clause_supertraits, utils::elaborate_clause_supertraits,
}; };
@ -377,7 +376,7 @@ where
cb(MethodViolationCode::AsyncFn)?; cb(MethodViolationCode::AsyncFn)?;
} }
let sig = callable_item_sig(db, func.into()); let sig = db.callable_item_signature(func.into());
if sig.skip_binders().params().iter().skip(1).any(|ty| { if sig.skip_binders().params().iter().skip(1).any(|ty| {
contains_illegal_self_type_reference( contains_illegal_self_type_reference(
db, db,
@ -558,7 +557,7 @@ fn receiver_for_self_ty(db: &dyn HirDatabase, func: FunctionId, ty: Ty) -> Optio
if idx == trait_self_idx { ty.clone().cast(Interner) } else { arg.clone() } if idx == trait_self_idx { ty.clone().cast(Interner) } else { arg.clone() }
}), }),
); );
let sig = callable_item_sig(db, func.into()); let sig = db.callable_item_signature(func.into());
let sig = sig.substitute(Interner, &subst); let sig = sig.substitute(Interner, &subst);
sig.params_and_return.first().cloned() sig.params_and_return.first().cloned()
} }

View File

@ -713,7 +713,7 @@ impl<'a> TyLoweringContext<'a> {
} }
/// Build the signature of a callable item (function, struct or enum variant). /// Build the signature of a callable item (function, struct or enum variant).
pub(crate) fn callable_item_sig(db: &dyn HirDatabase, def: CallableDefId) -> PolyFnSig { pub(crate) fn callable_item_signature_query(db: &dyn HirDatabase, def: CallableDefId) -> PolyFnSig {
match def { match def {
CallableDefId::FunctionId(f) => fn_sig_for_fn(db, f), CallableDefId::FunctionId(f) => fn_sig_for_fn(db, f),
CallableDefId::StructId(s) => fn_sig_for_struct_constructor(db, s), CallableDefId::StructId(s) => fn_sig_for_struct_constructor(db, s),