diff options
author | Florian Diebold <[email protected]> | 2021-04-05 21:32:58 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2021-04-05 22:00:50 +0100 |
commit | 1ae967bf8e01262f1ace1c06f6670f09fcf92fd2 (patch) | |
tree | db440a2bdd6148bc292bd20397f389671f8cb48c /crates/hir_ty/src/lower.rs | |
parent | edc59d897d56815e8b9814cdc4ff084100e4f3b4 (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/lower.rs')
-rw-r--r-- | crates/hir_ty/src/lower.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs index 20bb7dd59..3cbb6ad54 100644 --- a/crates/hir_ty/src/lower.rs +++ b/crates/hir_ty/src/lower.rs | |||
@@ -178,8 +178,9 @@ impl<'a> TyLoweringContext<'a> { | |||
178 | } | 178 | } |
179 | TypeRef::Placeholder => TyKind::Error.intern(&Interner), | 179 | TypeRef::Placeholder => TyKind::Error.intern(&Interner), |
180 | TypeRef::Fn(params, is_varargs) => { | 180 | TypeRef::Fn(params, is_varargs) => { |
181 | let substs = | 181 | let substs = self.with_shifted_in(DebruijnIndex::ONE, |ctx| { |
182 | Substitution::from_iter(&Interner, params.iter().map(|tr| self.lower_ty(tr))); | 182 | Substitution::from_iter(&Interner, params.iter().map(|tr| ctx.lower_ty(tr))) |
183 | }); | ||
183 | TyKind::Function(FnPointer { | 184 | TyKind::Function(FnPointer { |
184 | num_binders: 0, // FIXME lower `for<'a> fn()` correctly | 185 | num_binders: 0, // FIXME lower `for<'a> fn()` correctly |
185 | sig: FnSig { abi: (), safety: Safety::Safe, variadic: *is_varargs }, | 186 | sig: FnSig { abi: (), safety: Safety::Safe, variadic: *is_varargs }, |