Skip to content

Commit b25b147

Browse files
committed
Fix shifted_{in,out} calls
1 parent dc0b581 commit b25b147

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

crates/hir_ty/src/infer/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::iter::{repeat, repeat_with};
44
use std::{mem, sync::Arc};
55

6-
use chalk_ir::{cast::Cast, Mutability, TyVariableKind};
6+
use chalk_ir::{cast::Cast, fold::Shift, Mutability, TyVariableKind};
77
use hir_def::{
88
expr::{Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp},
99
path::{GenericArg, GenericArgs},

crates/hir_ty/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use std::sync::Arc;
3535
use base_db::salsa;
3636
use chalk_ir::{
3737
cast::{CastTo, Caster},
38-
fold::Fold,
38+
fold::{Fold, Shift},
3939
interner::HasInterner,
4040
UintTy,
4141
};
@@ -123,9 +123,9 @@ pub fn param_idx(db: &dyn HirDatabase, id: TypeParamId) -> Option<usize> {
123123

124124
pub fn wrap_empty_binders<T>(value: T) -> Binders<T>
125125
where
126-
T: TypeWalk + HasInterner<Interner = Interner>,
126+
T: Fold<Interner, Result = T> + HasInterner<Interner = Interner>,
127127
{
128-
Binders::empty(&Interner, value.shifted_in_from(DebruijnIndex::ONE))
128+
Binders::empty(&Interner, value.shifted_in_from(&Interner, DebruijnIndex::ONE))
129129
}
130130

131131
pub fn make_only_type_binders<T: HasInterner<Interner = Interner>>(
@@ -187,7 +187,7 @@ impl CallableSig {
187187
params_and_return: fn_ptr
188188
.substitution
189189
.clone()
190-
.shifted_out_to(DebruijnIndex::ONE)
190+
.shifted_out_to(&Interner, DebruijnIndex::ONE)
191191
.expect("unexpected lifetime vars in fn ptr")
192192
.0
193193
.interned()

crates/hir_ty/src/lower.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use std::{iter, sync::Arc};
99

1010
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};
1212
use hir_def::{
1313
adt::StructKind,
1414
builtin_type::BuiltinType,
@@ -488,7 +488,7 @@ impl<'a> TyLoweringContext<'a> {
488488
};
489489
// We need to shift in the bound vars, since
490490
// 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);
492492
// FIXME handle type parameters on the segment
493493
return Some(
494494
TyKind::Alias(AliasTy::Projection(ProjectionTy {
@@ -847,7 +847,7 @@ pub fn associated_type_shorthand_candidates<R>(
847847
// FIXME: how to correctly handle higher-ranked bounds here?
848848
WhereClause::Implemented(tr) => search(
849849
tr.clone()
850-
.shifted_out_to(DebruijnIndex::ONE)
850+
.shifted_out_to(&Interner, DebruijnIndex::ONE)
851851
.expect("FIXME unexpected higher-ranked trait bound"),
852852
),
853853
_ => None,

crates/hir_ty/src/traits/chalk/mapping.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ pub(super) fn generic_predicate_to_inline_bound(
288288
) -> Option<chalk_ir::Binders<rust_ir::InlineBound<Interner>>> {
289289
// An InlineBound is like a GenericPredicate, except the self type is left out.
290290
// 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);
292292
let (pred, binders) = pred.as_ref().into_value_and_skipped_binders();
293293
match pred {
294294
WhereClause::Implemented(trait_ref) => {

crates/hir_ty/src/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//! query, but can't be computed directly from `*Data` (ie, which need a `db`).
33
use std::sync::Arc;
44

5-
use chalk_ir::{BoundVar, DebruijnIndex};
5+
use chalk_ir::{fold::Shift, BoundVar, DebruijnIndex};
66
use hir_def::{
77
db::DefDatabase,
88
generics::{
@@ -69,7 +69,7 @@ fn direct_super_trait_refs(db: &dyn HirDatabase, trait_ref: &TraitRef) -> Vec<Tr
6969
// FIXME: how to correctly handle higher-ranked bounds here?
7070
WhereClause::Implemented(tr) => Some(
7171
tr.clone()
72-
.shifted_out_to(DebruijnIndex::ONE)
72+
.shifted_out_to(&Interner, DebruijnIndex::ONE)
7373
.expect("FIXME unexpected higher-ranked trait bound"),
7474
),
7575
_ => None,

0 commit comments

Comments
 (0)