Skip to content

Commit

Permalink
Rollup merge of #5709 - ebroto:5389_ice, r=Manishearth
Browse files Browse the repository at this point in the history
Fix ICE in consts::binop

changelog: Fix ICE in `consts::binop`

Fixes #5389
  • Loading branch information
flip1995 authored Jun 23, 2020
2 parents 1f39eeb + b21ef2b commit 9505919
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion clippy_lints/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
let l = self.expr(left)?;
let r = self.expr(right);
match (l, r) {
(Constant::Int(l), Some(Constant::Int(r))) => match self.tables.expr_ty(left).kind {
(Constant::Int(l), Some(Constant::Int(r))) => match self.tables.expr_ty_opt(left)?.kind {
ty::Int(ity) => {
let l = sext(self.lcx.tcx, l, ity);
let r = sext(self.lcx.tcx, r, ity);
Expand Down
13 changes: 13 additions & 0 deletions tests/ui/crashes/ice-5389.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#![allow(clippy::explicit_counter_loop)]

fn main() {
let v = vec![1, 2, 3];
let mut i = 0;
let max_storage_size = [0; 128 * 1024];
for item in &v {
bar(i, *item);
i += 1;
}
}

fn bar(_: usize, _: u32) {}

0 comments on commit 9505919

Please sign in to comment.