mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Being Ty::InferenceVar closes to chalk equivalent
This commit is contained in:
parent
4e5c496199
commit
11a1f13cd1
11 changed files with 172 additions and 152 deletions
|
@ -19,7 +19,7 @@ use crate::{
|
|||
primitive::{self, FloatTy, IntTy, UintTy},
|
||||
utils::all_super_traits,
|
||||
Canonical, DebruijnIndex, FnPointer, FnSig, InEnvironment, Scalar, Substs, TraitEnvironment,
|
||||
TraitRef, Ty, TyKind, TypeWalk,
|
||||
TraitRef, Ty, TypeWalk,
|
||||
};
|
||||
|
||||
/// This is used as a key for indexing impls.
|
||||
|
@ -667,7 +667,7 @@ pub(crate) fn inherent_impl_substs(
|
|||
.build();
|
||||
let self_ty_with_vars = db.impl_self_ty(impl_id).subst(&vars);
|
||||
let mut kinds = self_ty.kinds.to_vec();
|
||||
kinds.extend(iter::repeat(TyKind::General).take(vars.len()));
|
||||
kinds.extend(iter::repeat(chalk_ir::TyVariableKind::General).take(vars.len()));
|
||||
let tys = Canonical { kinds: kinds.into(), value: (self_ty_with_vars, self_ty.value.clone()) };
|
||||
let substs = super::infer::unify(&tys);
|
||||
// We only want the substs for the vars we added, not the ones from self_ty.
|
||||
|
@ -759,7 +759,7 @@ fn generic_implements_goal(
|
|||
.push(self_ty.value)
|
||||
.fill_with_bound_vars(DebruijnIndex::INNERMOST, kinds.len())
|
||||
.build();
|
||||
kinds.extend(iter::repeat(TyKind::General).take(substs.len() - 1));
|
||||
kinds.extend(iter::repeat(chalk_ir::TyVariableKind::General).take(substs.len() - 1));
|
||||
let trait_ref = TraitRef { trait_, substs };
|
||||
let obligation = super::Obligation::Trait(trait_ref);
|
||||
Canonical { kinds: kinds.into(), value: InEnvironment::new(env, obligation) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue