diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-01-26 06:15:26 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-26 06:15:26 +0100 |
| commit | 5bc49807ddad3669836e3bbfe09ab680bc6aad3d (patch) | |
| tree | 10501d27b4b439ca992db6e96f9cc20fdbb0c8ee /compiler/rustc_mir_transform/src | |
| parent | 4b51b20d8710f7e543be02ac9ef6f65842c1926a (diff) | |
| parent | 9f933b5642c08e4241cbfed0f15270df552ce8e6 (diff) | |
| download | rust-5bc49807ddad3669836e3bbfe09ab680bc6aad3d.tar.gz rust-5bc49807ddad3669836e3bbfe09ab680bc6aad3d.zip | |
Rollup merge of #107175 - compiler-errors:bad-types-in-vec-push, r=estebank
Fix escaping inference var ICE in `point_at_expr_source_of_inferred_type`
Fixes #107158
`point_at_expr_source_of_inferred_type` uses `lookup_probe` to adjust the self type of a method receiver -- but that method returns inference variables from inside a probe. That means that the ty vars are no longer valid, so we can't use any infcx methods on them.
Also, pass some extra span info to hack a quick solution to bad labels, resulting in this diagnostic improvement:
```rust
fn example2() {
let mut x = vec![1];
x.push("");
}
```
```diff
error[E0308]: mismatched types
--> src/main.rs:5:12
|
5 | x.push("");
| ---- ^^
| | |
| | expected integer, found `&str`
- | | this is of type `&'static str`, which causes `x` to be inferred as `Vec<{integer}>`
| arguments to this method are incorrect
```
(since that "which causes `x` to be inferred as `Vec<{integer}>` part is wrong)
r? `@estebank`
(we really should make this code better in general, cc #106590, but that's a bit bigger issue that needs some more thinking about)
Diffstat (limited to 'compiler/rustc_mir_transform/src')
0 files changed, 0 insertions, 0 deletions
