diff options
author | Florian Diebold <[email protected]> | 2019-12-15 17:56:38 +0000 |
---|---|---|
committer | Florian Diebold <[email protected]> | 2019-12-15 17:56:38 +0000 |
commit | 6e1c2d0df89a390be33c81b6e03a5ad352763593 (patch) | |
tree | f3ba344e185e17e6e62ce650462fd63af9eddd26 /crates/ra_hir_ty/src/infer | |
parent | ac961b261458bfeb23f7d4e896d5f957b0854a3a (diff) |
Handle impl Trait more correctly
When calling a function, argument-position impl Trait is transparent; same for
return-position impl Trait when inside the function. So in these cases, we need
to represent that type not by `Ty::Opaque`, but by a type variable that can be
unified with whatever flows into there.
Diffstat (limited to 'crates/ra_hir_ty/src/infer')
-rw-r--r-- | crates/ra_hir_ty/src/infer/expr.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/crates/ra_hir_ty/src/infer/expr.rs b/crates/ra_hir_ty/src/infer/expr.rs index 2e3cdd53a..924ad3e81 100644 --- a/crates/ra_hir_ty/src/infer/expr.rs +++ b/crates/ra_hir_ty/src/infer/expr.rs | |||
@@ -613,6 +613,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> { | |||
613 | continue; | 613 | continue; |
614 | } | 614 | } |
615 | 615 | ||
616 | let param_ty = self.insert_vars_for_impl_trait(param_ty); | ||
616 | let param_ty = self.normalize_associated_types_in(param_ty); | 617 | let param_ty = self.normalize_associated_types_in(param_ty); |
617 | self.infer_expr_coerce(arg, &Expectation::has_type(param_ty.clone())); | 618 | self.infer_expr_coerce(arg, &Expectation::has_type(param_ty.clone())); |
618 | } | 619 | } |