mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
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.
This commit is contained in:
parent
ac961b2614
commit
6e1c2d0df8
3 changed files with 56 additions and 1 deletions
|
@ -613,6 +613,7 @@ impl<'a, D: HirDatabase> InferenceContext<'a, D> {
|
|||
continue;
|
||||
}
|
||||
|
||||
let param_ty = self.insert_vars_for_impl_trait(param_ty);
|
||||
let param_ty = self.normalize_associated_types_in(param_ty);
|
||||
self.infer_expr_coerce(arg, &Expectation::has_type(param_ty.clone()));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue