]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #106400 - estebank:type-errs, r=compiler-errors
authorDylan DPC <99973273+Dylan-DPC@users.noreply.github.com>
Fri, 6 Jan 2023 06:08:56 +0000 (11:38 +0530)
committerGitHub <noreply@github.com>
Fri, 6 Jan 2023 06:08:56 +0000 (11:38 +0530)
commit6ae0f08c193d67bfe6336796e0c54da35d330504
tree10c69cec34df6ee08f107fd45c71d1f3d17d3908
parent0853d9677ca903cd650d5c4b93b1c55e7995cf01
parentf98f2fcb5e4985bd7b12bae4ec03f2d96197fb2b
Rollup merge of #106400 - estebank:type-errs, r=compiler-errors

Point at expressions where inference refines an unexpected type

Fix #106355. Fix #14007. (!)

```
error[E0308]: mismatched types
  --> src/test/ui/type/type-check/point-at-inference.rs:12:9
   |
9  |         foo.push(i);
   |                  - this is of type `&{integer}`, which makes `foo` to be inferred as `Vec<&{integer}>`
...
12 |     bar(foo);
   |     --- ^^^ expected `i32`, found `&{integer}`
   |     |
   |     arguments to this function are incorrect
   |
   = note: expected struct `Vec<i32>`
              found struct `Vec<&{integer}>`
note: function defined here
  --> src/test/ui/type/type-check/point-at-inference.rs:2:4
   |
2  | fn bar(_: Vec<i32>) {}
   |    ^^^ -----------
help: consider dereferencing the borrow
   |
9  |         foo.push(*i);
   |                  +
```