Skip to content
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

Repeated coercion ICE for an erroring indexing expression since 1.9. #40861

Closed
eddyb opened this Issue Mar 27, 2017 · 1 comment

Comments

Projects
None yet
3 participants
@eddyb
Copy link
Member

eddyb commented Mar 27, 2017

fn f(_: &[f32]) {}
fn main() {
    ()[f(&[1.0])];
}
error: internal compiler error: /checkout/src/librustc_typeck/check/coercion.rs:693:
    expr already has an adjustment on it!

Regressed between 1.8 and 1.9 and found by @kennytm in #40610.
Like #40610, it only happens when there's already an error, possibly from a suggestion attempt.

Meta: perhaps there should be a label for ICE-on-error.

@arielb1

This comment has been minimized.

Copy link
Contributor

arielb1 commented Mar 27, 2017

Looks like a double call to check_expr_has_type (

self.check_expr_has_type(&idx, self.tcx.types.err);
) introduced in #24475.

@brson brson added the T-compiler label Apr 4, 2017

bors added a commit that referenced this issue Apr 6, 2017

Auto merge of #40863 - eddyb:coerce-only-once, r=arielb1
Avoid type-checking addition and indexing twice.

Fixes #40610 by moving the common `check_expr_coercable_to_type` call before the error reporting logic for binops and removing the one from `check_str_addition`.
Fixes #40861 by removing an unnecessary `check_expr_coercable_to_type` call.

@bors bors closed this in #40863 Apr 6, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.