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
Closed

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

eddyb opened this issue Mar 27, 2017 · 1 comment
Assignees
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@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.

@eddyb eddyb added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-stable Performance or correctness regression from one stable version to another. labels Mar 27, 2017
@eddyb eddyb self-assigned this Mar 27, 2017
@arielb1
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 Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 4, 2017
bors added a commit that referenced this issue Apr 6, 2017
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants