-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 on type mismatch: Index out of bounds #31964
Comments
Even smaller test case: fn main() {
// each statement produces the same ICE
let _: &mut String = &mut Vec::new();
let _: &String = &Vec::new();
let _: &() = &Vec::new();
} (Edited with more examples). |
Nominating because this seems to be coming up all over the place, I think we've gotten 3-4 separate reports about this ICE (a regression on beta). Note that an ICE happens on stable, but a worse ICE happens on beta/nightly... |
To be more precise, the regression is that the actual error message about mismatched types only shows up on stable and not on beta or nightly. |
related to #25801 |
Not method resolution, but rather coercion ( |
I am running rustc 1.8.0 from debian SID and I get the same error, but |
So I tried to use the snapshotting mechanism in the ObligationGraph in a similar fashion to #26324, but it does not work since coercion executes |
@nikomatsakis I thought I fixed coercion to never use |
@eddyb Probably the latter. Coercion calls into |
It may be possible to refactor this call upward, not sure. |
@nikomatsakis Oh, I had removed only the call from within |
I suppose we could manually call |
Refactor `FnCtxt::autoderef` to use an external iterator and to not register any obligation from the main autoderef loop, but rather to register them after (and if) the loop successfully completes. Fixes rust-lang#24819 Fixes rust-lang#25801 Fixes rust-lang#27631 Fixes rust-lang#31258 Fixes rust-lang#31964 Fixes rust-lang#32320 Fixes rust-lang#33515 Fixes rust-lang#33755
refactor autoderef to avoid prematurely registering obligations Refactor `FnCtxt::autoderef` to use an external iterator and to not register any obligation from the main autoderef loop, but rather to register them after (and if) the loop successfully completes. Fixes rust-lang#24819 Fixes rust-lang#25801 Fixes rust-lang#27631 Fixes rust-lang#31258 Fixes rust-lang#31964 Fixes rust-lang#32320 Fixes rust-lang#33515 Fixes rust-lang#33755 r? @eddyb
Test case:
Output:
The text was updated successfully, but these errors were encountered: