mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-25 11:17:13 +00:00
chore: Replace some invoke
s with invoke_actual
in hir-ty
This commit is contained in:
parent
cdcadb4265
commit
bcc8e3a0b6
@ -21,7 +21,7 @@ use hir_def::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
AliasEq, AliasTy, BoundVar, DebruijnIndex, FnDefId, Interner, ProjectionTy, ProjectionTyExt,
|
||||
AliasEq, AliasTy, BoundVar, DebruijnIndex, Interner, ProjectionTy, ProjectionTyExt,
|
||||
QuantifiedWhereClause, Substitution, TraitRef, TraitRefExt, Ty, TyBuilder, TyExt, TyKind,
|
||||
WhereClause,
|
||||
db::{HirDatabase, InternedCoroutine},
|
||||
@ -53,7 +53,7 @@ pub(crate) type Variances = chalk_ir::Variances<Interner>;
|
||||
|
||||
impl chalk_solve::RustIrDatabase<Interner> for ChalkContext<'_> {
|
||||
fn associated_ty_data(&self, id: AssocTypeId) -> Arc<AssociatedTyDatum> {
|
||||
self.db.associated_ty_data(id)
|
||||
self.db.associated_ty_data(from_assoc_type_id(id))
|
||||
}
|
||||
fn trait_datum(&self, trait_id: TraitId) -> Arc<TraitDatum> {
|
||||
self.db.trait_datum(self.krate, trait_id)
|
||||
@ -105,7 +105,7 @@ impl chalk_solve::RustIrDatabase<Interner> for ChalkContext<'_> {
|
||||
&self,
|
||||
fn_def_id: chalk_ir::FnDefId<Interner>,
|
||||
) -> Arc<rust_ir::FnDefDatum<Interner>> {
|
||||
self.db.fn_def_datum(fn_def_id)
|
||||
self.db.fn_def_datum(from_chalk(self.db, fn_def_id))
|
||||
}
|
||||
|
||||
fn impls_for_trait(
|
||||
@ -447,7 +447,7 @@ impl chalk_solve::RustIrDatabase<Interner> for ChalkContext<'_> {
|
||||
Arc::new(rust_ir::AdtSizeAlign::from_one_zst(false))
|
||||
}
|
||||
fn assoc_type_name(&self, assoc_ty_id: chalk_ir::AssocTypeId<Interner>) -> String {
|
||||
let id = self.db.associated_ty_data(assoc_ty_id).name;
|
||||
let id = self.db.associated_ty_data(from_assoc_type_id(assoc_ty_id)).name;
|
||||
self.db.type_alias_data(id).name.display(self.db.upcast(), self.edition()).to_string()
|
||||
}
|
||||
fn opaque_type_name(&self, opaque_ty_id: chalk_ir::OpaqueTyId<Interner>) -> String {
|
||||
@ -583,11 +583,11 @@ impl chalk_ir::UnificationDatabase<Interner> for &dyn HirDatabase {
|
||||
&self,
|
||||
fn_def_id: chalk_ir::FnDefId<Interner>,
|
||||
) -> chalk_ir::Variances<Interner> {
|
||||
HirDatabase::fn_def_variance(*self, fn_def_id)
|
||||
HirDatabase::fn_def_variance(*self, from_chalk(*self, fn_def_id))
|
||||
}
|
||||
|
||||
fn adt_variance(&self, adt_id: chalk_ir::AdtId<Interner>) -> chalk_ir::Variances<Interner> {
|
||||
HirDatabase::adt_variance(*self, adt_id)
|
||||
HirDatabase::adt_variance(*self, adt_id.0)
|
||||
}
|
||||
}
|
||||
|
||||
@ -602,10 +602,9 @@ pub(crate) fn program_clauses_for_chalk_env_query(
|
||||
|
||||
pub(crate) fn associated_ty_data_query(
|
||||
db: &dyn HirDatabase,
|
||||
id: AssocTypeId,
|
||||
type_alias: TypeAliasId,
|
||||
) -> Arc<AssociatedTyDatum> {
|
||||
debug!("associated_ty_data {:?}", id);
|
||||
let type_alias: TypeAliasId = from_assoc_type_id(id);
|
||||
debug!("associated_ty_data {:?}", type_alias);
|
||||
let trait_ = match type_alias.lookup(db.upcast()).container {
|
||||
ItemContainerId::TraitId(t) => t,
|
||||
_ => panic!("associated type not in trait"),
|
||||
@ -656,7 +655,7 @@ pub(crate) fn associated_ty_data_query(
|
||||
let bound_data = rust_ir::AssociatedTyDatumBound { bounds, where_clauses: vec![] };
|
||||
let datum = AssociatedTyDatum {
|
||||
trait_id: to_chalk_trait_id(trait_),
|
||||
id,
|
||||
id: to_assoc_type_id(type_alias),
|
||||
name: type_alias,
|
||||
binders: make_binders(db, &generic_params, bound_data),
|
||||
};
|
||||
@ -923,8 +922,10 @@ fn type_alias_associated_ty_value(
|
||||
Arc::new(value)
|
||||
}
|
||||
|
||||
pub(crate) fn fn_def_datum_query(db: &dyn HirDatabase, fn_def_id: FnDefId) -> Arc<FnDefDatum> {
|
||||
let callable_def: CallableDefId = from_chalk(db, fn_def_id);
|
||||
pub(crate) fn fn_def_datum_query(
|
||||
db: &dyn HirDatabase,
|
||||
callable_def: CallableDefId,
|
||||
) -> Arc<FnDefDatum> {
|
||||
let generic_def = GenericDefId::from_callable(db.upcast(), callable_def);
|
||||
let generic_params = generics(db.upcast(), generic_def);
|
||||
let (sig, binders) = db.callable_item_signature(callable_def).into_value_and_skipped_binders();
|
||||
@ -943,7 +944,7 @@ pub(crate) fn fn_def_datum_query(db: &dyn HirDatabase, fn_def_id: FnDefId) -> Ar
|
||||
where_clauses,
|
||||
};
|
||||
let datum = FnDefDatum {
|
||||
id: fn_def_id,
|
||||
id: callable_def.to_chalk(db),
|
||||
sig: chalk_ir::FnSig {
|
||||
abi: sig.abi,
|
||||
safety: chalk_ir::Safety::Safe,
|
||||
@ -954,8 +955,10 @@ pub(crate) fn fn_def_datum_query(db: &dyn HirDatabase, fn_def_id: FnDefId) -> Ar
|
||||
Arc::new(datum)
|
||||
}
|
||||
|
||||
pub(crate) fn fn_def_variance_query(db: &dyn HirDatabase, fn_def_id: FnDefId) -> Variances {
|
||||
let callable_def: CallableDefId = from_chalk(db, fn_def_id);
|
||||
pub(crate) fn fn_def_variance_query(
|
||||
db: &dyn HirDatabase,
|
||||
callable_def: CallableDefId,
|
||||
) -> Variances {
|
||||
Variances::from_iter(
|
||||
Interner,
|
||||
db.variances_of(GenericDefId::from_callable(db.upcast(), callable_def))
|
||||
@ -971,10 +974,7 @@ pub(crate) fn fn_def_variance_query(db: &dyn HirDatabase, fn_def_id: FnDefId) ->
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn adt_variance_query(
|
||||
db: &dyn HirDatabase,
|
||||
chalk_ir::AdtId(adt_id): AdtId,
|
||||
) -> Variances {
|
||||
pub(crate) fn adt_variance_query(db: &dyn HirDatabase, adt_id: hir_def::AdtId) -> Variances {
|
||||
Variances::from_iter(
|
||||
Interner,
|
||||
db.variances_of(adt_id.into()).as_deref().unwrap_or_default().iter().map(|v| match v {
|
||||
|
@ -17,8 +17,8 @@ use smallvec::SmallVec;
|
||||
use triomphe::Arc;
|
||||
|
||||
use crate::{
|
||||
Binders, ClosureId, Const, FnDefId, ImplTraitId, ImplTraits, InferenceResult, Interner,
|
||||
PolyFnSig, Substitution, TraitEnvironment, TraitRef, Ty, TyDefId, ValueTyDefId, chalk_db,
|
||||
Binders, Const, ImplTraitId, ImplTraits, InferenceResult, Interner, PolyFnSig, Substitution,
|
||||
TraitEnvironment, TraitRef, Ty, TyDefId, ValueTyDefId, chalk_db,
|
||||
consteval::ConstEvalError,
|
||||
drop::DropGlue,
|
||||
dyn_compatibility::DynCompatibilityViolation,
|
||||
@ -39,8 +39,8 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> + std::fmt::Debug {
|
||||
#[salsa::cycle(crate::mir::mir_body_recover)]
|
||||
fn mir_body(&self, def: DefWithBodyId) -> Result<Arc<MirBody>, MirLowerError>;
|
||||
|
||||
#[salsa::invoke(crate::mir::mir_body_for_closure_query)]
|
||||
fn mir_body_for_closure(&self, def: ClosureId) -> Result<Arc<MirBody>, MirLowerError>;
|
||||
#[salsa::invoke_actual(crate::mir::mir_body_for_closure_query)]
|
||||
fn mir_body_for_closure(&self, def: InternedClosureId) -> Result<Arc<MirBody>, MirLowerError>;
|
||||
|
||||
#[salsa::invoke(crate::mir::monomorphized_mir_body_query)]
|
||||
#[salsa::cycle(crate::mir::monomorphized_mir_body_recover)]
|
||||
@ -54,12 +54,12 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> + std::fmt::Debug {
|
||||
#[salsa::invoke(crate::mir::monomorphized_mir_body_for_closure_query)]
|
||||
fn monomorphized_mir_body_for_closure(
|
||||
&self,
|
||||
def: ClosureId,
|
||||
def: InternedClosureId,
|
||||
subst: Substitution,
|
||||
env: Arc<TraitEnvironment>,
|
||||
) -> Result<Arc<MirBody>, MirLowerError>;
|
||||
|
||||
#[salsa::invoke(crate::mir::borrowck_query)]
|
||||
#[salsa::invoke_actual(crate::mir::borrowck_query)]
|
||||
#[salsa::lru(2024)]
|
||||
fn borrowck(&self, def: DefWithBodyId) -> Result<Arc<[BorrowckResult]>, MirLowerError>;
|
||||
|
||||
@ -110,9 +110,10 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> + std::fmt::Debug {
|
||||
fn dyn_compatibility_of_trait(&self, trait_: TraitId) -> Option<DynCompatibilityViolation>;
|
||||
|
||||
#[salsa::invoke(crate::lower::ty_query)]
|
||||
#[salsa::cycle(crate::lower::ty_recover)]
|
||||
#[salsa::transparent]
|
||||
fn ty(&self, def: TyDefId) -> Binders<Ty>;
|
||||
|
||||
#[salsa::cycle(crate::lower::type_for_type_alias_with_diagnostics_query_recover)]
|
||||
#[salsa::invoke_actual(crate::lower::type_for_type_alias_with_diagnostics_query)]
|
||||
fn type_for_type_alias_with_diagnostics(&self, def: TypeAliasId) -> (Binders<Ty>, Diagnostics);
|
||||
|
||||
@ -244,11 +245,8 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> + std::fmt::Debug {
|
||||
#[salsa::interned]
|
||||
fn intern_coroutine(&self, id: InternedCoroutine) -> InternedCoroutineId;
|
||||
|
||||
#[salsa::invoke(chalk_db::associated_ty_data_query)]
|
||||
fn associated_ty_data(
|
||||
&self,
|
||||
id: chalk_db::AssocTypeId,
|
||||
) -> sync::Arc<chalk_db::AssociatedTyDatum>;
|
||||
#[salsa::invoke_actual(chalk_db::associated_ty_data_query)]
|
||||
fn associated_ty_data(&self, id: TypeAliasId) -> sync::Arc<chalk_db::AssociatedTyDatum>;
|
||||
|
||||
#[salsa::invoke(chalk_db::trait_datum_query)]
|
||||
fn trait_datum(
|
||||
@ -264,14 +262,14 @@ pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> + std::fmt::Debug {
|
||||
fn impl_datum(&self, krate: Crate, impl_id: chalk_db::ImplId)
|
||||
-> sync::Arc<chalk_db::ImplDatum>;
|
||||
|
||||
#[salsa::invoke(chalk_db::fn_def_datum_query)]
|
||||
fn fn_def_datum(&self, fn_def_id: FnDefId) -> sync::Arc<chalk_db::FnDefDatum>;
|
||||
#[salsa::invoke_actual(chalk_db::fn_def_datum_query)]
|
||||
fn fn_def_datum(&self, fn_def_id: CallableDefId) -> sync::Arc<chalk_db::FnDefDatum>;
|
||||
|
||||
#[salsa::invoke(chalk_db::fn_def_variance_query)]
|
||||
fn fn_def_variance(&self, fn_def_id: FnDefId) -> chalk_db::Variances;
|
||||
#[salsa::invoke_actual(chalk_db::fn_def_variance_query)]
|
||||
fn fn_def_variance(&self, fn_def_id: CallableDefId) -> chalk_db::Variances;
|
||||
|
||||
#[salsa::invoke(chalk_db::adt_variance_query)]
|
||||
fn adt_variance(&self, adt_id: chalk_db::AdtId) -> chalk_db::Variances;
|
||||
#[salsa::invoke_actual(chalk_db::adt_variance_query)]
|
||||
fn adt_variance(&self, adt_id: AdtId) -> chalk_db::Variances;
|
||||
|
||||
#[salsa::invoke_actual(crate::variance::variances_of)]
|
||||
#[salsa::cycle(crate::variance::variances_of_cycle)]
|
||||
|
@ -22,7 +22,7 @@ use crate::{
|
||||
from_assoc_type_id, from_chalk_trait_id,
|
||||
generics::{generics, trait_self_param_idx},
|
||||
lower::callable_item_sig,
|
||||
to_assoc_type_id, to_chalk_trait_id,
|
||||
to_chalk_trait_id,
|
||||
utils::elaborate_clause_supertraits,
|
||||
};
|
||||
|
||||
@ -171,8 +171,7 @@ fn bounds_reference_self(db: &dyn HirDatabase, trait_: TraitId) -> bool {
|
||||
.iter()
|
||||
.filter_map(|(_, it)| match *it {
|
||||
AssocItemId::TypeAliasId(id) => {
|
||||
let assoc_ty_id = to_assoc_type_id(id);
|
||||
let assoc_ty_data = db.associated_ty_data(assoc_ty_id);
|
||||
let assoc_ty_data = db.associated_ty_data(id);
|
||||
Some(assoc_ty_data)
|
||||
}
|
||||
_ => None,
|
||||
|
@ -31,7 +31,7 @@ use crate::{
|
||||
DynTyExt, FnAbi, FnPointer, FnSig, Interner, OpaqueTy, ProjectionTyExt, Substitution, Ty,
|
||||
TyExt, WhereClause,
|
||||
db::{HirDatabase, InternedClosure},
|
||||
error_lifetime, from_chalk_trait_id, from_placeholder_idx,
|
||||
error_lifetime, from_assoc_type_id, from_chalk_trait_id, from_placeholder_idx,
|
||||
generics::Generics,
|
||||
infer::coerce::CoerceNever,
|
||||
make_binders,
|
||||
@ -153,7 +153,8 @@ impl InferenceContext<'_> {
|
||||
if let WhereClause::AliasEq(AliasEq { alias: AliasTy::Projection(projection), ty }) =
|
||||
bound.skip_binders()
|
||||
{
|
||||
let assoc_data = self.db.associated_ty_data(projection.associated_ty_id);
|
||||
let assoc_data =
|
||||
self.db.associated_ty_data(from_assoc_type_id(projection.associated_ty_id));
|
||||
if !fn_traits.contains(&assoc_data.trait_id) {
|
||||
return None;
|
||||
}
|
||||
|
@ -1560,6 +1560,20 @@ fn type_for_enum_variant_constructor(
|
||||
}
|
||||
}
|
||||
|
||||
#[salsa::tracked(recovery_fn = type_for_adt_recovery)]
|
||||
fn type_for_adt_tracked(db: &dyn HirDatabase, adt: AdtId) -> Binders<Ty> {
|
||||
type_for_adt(db, adt)
|
||||
}
|
||||
|
||||
pub(crate) fn type_for_adt_recovery(
|
||||
db: &dyn HirDatabase,
|
||||
_cycle: &salsa::Cycle,
|
||||
adt: AdtId,
|
||||
) -> Binders<Ty> {
|
||||
let generics = generics(db.upcast(), adt.into());
|
||||
make_binders(db, &generics, TyKind::Error.intern(Interner))
|
||||
}
|
||||
|
||||
fn type_for_adt(db: &dyn HirDatabase, adt: AdtId) -> Binders<Ty> {
|
||||
let generics = generics(db.upcast(), adt.into());
|
||||
let subst = generics.bound_vars_subst(db, DebruijnIndex::INNERMOST);
|
||||
@ -1589,6 +1603,15 @@ pub(crate) fn type_for_type_alias_with_diagnostics_query(
|
||||
(make_binders(db, &generics, inner), create_diagnostics(ctx.diagnostics))
|
||||
}
|
||||
|
||||
pub(crate) fn type_for_type_alias_with_diagnostics_query_recover(
|
||||
db: &dyn HirDatabase,
|
||||
_cycle: &salsa::Cycle,
|
||||
adt: TypeAliasId,
|
||||
) -> (Binders<Ty>, Diagnostics) {
|
||||
let generics = generics(db.upcast(), adt.into());
|
||||
(make_binders(db, &generics, TyKind::Error.intern(Interner)), None)
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub enum TyDefId {
|
||||
BuiltinType(BuiltinType),
|
||||
@ -1628,25 +1651,11 @@ impl ValueTyDefId {
|
||||
pub(crate) fn ty_query(db: &dyn HirDatabase, def: TyDefId) -> Binders<Ty> {
|
||||
match def {
|
||||
TyDefId::BuiltinType(it) => Binders::empty(Interner, TyBuilder::builtin(it)),
|
||||
TyDefId::AdtId(it) => type_for_adt(db, it),
|
||||
TyDefId::AdtId(it) => type_for_adt_tracked(db, it),
|
||||
TyDefId::TypeAliasId(it) => db.type_for_type_alias_with_diagnostics(it).0,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn ty_recover(
|
||||
db: &dyn HirDatabase,
|
||||
_cycle: &salsa::Cycle,
|
||||
_: HirDatabaseData,
|
||||
def: TyDefId,
|
||||
) -> Binders<Ty> {
|
||||
let generics = match def {
|
||||
TyDefId::BuiltinType(_) => return Binders::empty(Interner, TyKind::Error.intern(Interner)),
|
||||
TyDefId::AdtId(it) => generics(db.upcast(), it.into()),
|
||||
TyDefId::TypeAliasId(it) => generics(db.upcast(), it.into()),
|
||||
};
|
||||
make_binders(db, &generics, TyKind::Error.intern(Interner))
|
||||
}
|
||||
|
||||
pub(crate) fn value_ty_query(db: &dyn HirDatabase, def: ValueTyDefId) -> Option<Binders<Ty>> {
|
||||
match def {
|
||||
ValueTyDefId::FunctionId(it) => Some(type_for_fn(db, it)),
|
||||
|
@ -71,7 +71,7 @@ fn all_mir_bodies(
|
||||
c: ClosureId,
|
||||
cb: &mut impl FnMut(Arc<MirBody>),
|
||||
) -> Result<(), MirLowerError> {
|
||||
match db.mir_body_for_closure(c) {
|
||||
match db.mir_body_for_closure(c.into()) {
|
||||
Ok(body) => {
|
||||
cb(body.clone());
|
||||
body.closures.iter().try_for_each(|&it| for_closure(db, it, cb))
|
||||
|
@ -2452,7 +2452,7 @@ impl Evaluator<'_> {
|
||||
let mir_body = self
|
||||
.db
|
||||
.monomorphized_mir_body_for_closure(
|
||||
closure,
|
||||
closure.into(),
|
||||
generic_args.clone(),
|
||||
self.trait_env.clone(),
|
||||
)
|
||||
|
@ -29,7 +29,7 @@ use triomphe::Arc;
|
||||
use crate::{
|
||||
Adjust, Adjustment, AutoBorrow, CallableDefId, TyBuilder, TyExt,
|
||||
consteval::ConstEvalError,
|
||||
db::{HirDatabase, InternedClosure},
|
||||
db::{HirDatabase, InternedClosure, InternedClosureId},
|
||||
display::{DisplayTarget, HirDisplay, hir_display_with_types_map},
|
||||
error_lifetime,
|
||||
generics::generics,
|
||||
@ -38,12 +38,12 @@ use crate::{
|
||||
layout::LayoutError,
|
||||
mapping::ToChalk,
|
||||
mir::{
|
||||
AggregateKind, Arena, BasicBlock, BasicBlockId, BinOp, BorrowKind, CastKind, ClosureId,
|
||||
ConstScalar, Either, Expr, FieldId, Idx, InferenceResult, Interner, Local, LocalId,
|
||||
MemoryMap, MirBody, MirSpan, Mutability, Operand, Place, PlaceElem, PointerCast,
|
||||
ProjectionElem, ProjectionStore, RawIdx, Rvalue, Statement, StatementKind, Substitution,
|
||||
SwitchTargets, Terminator, TerminatorKind, TupleFieldId, Ty, UnOp, VariantId,
|
||||
intern_const_scalar, return_slot,
|
||||
AggregateKind, Arena, BasicBlock, BasicBlockId, BinOp, BorrowKind, CastKind, ConstScalar,
|
||||
Either, Expr, FieldId, Idx, InferenceResult, Interner, Local, LocalId, MemoryMap, MirBody,
|
||||
MirSpan, Mutability, Operand, Place, PlaceElem, PointerCast, ProjectionElem,
|
||||
ProjectionStore, RawIdx, Rvalue, Statement, StatementKind, Substitution, SwitchTargets,
|
||||
Terminator, TerminatorKind, TupleFieldId, Ty, UnOp, VariantId, intern_const_scalar,
|
||||
return_slot,
|
||||
},
|
||||
static_lifetime,
|
||||
traits::FnTrait,
|
||||
@ -2017,9 +2017,9 @@ fn cast_kind(table: &mut InferenceTable<'_>, source_ty: &Ty, target_ty: &Ty) ->
|
||||
|
||||
pub fn mir_body_for_closure_query(
|
||||
db: &dyn HirDatabase,
|
||||
closure: ClosureId,
|
||||
closure: InternedClosureId,
|
||||
) -> Result<Arc<MirBody>> {
|
||||
let InternedClosure(owner, expr) = db.lookup_intern_closure(closure.into());
|
||||
let InternedClosure(owner, expr) = db.lookup_intern_closure(closure);
|
||||
let body = db.body(owner);
|
||||
let infer = db.infer(owner);
|
||||
let Expr::Closure { args, body: root, .. } = &body[expr] else {
|
||||
@ -2028,7 +2028,7 @@ pub fn mir_body_for_closure_query(
|
||||
let TyKind::Closure(_, substs) = &infer[expr].kind(Interner) else {
|
||||
implementation_error!("closure expression is not closure");
|
||||
};
|
||||
let (captures, kind) = infer.closure_info(&closure);
|
||||
let (captures, kind) = infer.closure_info(&closure.into());
|
||||
let mut ctx = MirLowerCtx::new(db, owner, &body, &infer);
|
||||
// 0 is return local
|
||||
ctx.result.locals.alloc(Local { ty: infer[*root].clone() });
|
||||
|
@ -17,9 +17,9 @@ use hir_def::DefWithBodyId;
|
||||
use triomphe::Arc;
|
||||
|
||||
use crate::{
|
||||
ClosureId, Const, Interner, ProjectionTy, Substitution, TraitEnvironment, Ty, TyKind,
|
||||
Const, Interner, ProjectionTy, Substitution, TraitEnvironment, Ty, TyKind,
|
||||
consteval::{intern_const_scalar, unknown_const},
|
||||
db::{HirDatabase, HirDatabaseData, InternedClosure},
|
||||
db::{HirDatabase, HirDatabaseData, InternedClosure, InternedClosureId},
|
||||
from_placeholder_idx,
|
||||
generics::{Generics, generics},
|
||||
infer::normalize,
|
||||
@ -326,11 +326,11 @@ pub(crate) fn monomorphized_mir_body_recover(
|
||||
|
||||
pub fn monomorphized_mir_body_for_closure_query(
|
||||
db: &dyn HirDatabase,
|
||||
closure: ClosureId,
|
||||
closure: InternedClosureId,
|
||||
subst: Substitution,
|
||||
trait_env: Arc<crate::TraitEnvironment>,
|
||||
) -> Result<Arc<MirBody>, MirLowerError> {
|
||||
let InternedClosure(owner, _) = db.lookup_intern_closure(closure.into());
|
||||
let InternedClosure(owner, _) = db.lookup_intern_closure(closure);
|
||||
let generics = owner.as_generic_def_id(db.upcast()).map(|g_def| generics(db.upcast(), g_def));
|
||||
let filler = &mut Filler { db, subst: &subst, trait_env, generics, owner };
|
||||
let body = db.mir_body_for_closure(closure)?;
|
||||
|
@ -154,7 +154,7 @@ impl<'a> MirPrettyCtx<'a> {
|
||||
}
|
||||
|
||||
fn for_closure(&mut self, closure: ClosureId) {
|
||||
let body = match self.db.mir_body_for_closure(closure) {
|
||||
let body = match self.db.mir_body_for_closure(closure.into()) {
|
||||
Ok(it) => it,
|
||||
Err(e) => {
|
||||
wln!(self, "// error in {closure:?}: {e:?}");
|
||||
|
Loading…
x
Reference in New Issue
Block a user