diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-12 21:31:51 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-12 21:31:51 +0100 |
commit | 5ca7cd960b908944a2f3f66a1d0ee5df98b78959 (patch) | |
tree | 5f4b29e4d2dbfc02e178a4d33731319e510468bb /crates/ra_hir_ty/src/traits/chalk | |
parent | 39e049d2a1d7e0adbd9546f9e8124843443b31ce (diff) | |
parent | 8a72e40ca91cc51a93b8145582feaccb7254abb6 (diff) |
Merge #5331
5331: Fix #4966 r=flodiebold a=flodiebold
We add a level of binders when converting our function pointer to Chalk's; we need to remove it again on the way back.
Fixes #4966.
Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/traits/chalk')
-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 7dc9ee759..06453ef82 100644 --- a/crates/ra_hir_ty/src/traits/chalk/mapping.rs +++ b/crates/ra_hir_ty/src/traits/chalk/mapping.rs | |||
@@ -117,8 +117,12 @@ impl ToChalk for Ty { | |||
117 | let parameters = from_chalk(db, opaque_ty.substitution); | 117 | let parameters = from_chalk(db, opaque_ty.substitution); |
118 | Ty::Opaque(OpaqueTy { opaque_ty_id: impl_trait_id, parameters }) | 118 | Ty::Opaque(OpaqueTy { opaque_ty_id: impl_trait_id, parameters }) |
119 | } | 119 | } |
120 | chalk_ir::TyData::Function(chalk_ir::Fn { num_binders: _, substitution }) => { | 120 | chalk_ir::TyData::Function(chalk_ir::Fn { num_binders, substitution }) => { |
121 | let parameters: Substs = from_chalk(db, substitution); | 121 | assert_eq!(num_binders, 0); |
122 | let parameters: Substs = from_chalk( | ||
123 | db, | ||
124 | substitution.shifted_out(&Interner).expect("fn ptr should have no binders"), | ||
125 | ); | ||
122 | Ty::Apply(ApplicationTy { | 126 | Ty::Apply(ApplicationTy { |
123 | ctor: TypeCtor::FnPtr { num_args: (parameters.len() - 1) as u16 }, | 127 | ctor: TypeCtor::FnPtr { num_args: (parameters.len() - 1) as u16 }, |
124 | parameters, | 128 | parameters, |