diff options
author | Dmitry <[email protected]> | 2020-08-09 14:35:51 +0100 |
---|---|---|
committer | Dmitry <[email protected]> | 2020-08-09 14:39:32 +0100 |
commit | 8068302fefc75440b823f4bf1731a5f347d7c767 (patch) | |
tree | 251b967182e79bc82a58c2fb208c688f6152df1f /crates/ra_hir_ty/src/traits/chalk/mapping.rs | |
parent | 1a43a0f63e0008787225abb6fb2baef97b6a39e0 (diff) | |
parent | 8a57afe5a4bfab40072a83f7dc4ca560bf860919 (diff) |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'crates/ra_hir_ty/src/traits/chalk/mapping.rs')
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk/mapping.rs | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/crates/ra_hir_ty/src/traits/chalk/mapping.rs b/crates/ra_hir_ty/src/traits/chalk/mapping.rs index 09d8347ca..b3e92993d 100644 --- a/crates/ra_hir_ty/src/traits/chalk/mapping.rs +++ b/crates/ra_hir_ty/src/traits/chalk/mapping.rs | |||
@@ -30,11 +30,16 @@ impl ToChalk for Ty { | |||
30 | Ty::Apply(apply_ty) => match apply_ty.ctor { | 30 | Ty::Apply(apply_ty) => match apply_ty.ctor { |
31 | TypeCtor::Ref(m) => ref_to_chalk(db, m, apply_ty.parameters), | 31 | TypeCtor::Ref(m) => ref_to_chalk(db, m, apply_ty.parameters), |
32 | TypeCtor::Array => array_to_chalk(db, apply_ty.parameters), | 32 | TypeCtor::Array => array_to_chalk(db, apply_ty.parameters), |
33 | TypeCtor::FnPtr { num_args: _, is_varargs: _ } => { | 33 | TypeCtor::FnPtr { num_args: _, is_varargs } => { |
34 | // FIXME: handle is_varargs | ||
35 | let substitution = apply_ty.parameters.to_chalk(db).shifted_in(&Interner); | 34 | let substitution = apply_ty.parameters.to_chalk(db).shifted_in(&Interner); |
36 | chalk_ir::TyData::Function(chalk_ir::Fn { num_binders: 0, substitution }) | 35 | chalk_ir::TyData::Function(chalk_ir::FnPointer { |
37 | .intern(&Interner) | 36 | num_binders: 0, |
37 | abi: (), | ||
38 | safety: chalk_ir::Safety::Safe, | ||
39 | variadic: is_varargs, | ||
40 | substitution, | ||
41 | }) | ||
42 | .intern(&Interner) | ||
38 | } | 43 | } |
39 | _ => { | 44 | _ => { |
40 | let name = apply_ty.ctor.to_chalk(db); | 45 | let name = apply_ty.ctor.to_chalk(db); |
@@ -118,7 +123,12 @@ impl ToChalk for Ty { | |||
118 | let parameters = from_chalk(db, opaque_ty.substitution); | 123 | let parameters = from_chalk(db, opaque_ty.substitution); |
119 | Ty::Opaque(OpaqueTy { opaque_ty_id: impl_trait_id, parameters }) | 124 | Ty::Opaque(OpaqueTy { opaque_ty_id: impl_trait_id, parameters }) |
120 | } | 125 | } |
121 | chalk_ir::TyData::Function(chalk_ir::Fn { num_binders, substitution }) => { | 126 | chalk_ir::TyData::Function(chalk_ir::FnPointer { |
127 | num_binders, | ||
128 | variadic, | ||
129 | substitution, | ||
130 | .. | ||
131 | }) => { | ||
122 | assert_eq!(num_binders, 0); | 132 | assert_eq!(num_binders, 0); |
123 | let parameters: Substs = from_chalk( | 133 | let parameters: Substs = from_chalk( |
124 | db, | 134 | db, |
@@ -127,7 +137,7 @@ impl ToChalk for Ty { | |||
127 | Ty::Apply(ApplicationTy { | 137 | Ty::Apply(ApplicationTy { |
128 | ctor: TypeCtor::FnPtr { | 138 | ctor: TypeCtor::FnPtr { |
129 | num_args: (parameters.len() - 1) as u16, | 139 | num_args: (parameters.len() - 1) as u16, |
130 | is_varargs: false, | 140 | is_varargs: variadic, |
131 | }, | 141 | }, |
132 | parameters, | 142 | parameters, |
133 | }) | 143 | }) |