diff options
author | Florian Diebold <[email protected]> | 2021-04-07 20:26:24 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-04-08 13:08:55 +0100 |
commit | b25b147e8604f62a5620a5833112e358ebeeb287 (patch) | |
tree | 9f5d3249d633c12e4908bc7cbcd0ba4f1c6ac833 /crates | |
parent | dc0b5817366f9b7b99a1a1f6e69ca7ac63e9ed0f (diff) |
Fix shifted_{in,out} calls
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs | 2 | ||||
-rw-r--r-- | crates/hir_ty/src/lib.rs | 8 | ||||
-rw-r--r-- | crates/hir_ty/src/lower.rs | 6 | ||||
-rw-r--r-- | crates/hir_ty/src/traits/chalk/mapping.rs | 2 | ||||
-rw-r--r-- | crates/hir_ty/src/utils.rs | 4 |
5 files changed, 11 insertions, 11 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs index 9841988c5..5f03079e8 100644 --- a/crates/hir_ty/src/infer/expr.rs +++ b/crates/hir_ty/src/infer/expr.rs | |||
@@ -3,7 +3,7 @@ | |||
3 | use std::iter::{repeat, repeat_with}; | 3 | use std::iter::{repeat, repeat_with}; |
4 | use std::{mem, sync::Arc}; | 4 | use std::{mem, sync::Arc}; |
5 | 5 | ||
6 | use chalk_ir::{cast::Cast, Mutability, TyVariableKind}; | 6 | use chalk_ir::{cast::Cast, fold::Shift, Mutability, TyVariableKind}; |
7 | use hir_def::{ | 7 | use hir_def::{ |
8 | expr::{Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp}, | 8 | expr::{Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp}, |
9 | path::{GenericArg, GenericArgs}, | 9 | path::{GenericArg, GenericArgs}, |
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs index 78ae3545a..7d4793c2f 100644 --- a/crates/hir_ty/src/lib.rs +++ b/crates/hir_ty/src/lib.rs | |||
@@ -35,7 +35,7 @@ use std::sync::Arc; | |||
35 | use base_db::salsa; | 35 | use base_db::salsa; |
36 | use chalk_ir::{ | 36 | use chalk_ir::{ |
37 | cast::{CastTo, Caster}, | 37 | cast::{CastTo, Caster}, |
38 | fold::Fold, | 38 | fold::{Fold, Shift}, |
39 | interner::HasInterner, | 39 | interner::HasInterner, |
40 | UintTy, | 40 | UintTy, |
41 | }; | 41 | }; |
@@ -123,9 +123,9 @@ pub fn param_idx(db: &dyn HirDatabase, id: TypeParamId) -> Option<usize> { | |||
123 | 123 | ||
124 | pub fn wrap_empty_binders<T>(value: T) -> Binders<T> | 124 | pub fn wrap_empty_binders<T>(value: T) -> Binders<T> |
125 | where | 125 | where |
126 | T: TypeWalk + HasInterner<Interner = Interner>, | 126 | T: Fold<Interner, Result = T> + HasInterner<Interner = Interner>, |
127 | { | 127 | { |
128 | Binders::empty(&Interner, value.shifted_in_from(DebruijnIndex::ONE)) | 128 | Binders::empty(&Interner, value.shifted_in_from(&Interner, DebruijnIndex::ONE)) |
129 | } | 129 | } |
130 | 130 | ||
131 | pub fn make_only_type_binders<T: HasInterner<Interner = Interner>>( | 131 | pub fn make_only_type_binders<T: HasInterner<Interner = Interner>>( |
@@ -187,7 +187,7 @@ impl CallableSig { | |||
187 | params_and_return: fn_ptr | 187 | params_and_return: fn_ptr |
188 | .substitution | 188 | .substitution |
189 | .clone() | 189 | .clone() |
190 | .shifted_out_to(DebruijnIndex::ONE) | 190 | .shifted_out_to(&Interner, DebruijnIndex::ONE) |
191 | .expect("unexpected lifetime vars in fn ptr") | 191 | .expect("unexpected lifetime vars in fn ptr") |
192 | .0 | 192 | .0 |
193 | .interned() | 193 | .interned() |
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index d4ba707b4..b45e811fa 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs | |||
@@ -8,7 +8,7 @@ | |||
8 | use std::{iter, sync::Arc}; | 8 | use std::{iter, sync::Arc}; |
9 | 9 | ||
10 | use base_db::CrateId; | 10 | use base_db::CrateId; |
11 | use chalk_ir::{cast::Cast, interner::HasInterner, Mutability, Safety}; | 11 | use chalk_ir::{cast::Cast, fold::Shift, interner::HasInterner, Mutability, Safety}; |
12 | use hir_def::{ | 12 | use hir_def::{ |
13 | adt::StructKind, | 13 | adt::StructKind, |
14 | builtin_type::BuiltinType, | 14 | builtin_type::BuiltinType, |
@@ -488,7 +488,7 @@ impl<'a> TyLoweringContext<'a> { | |||
488 | }; | 488 | }; |
489 | // We need to shift in the bound vars, since | 489 | // We need to shift in the bound vars, since |
490 | // associated_type_shorthand_candidates does not do that | 490 | // associated_type_shorthand_candidates does not do that |
491 | let substs = substs.shifted_in_from(self.in_binders); | 491 | let substs = substs.shifted_in_from(&Interner, self.in_binders); |
492 | // FIXME handle type parameters on the segment | 492 | // FIXME handle type parameters on the segment |
493 | return Some( | 493 | return Some( |
494 | TyKind::Alias(AliasTy::Projection(ProjectionTy { | 494 | TyKind::Alias(AliasTy::Projection(ProjectionTy { |
@@ -847,7 +847,7 @@ pub fn associated_type_shorthand_candidates<R>( | |||
847 | // FIXME: how to correctly handle higher-ranked bounds here? | 847 | // FIXME: how to correctly handle higher-ranked bounds here? |
848 | WhereClause::Implemented(tr) => search( | 848 | WhereClause::Implemented(tr) => search( |
849 | tr.clone() | 849 | tr.clone() |
850 | .shifted_out_to(DebruijnIndex::ONE) | 850 | .shifted_out_to(&Interner, DebruijnIndex::ONE) |
851 | .expect("FIXME unexpected higher-ranked trait bound"), | 851 | .expect("FIXME unexpected higher-ranked trait bound"), |
852 | ), | 852 | ), |
853 | _ => None, | 853 | _ => None, |
diff --git a/crates/hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs index c2e289660..62cf0fecf 100644 --- a/crates/hir_ty/src/traits/chalk/mapping.rs +++ b/crates/hir_ty/src/traits/chalk/mapping.rs | |||
@@ -288,7 +288,7 @@ pub(super) fn generic_predicate_to_inline_bound( | |||
288 | ) -> Option<chalk_ir::Binders<rust_ir::InlineBound<Interner>>> { | 288 | ) -> Option<chalk_ir::Binders<rust_ir::InlineBound<Interner>>> { |
289 | // An InlineBound is like a GenericPredicate, except the self type is left out. | 289 | // An InlineBound is like a GenericPredicate, except the self type is left out. |
290 | // We don't have a special type for this, but Chalk does. | 290 | // We don't have a special type for this, but Chalk does. |
291 | let self_ty_shifted_in = self_ty.clone().shifted_in_from(DebruijnIndex::ONE); | 291 | let self_ty_shifted_in = self_ty.clone().shifted_in_from(&Interner, DebruijnIndex::ONE); |
292 | let (pred, binders) = pred.as_ref().into_value_and_skipped_binders(); | 292 | let (pred, binders) = pred.as_ref().into_value_and_skipped_binders(); |
293 | match pred { | 293 | match pred { |
294 | WhereClause::Implemented(trait_ref) => { | 294 | WhereClause::Implemented(trait_ref) => { |
diff --git a/crates/hir_ty/src/utils.rs b/crates/hir_ty/src/utils.rs index 8d5d5cd73..d26f5152c 100644 --- a/crates/hir_ty/src/utils.rs +++ b/crates/hir_ty/src/utils.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | //! query, but can't be computed directly from `*Data` (ie, which need a `db`). | 2 | //! query, but can't be computed directly from `*Data` (ie, which need a `db`). |
3 | use std::sync::Arc; | 3 | use std::sync::Arc; |
4 | 4 | ||
5 | use chalk_ir::{BoundVar, DebruijnIndex}; | 5 | use chalk_ir::{fold::Shift, BoundVar, DebruijnIndex}; |
6 | use hir_def::{ | 6 | use hir_def::{ |
7 | db::DefDatabase, | 7 | db::DefDatabase, |
8 | generics::{ | 8 | generics::{ |
@@ -69,7 +69,7 @@ fn direct_super_trait_refs(db: &dyn HirDatabase, trait_ref: &TraitRef) -> Vec<Tr | |||
69 | // FIXME: how to correctly handle higher-ranked bounds here? | 69 | // FIXME: how to correctly handle higher-ranked bounds here? |
70 | WhereClause::Implemented(tr) => Some( | 70 | WhereClause::Implemented(tr) => Some( |
71 | tr.clone() | 71 | tr.clone() |
72 | .shifted_out_to(DebruijnIndex::ONE) | 72 | .shifted_out_to(&Interner, DebruijnIndex::ONE) |
73 | .expect("FIXME unexpected higher-ranked trait bound"), | 73 | .expect("FIXME unexpected higher-ranked trait bound"), |
74 | ), | 74 | ), |
75 | _ => None, | 75 | _ => None, |