From d5d485ef9289589332893f2c0ad96cb366afe9d6 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Sun, 28 Jun 2020 21:17:27 +0200 Subject: Implement Chalk variable kinds This means we need to keep track of the kinds (general/int/float) of variables in `Canonical`, which requires some more ceremony. (It also exposes some places where we're not really dealing with canonicalization correctly -- another thing to be cleaned up when we switch to using Chalk's types directly.) Should fix the last remaining issue of #2534. --- crates/ra_hir_ty/src/traits.rs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'crates/ra_hir_ty/src/traits.rs') diff --git a/crates/ra_hir_ty/src/traits.rs b/crates/ra_hir_ty/src/traits.rs index 6f43c3a22..2a6d7faef 100644 --- a/crates/ra_hir_ty/src/traits.rs +++ b/crates/ra_hir_ty/src/traits.rs @@ -1,5 +1,5 @@ //! Trait solving using Chalk. -use std::{panic, sync::Arc}; +use std::sync::Arc; use chalk_ir::cast::Cast; use hir_def::{ @@ -8,7 +8,7 @@ use hir_def::{ use ra_db::{impl_intern_key, salsa, CrateId}; use ra_prof::profile; -use crate::{db::HirDatabase, DebruijnIndex}; +use crate::{db::HirDatabase, DebruijnIndex, Substs}; use super::{Canonical, GenericPredicate, HirDisplay, ProjectionTy, TraitRef, Ty, TypeWalk}; @@ -190,15 +190,7 @@ fn solution_from_chalk( solution: chalk_solve::Solution, ) -> Solution { let convert_subst = |subst: chalk_ir::Canonical>| { - let value = subst - .value - .iter(&Interner) - .map(|p| match p.ty(&Interner) { - Some(ty) => from_chalk(db, ty.clone()), - None => unimplemented!(), - }) - .collect(); - let result = Canonical { value, num_vars: subst.binders.len(&Interner) }; + let result = from_chalk(db, subst); SolutionVariables(result) }; match solution { @@ -222,7 +214,7 @@ fn solution_from_chalk( } #[derive(Clone, Debug, PartialEq, Eq)] -pub struct SolutionVariables(pub Canonical>); +pub struct SolutionVariables(pub Canonical); #[derive(Clone, Debug, PartialEq, Eq)] /// A (possible) solution for a proposed goal. -- cgit v1.2.3