mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
Don't unify array elements with their arrays
This commit is contained in:
parent
85f0f9eb1b
commit
3b2602cbb2
2 changed files with 21 additions and 9 deletions
|
@ -735,10 +735,11 @@ impl<'a> InferenceContext<'a> {
|
|||
_ => self.table.new_type_var(),
|
||||
};
|
||||
|
||||
let expected = Expectation::has_type(elem_ty.clone());
|
||||
let len = match array {
|
||||
Array::ElementList(items) => {
|
||||
for expr in items.iter() {
|
||||
let cur_elem_ty = self.infer_expr_inner(*expr, expected);
|
||||
let cur_elem_ty = self.infer_expr_inner(*expr, &expected);
|
||||
elem_ty = self.coerce_merge_branch(Some(*expr), &elem_ty, &cur_elem_ty);
|
||||
}
|
||||
Some(items.len() as u64)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue