@@ -5,7 +5,7 @@ use std::{cmp, collections::HashMap, convert::Infallible, mem};
55use chalk_ir:: {
66 cast:: Cast ,
77 fold:: { FallibleTypeFolder , TypeFoldable } ,
8- AliasEq , AliasTy , BoundVar , ConstData , DebruijnIndex , FnSubst , Mutability , TyKind , WhereClause ,
8+ AliasEq , AliasTy , BoundVar , DebruijnIndex , FnSubst , Mutability , TyKind , WhereClause ,
99} ;
1010use hir_def:: {
1111 data:: adt:: VariantData ,
@@ -26,8 +26,8 @@ use crate::{
2626 static_lifetime, to_chalk_trait_id,
2727 traits:: FnTrait ,
2828 utils:: { self , generics, Generics } ,
29- Adjust , Adjustment , Binders , BindingMode , ChalkTraitId , ClosureId , ConstValue , DynTy ,
30- FnPointer , FnSig , Interner , Substitution , Ty , TyExt ,
29+ Adjust , Adjustment , Binders , BindingMode , ChalkTraitId , ClosureId , DynTy , FnPointer , FnSig ,
30+ Interner , Substitution , Ty , TyExt ,
3131} ;
3232
3333use super :: { Expectation , InferenceContext } ;
@@ -266,24 +266,19 @@ impl CapturedItemWithoutTy {
266266 let Some ( idx) = self . generics . param_idx ( x) else {
267267 return Err ( ( ) ) ;
268268 } ;
269- Ok ( ConstData {
270- ty,
271- value : ConstValue :: BoundVar ( BoundVar :: new ( outer_binder, idx) ) ,
272- }
273- . intern ( Interner ) )
269+ Ok ( BoundVar :: new ( outer_binder, idx) . to_const ( Interner , ty) )
274270 }
275271
276272 fn try_fold_free_placeholder_ty (
277273 & mut self ,
278274 idx : chalk_ir:: PlaceholderIndex ,
279- _outer_binder : DebruijnIndex ,
275+ outer_binder : DebruijnIndex ,
280276 ) -> std:: result:: Result < Ty , Self :: Error > {
281277 let x = from_placeholder_idx ( self . db , idx) ;
282278 let Some ( idx) = self . generics . param_idx ( x) else {
283279 return Err ( ( ) ) ;
284280 } ;
285- Ok ( TyKind :: BoundVar ( BoundVar :: new ( DebruijnIndex :: INNERMOST , idx) )
286- . intern ( Interner ) )
281+ Ok ( BoundVar :: new ( outer_binder, idx) . to_ty ( Interner ) )
287282 }
288283 }
289284 let g_def = match owner {
0 commit comments