mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Turn Obligation into something similar to chalk_ir::DomainGoal
This includes starting to make use of Chalk's `Cast` trait.
This commit is contained in:
parent
8e7e405f6a
commit
7ec3b66f7a
14 changed files with 130 additions and 91 deletions
|
@ -6,7 +6,7 @@ use std::{iter, sync::Arc};
|
|||
|
||||
use arrayvec::ArrayVec;
|
||||
use base_db::CrateId;
|
||||
use chalk_ir::Mutability;
|
||||
use chalk_ir::{cast::Cast, Mutability};
|
||||
use hir_def::{
|
||||
lang_item::LangItemTarget, AssocContainerId, AssocItemId, FunctionId, GenericDefId, HasModule,
|
||||
ImplId, Lookup, ModuleId, TraitId,
|
||||
|
@ -767,7 +767,7 @@ fn generic_implements_goal(
|
|||
env: Arc<TraitEnvironment>,
|
||||
trait_: TraitId,
|
||||
self_ty: Canonical<Ty>,
|
||||
) -> Canonical<InEnvironment<super::Obligation>> {
|
||||
) -> Canonical<InEnvironment<super::DomainGoal>> {
|
||||
let mut kinds = self_ty.kinds.to_vec();
|
||||
let substs = super::Substitution::build_for_def(db, trait_)
|
||||
.push(self_ty.value)
|
||||
|
@ -775,7 +775,7 @@ fn generic_implements_goal(
|
|||
.build();
|
||||
kinds.extend(iter::repeat(chalk_ir::TyVariableKind::General).take(substs.len() - 1));
|
||||
let trait_ref = TraitRef { trait_id: to_chalk_trait_id(trait_), substitution: substs };
|
||||
let obligation = super::Obligation::Trait(trait_ref);
|
||||
let obligation = trait_ref.cast(&Interner);
|
||||
Canonical { kinds: kinds.into(), value: InEnvironment::new(env, obligation) }
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue