aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/infer.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-02-22 12:31:30 +0000
committerGitHub <[email protected]>2020-02-22 12:31:30 +0000
commit2cbe8a4c4be2a69b27c248ab96341c2336f983cd (patch)
treeee1a32b47f889ed132a314286cd90a07f3700216 /crates/ra_hir_ty/src/infer.rs
parent7836720f2e9a7fa01ae09ff9d51413ecd5877139 (diff)
parent5a6e770f99d1549432c1e8a1abb1aada09ad2590 (diff)
Merge #3263
3263: Implement unsizing coercions using Chalk r=matklad a=flodiebold These are coercions like `&[T; n] -> &[T]`, which are handled by the `Unsize` and `CoerceUnsized` traits. The impls for `Unsize` are all built in to the compiler and require special handling, so we need to provide them to Chalk. This adds the following `Unsize` impls: - `Unsize<[T]> for [T; _]` - `Unsize<dyn Trait> for T where T: Trait` - `Unsize<dyn SuperTrait> for dyn SubTrait` Hence we are still missing the 'unsizing the last field of a generic struct' case. Co-authored-by: Florian Diebold <[email protected]> Co-authored-by: Florian Diebold <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/infer.rs')
-rw-r--r--crates/ra_hir_ty/src/infer.rs7
1 files changed, 0 insertions, 7 deletions
diff --git a/crates/ra_hir_ty/src/infer.rs b/crates/ra_hir_ty/src/infer.rs
index 76069eb9c..6e1d268de 100644
--- a/crates/ra_hir_ty/src/infer.rs
+++ b/crates/ra_hir_ty/src/infer.rs
@@ -206,12 +206,6 @@ struct InferenceContext<'a, D: HirDatabase> {
206 /// closures, but currently this is the only field that will change there, 206 /// closures, but currently this is the only field that will change there,
207 /// so it doesn't make sense. 207 /// so it doesn't make sense.
208 return_ty: Ty, 208 return_ty: Ty,
209
210 /// Impls of `CoerceUnsized` used in coercion.
211 /// (from_ty_ctor, to_ty_ctor) => coerce_generic_index
212 // FIXME: Use trait solver for this.
213 // Chalk seems unable to work well with builtin impl of `Unsize` now.
214 coerce_unsized_map: FxHashMap<(TypeCtor, TypeCtor), usize>,
215} 209}
216 210
217impl<'a, D: HirDatabase> InferenceContext<'a, D> { 211impl<'a, D: HirDatabase> InferenceContext<'a, D> {
@@ -222,7 +216,6 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
222 obligations: Vec::default(), 216 obligations: Vec::default(),
223 return_ty: Ty::Unknown, // set in collect_fn_signature 217 return_ty: Ty::Unknown, // set in collect_fn_signature
224 trait_env: TraitEnvironment::lower(db, &resolver), 218 trait_env: TraitEnvironment::lower(db, &resolver),
225 coerce_unsized_map: Self::init_coerce_unsized_map(db, &resolver),
226 db, 219 db,
227 owner, 220 owner,
228 body: db.body(owner), 221 body: db.body(owner),