mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
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
This commit is contained in:
parent
edc59d897d
commit
1ae967bf8e
4 changed files with 23 additions and 10 deletions
|
@ -23,7 +23,7 @@ use crate::{
|
|||
traits::{chalk::from_chalk, FnTrait},
|
||||
utils::{generics, variant_data, Generics},
|
||||
AdtId, Binders, CallableDefId, FnPointer, FnSig, FnSubst, InEnvironment, Interner,
|
||||
ProjectionTyExt, Rawness, Scalar, Substitution, TraitRef, Ty, TyBuilder, TyKind,
|
||||
ProjectionTyExt, Rawness, Scalar, Substitution, TraitRef, Ty, TyBuilder, TyKind, TypeWalk,
|
||||
};
|
||||
|
||||
use super::{
|
||||
|
@ -262,7 +262,9 @@ impl<'a> InferenceContext<'a> {
|
|||
let sig_ty = TyKind::Function(FnPointer {
|
||||
num_binders: 0,
|
||||
sig: FnSig { abi: (), safety: chalk_ir::Safety::Safe, variadic: false },
|
||||
substitution: FnSubst(Substitution::from_iter(&Interner, sig_tys.clone())),
|
||||
substitution: FnSubst(
|
||||
Substitution::from_iter(&Interner, sig_tys.clone()).shifted_in(&Interner),
|
||||
),
|
||||
})
|
||||
.intern(&Interner);
|
||||
let closure_id = self.db.intern_closure((self.owner, tgt_expr)).into();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue