diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-05 22:03:01 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-05 22:03:01 +0100 |
commit | 4bc8a018302d53951ae855ba57d07095a16ef182 (patch) | |
tree | db440a2bdd6148bc292bd20397f389671f8cb48c /crates/hir_ty/src/infer | |
parent | 7ce0e9c9ca552e063855d60df7dca65ba9953fc3 (diff) | |
parent | 1ae967bf8e01262f1ace1c06f6670f09fcf92fd2 (diff) |
Merge #8360
8360: Fix shifting of binders in FnPointer r=flodiebold a=flodiebold
- 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
Tested with the binders validator on various repos, so I'm pretty sure this doesn't mess things up :grimacing:
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/infer')
-rw-r--r-- | crates/hir_ty/src/infer/expr.rs | 6 |
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 | ||
29 | use super::{ | 29 | use 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(); |