diff options
author | Florian Diebold <[email protected]> | 2020-07-10 18:14:33 +0100 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2020-07-12 14:37:32 +0100 |
commit | 8a72e40ca91cc51a93b8145582feaccb7254abb6 (patch) | |
tree | b01fcbf7c9cc0a4836e080c1f59b149a60871a0c /crates/ra_hir_ty/src/traits | |
parent | 70d1b848eb1b8e2c463040be205ee52757a0e19c (diff) |
Fix #4966
We add a level of binders when converting our function pointer to Chalk's; we
need to remove it again on the way back.
Diffstat (limited to 'crates/ra_hir_ty/src/traits')
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk/mapping.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/ra_hir_ty/src/traits/chalk/mapping.rs b/crates/ra_hir_ty/src/traits/chalk/mapping.rs index 433d6aa03..cb354d586 100644 --- a/crates/ra_hir_ty/src/traits/chalk/mapping.rs +++ b/crates/ra_hir_ty/src/traits/chalk/mapping.rs | |||
@@ -115,8 +115,12 @@ impl ToChalk for Ty { | |||
115 | let parameters = from_chalk(db, opaque_ty.substitution); | 115 | let parameters = from_chalk(db, opaque_ty.substitution); |
116 | Ty::Opaque(OpaqueTy { opaque_ty_id: impl_trait_id, parameters }) | 116 | Ty::Opaque(OpaqueTy { opaque_ty_id: impl_trait_id, parameters }) |
117 | } | 117 | } |
118 | chalk_ir::TyData::Function(chalk_ir::Fn { num_binders: _, substitution }) => { | 118 | chalk_ir::TyData::Function(chalk_ir::Fn { num_binders, substitution }) => { |
119 | let parameters: Substs = from_chalk(db, substitution); | 119 | assert_eq!(num_binders, 0); |
120 | let parameters: Substs = from_chalk( | ||
121 | db, | ||
122 | substitution.shifted_out(&Interner).expect("fn ptr should have no binders"), | ||
123 | ); | ||
120 | Ty::Apply(ApplicationTy { | 124 | Ty::Apply(ApplicationTy { |
121 | ctor: TypeCtor::FnPtr { num_args: (parameters.len() - 1) as u16 }, | 125 | ctor: TypeCtor::FnPtr { num_args: (parameters.len() - 1) as u16 }, |
122 | parameters, | 126 | parameters, |