Skip to content

Commit 9505919

Browse files
authored
Rollup merge of rust-lang#5709 - ebroto:5389_ice, r=Manishearth
Fix ICE in consts::binop changelog: Fix ICE in `consts::binop` Fixes rust-lang#5389
2 parents 1f39eeb + b21ef2b commit 9505919

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

clippy_lints/src/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ impl<'c, 'cc> ConstEvalLateContext<'c, 'cc> {
396396
let l = self.expr(left)?;
397397
let r = self.expr(right);
398398
match (l, r) {
399-
(Constant::Int(l), Some(Constant::Int(r))) => match self.tables.expr_ty(left).kind {
399+
(Constant::Int(l), Some(Constant::Int(r))) => match self.tables.expr_ty_opt(left)?.kind {
400400
ty::Int(ity) => {
401401
let l = sext(self.lcx.tcx, l, ity);
402402
let r = sext(self.lcx.tcx, r, ity);

tests/ui/crashes/ice-5389.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#![allow(clippy::explicit_counter_loop)]
2+
3+
fn main() {
4+
let v = vec![1, 2, 3];
5+
let mut i = 0;
6+
let max_storage_size = [0; 128 * 1024];
7+
for item in &v {
8+
bar(i, *item);
9+
i += 1;
10+
}
11+
}
12+
13+
fn bar(_: usize, _: u32) {}

0 commit comments

Comments
 (0)