-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ICE]: index out of bounds: the len is 27 but the index is 28
snapshot_vec.rs
#107158
Comments
Thanks! |
searched nightlies: from nightly-2022-12-01 to nightly-2023-01-21 bisected with cargo-bisect-rustc v0.6.5Host triple: x86_64-unknown-linux-gnu cargo bisect-rustc ice --start 2022-12-1 |
It's #106400, i'll fix it unless someone beats me to it since I'm busy this weekend |
Hi @estebank it's Justin from Commure 👋. I found a compiler panic you made 😀 |
…ush, r=estebank Fix escaping inference var ICE in `point_at_expr_source_of_inferred_type` Fixes rust-lang#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 rust-lang#106590, but that's a bit bigger issue that needs some more thinking about)
…ush, r=estebank Fix escaping inference var ICE in `point_at_expr_source_of_inferred_type` Fixes rust-lang#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 rust-lang#106590, but that's a bit bigger issue that needs some more thinking about)
@justinpombrio sorry for causing you trouble 😅 |
I tried this code on nightly:
I expected to see this happen: compiler does not panic.
Instead, this happened: compiler panics and suggests I open a bug report.
I initially posted to #107087, but @compiler-errors says this is a different issue, despite panicking on the same line in
snapshot_vec.rs
. (Though I'm realizing now that might be the proximal cause but not very related to the root cause.)Meta
rustc --version --verbose
:Panic message
Thanks all for maintaining Rust, by the way.
The text was updated successfully, but these errors were encountered: