aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/infer
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2021-04-05 21:32:58 +0100
committerFlorian Diebold <[email protected]>2021-04-05 22:00:50 +0100
commit1ae967bf8e01262f1ace1c06f6670f09fcf92fd2 (patch)
treedb440a2bdd6148bc292bd20397f389671f8cb48c /crates/hir_ty/src/infer
parentedc59d897d56815e8b9814cdc4ff084100e4f3b4 (diff)
Fix shifting of binders in FnPointer
- don't shift in/out for Chalk mapping (we want to have the same binders now) - do shift in when creating the signature for a closure (though it shouldn't matter much) - do shift in when lowering a `fn()` type - correctly deal with the implied binder in TypeWalk
Diffstat (limited to 'crates/hir_ty/src/infer')
-rw-r--r--crates/hir_ty/src/infer/expr.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/hir_ty/src/infer/expr.rs b/crates/hir_ty/src/infer/expr.rs
index a2a7236a8..ff564106b 100644
--- a/crates/hir_ty/src/infer/expr.rs
+++ b/crates/hir_ty/src/infer/expr.rs
@@ -23,7 +23,7 @@ use crate::{
23 traits::{chalk::from_chalk, FnTrait}, 23 traits::{chalk::from_chalk, FnTrait},
24 utils::{generics, variant_data, Generics}, 24 utils::{generics, variant_data, Generics},
25 AdtId, Binders, CallableDefId, FnPointer, FnSig, FnSubst, InEnvironment, Interner, 25 AdtId, Binders, CallableDefId, FnPointer, FnSig, FnSubst, InEnvironment, Interner,
26 ProjectionTyExt, Rawness, Scalar, Substitution, TraitRef, Ty, TyBuilder, TyKind, 26 ProjectionTyExt, Rawness, Scalar, Substitution, TraitRef, Ty, TyBuilder, TyKind, TypeWalk,
27}; 27};
28 28
29use super::{ 29use super::{
@@ -262,7 +262,9 @@ impl<'a> InferenceContext<'a> {
262 let sig_ty = TyKind::Function(FnPointer { 262 let sig_ty = TyKind::Function(FnPointer {
263 num_binders: 0, 263 num_binders: 0,
264 sig: FnSig { abi: (), safety: chalk_ir::Safety::Safe, variadic: false }, 264 sig: FnSig { abi: (), safety: chalk_ir::Safety::Safe, variadic: false },
265 substitution: FnSubst(Substitution::from_iter(&Interner, sig_tys.clone())), 265 substitution: FnSubst(
266 Substitution::from_iter(&Interner, sig_tys.clone()).shifted_in(&Interner),
267 ),
266 }) 268 })
267 .intern(&Interner); 269 .intern(&Interner);
268 let closure_id = self.db.intern_closure((self.owner, tgt_expr)).into(); 270 let closure_id = self.db.intern_closure((self.owner, tgt_expr)).into();