Skip to content

Commit 3dd5849

Browse files
authored
Rollup merge of rust-lang#76754 - varkor:diagnostic-cleanup-ii, r=ecstatic-morse
Clean up diagnostics for arithmetic operation errors Plus a small tweak to a range pattern error message.
2 parents 63bc0c4 + e2e000a commit 3dd5849

File tree

115 files changed

+426
-421
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+426
-421
lines changed

compiler/rustc_middle/src/mir/mod.rs

+30-26
Original file line numberDiff line numberDiff line change
@@ -1280,49 +1280,49 @@ impl<O> AssertKind<O> {
12801280
match self {
12811281
BoundsCheck { ref len, ref index } => write!(
12821282
f,
1283-
"\"index out of bounds: the len is {{}} but the index is {{}}\", {:?}, {:?}",
1283+
"\"index out of bounds: the length is {{}} but the index is {{}}\", {:?}, {:?}",
12841284
len, index
12851285
),
12861286

12871287
OverflowNeg(op) => {
1288-
write!(f, "\"attempt to negate {{}} which would overflow\", {:?}", op)
1288+
write!(f, "\"attempt to negate `{{}}`, which would overflow\", {:?}", op)
12891289
}
1290-
DivisionByZero(op) => write!(f, "\"attempt to divide {{}} by zero\", {:?}", op),
1290+
DivisionByZero(op) => write!(f, "\"attempt to divide `{{}}` by zero\", {:?}", op),
12911291
RemainderByZero(op) => write!(
12921292
f,
1293-
"\"attempt to calculate the remainder of {{}} with a divisor of zero\", {:?}",
1293+
"\"attempt to calculate the remainder of `{{}}` with a divisor of zero\", {:?}",
12941294
op
12951295
),
12961296
Overflow(BinOp::Add, l, r) => write!(
12971297
f,
1298-
"\"attempt to compute `{{}} + {{}}` which would overflow\", {:?}, {:?}",
1298+
"\"attempt to compute `{{}} + {{}}`, which would overflow\", {:?}, {:?}",
12991299
l, r
13001300
),
13011301
Overflow(BinOp::Sub, l, r) => write!(
13021302
f,
1303-
"\"attempt to compute `{{}} - {{}}` which would overflow\", {:?}, {:?}",
1303+
"\"attempt to compute `{{}} - {{}}`, which would overflow\", {:?}, {:?}",
13041304
l, r
13051305
),
13061306
Overflow(BinOp::Mul, l, r) => write!(
13071307
f,
1308-
"\"attempt to compute `{{}} * {{}}` which would overflow\", {:?}, {:?}",
1308+
"\"attempt to compute `{{}} * {{}}`, which would overflow\", {:?}, {:?}",
13091309
l, r
13101310
),
13111311
Overflow(BinOp::Div, l, r) => write!(
13121312
f,
1313-
"\"attempt to compute `{{}} / {{}}` which would overflow\", {:?}, {:?}",
1313+
"\"attempt to compute `{{}} / {{}}`, which would overflow\", {:?}, {:?}",
13141314
l, r
13151315
),
13161316
Overflow(BinOp::Rem, l, r) => write!(
13171317
f,
1318-
"\"attempt to compute the remainder of `{{}} % {{}}` which would overflow\", {:?}, {:?}",
1318+
"\"attempt to compute the remainder of `{{}} % {{}}`, which would overflow\", {:?}, {:?}",
13191319
l, r
13201320
),
13211321
Overflow(BinOp::Shr, _, r) => {
1322-
write!(f, "\"attempt to shift right by {{}} which would overflow\", {:?}", r)
1322+
write!(f, "\"attempt to shift right by `{{}}`, which would overflow\", {:?}", r)
13231323
}
13241324
Overflow(BinOp::Shl, _, r) => {
1325-
write!(f, "\"attempt to shift left by {{}} which would overflow\", {:?}", r)
1325+
write!(f, "\"attempt to shift left by `{{}}`, which would overflow\", {:?}", r)
13261326
}
13271327
_ => write!(f, "\"{}\"", self.description()),
13281328
}
@@ -1333,36 +1333,40 @@ impl<O: fmt::Debug> fmt::Debug for AssertKind<O> {
13331333
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
13341334
use AssertKind::*;
13351335
match self {
1336-
BoundsCheck { ref len, ref index } => {
1337-
write!(f, "index out of bounds: the len is {:?} but the index is {:?}", len, index)
1338-
}
1339-
OverflowNeg(op) => write!(f, "attempt to negate {:#?} which would overflow", op),
1340-
DivisionByZero(op) => write!(f, "attempt to divide {:#?} by zero", op),
1341-
RemainderByZero(op) => {
1342-
write!(f, "attempt to calculate the remainder of {:#?} with a divisor of zero", op)
1343-
}
1336+
BoundsCheck { ref len, ref index } => write!(
1337+
f,
1338+
"index out of bounds: the length is {:?} but the index is {:?}",
1339+
len, index
1340+
),
1341+
OverflowNeg(op) => write!(f, "attempt to negate `{:#?}`, which would overflow", op),
1342+
DivisionByZero(op) => write!(f, "attempt to divide `{:#?}` by zero", op),
1343+
RemainderByZero(op) => write!(
1344+
f,
1345+
"attempt to calculate the remainder of `{:#?}` with a divisor of zero",
1346+
op
1347+
),
13441348
Overflow(BinOp::Add, l, r) => {
1345-
write!(f, "attempt to compute `{:#?} + {:#?}` which would overflow", l, r)
1349+
write!(f, "attempt to compute `{:#?} + {:#?}`, which would overflow", l, r)
13461350
}
13471351
Overflow(BinOp::Sub, l, r) => {
1348-
write!(f, "attempt to compute `{:#?} - {:#?}` which would overflow", l, r)
1352+
write!(f, "attempt to compute `{:#?} - {:#?}`, which would overflow", l, r)
13491353
}
13501354
Overflow(BinOp::Mul, l, r) => {
1351-
write!(f, "attempt to compute `{:#?} * {:#?}` which would overflow", l, r)
1355+
write!(f, "attempt to compute `{:#?} * {:#?}`, which would overflow", l, r)
13521356
}
13531357
Overflow(BinOp::Div, l, r) => {
1354-
write!(f, "attempt to compute `{:#?} / {:#?}` which would overflow", l, r)
1358+
write!(f, "attempt to compute `{:#?} / {:#?}`, which would overflow", l, r)
13551359
}
13561360
Overflow(BinOp::Rem, l, r) => write!(
13571361
f,
1358-
"attempt to compute the remainder of `{:#?} % {:#?}` which would overflow",
1362+
"attempt to compute the remainder of `{:#?} % {:#?}`, which would overflow",
13591363
l, r
13601364
),
13611365
Overflow(BinOp::Shr, _, r) => {
1362-
write!(f, "attempt to shift right by {:#?} which would overflow", r)
1366+
write!(f, "attempt to shift right by `{:#?}`, which would overflow", r)
13631367
}
13641368
Overflow(BinOp::Shl, _, r) => {
1365-
write!(f, "attempt to shift left by {:#?} which would overflow", r)
1369+
write!(f, "attempt to shift left by `{:#?}`, which would overflow", r)
13661370
}
13671371
_ => write!(f, "{}", self.description()),
13681372
}

compiler/rustc_typeck/src/check/pat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
495495
self.tcx.sess,
496496
span,
497497
E0029,
498-
"only char and numeric types are allowed in range patterns"
498+
"only `char` and numeric types are allowed in range patterns"
499499
);
500500
let msg = |ty| format!("this is of type `{}` but it should be `char` or numeric", ty);
501501
let mut one_side_err = |first_span, first_ty, second: Option<(bool, Ty<'tcx>, Span)>| {

src/test/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.32bit.mir

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn main() -> () {
4848
_7 = _2; // scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8
4949
_8 = Len(_1); // scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
5050
_9 = Lt(_7, _8); // scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
51-
assert(move _9, "index out of bounds: the len is {} but the index is {}", move _8, _7) -> bb2; // scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
51+
assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb2; // scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
5252
}
5353

5454
bb2: {

src/test/mir-opt/array_index_is_temporary.main.SimplifyCfg-elaborate-drops.after.64bit.mir

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn main() -> () {
4848
_7 = _2; // scope 3 at $DIR/array-index-is-temporary.rs:16:7: 16:8
4949
_8 = Len(_1); // scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
5050
_9 = Lt(_7, _8); // scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
51-
assert(move _9, "index out of bounds: the len is {} but the index is {}", move _8, _7) -> bb2; // scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
51+
assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb2; // scope 3 at $DIR/array-index-is-temporary.rs:16:5: 16:9
5252
}
5353

5454
bb2: {

src/test/mir-opt/combine_array_len.norm2.InstCombine.32bit.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
- _4 = Len(_1); // scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
3333
+ _4 = const 2_usize; // scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
3434
_5 = Lt(_3, _4); // scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
35-
assert(move _5, "index out of bounds: the len is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
35+
assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
3636
}
3737

3838
bb1: {
@@ -44,7 +44,7 @@
4444
- _8 = Len(_1); // scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
4545
+ _8 = const 2_usize; // scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
4646
_9 = Lt(_7, _8); // scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
47-
assert(move _9, "index out of bounds: the len is {} but the index is {}", move _8, _7) -> bb2; // scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
47+
assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb2; // scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
4848
}
4949

5050
bb2: {

src/test/mir-opt/combine_array_len.norm2.InstCombine.64bit.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
- _4 = Len(_1); // scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
3333
+ _4 = const 2_usize; // scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
3434
_5 = Lt(_3, _4); // scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
35-
assert(move _5, "index out of bounds: the len is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
35+
assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/combine_array_len.rs:5:13: 5:17
3636
}
3737

3838
bb1: {
@@ -44,7 +44,7 @@
4444
- _8 = Len(_1); // scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
4545
+ _8 = const 2_usize; // scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
4646
_9 = Lt(_7, _8); // scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
47-
assert(move _9, "index out of bounds: the len is {} but the index is {}", move _8, _7) -> bb2; // scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
47+
assert(move _9, "index out of bounds: the length is {} but the index is {}", move _8, _7) -> bb2; // scope 1 at $DIR/combine_array_len.rs:6:13: 6:17
4848
}
4949

5050
bb2: {

src/test/mir-opt/const_prop/array_index.main.ConstProp.32bit.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
_3 = const 2_usize; // scope 0 at $DIR/array_index.rs:5:31: 5:32
2121
_4 = const 4_usize; // scope 0 at $DIR/array_index.rs:5:18: 5:33
2222
- _5 = Lt(_3, _4); // scope 0 at $DIR/array_index.rs:5:18: 5:33
23-
- assert(move _5, "index out of bounds: the len is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:5:18: 5:33
23+
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:5:18: 5:33
2424
+ _5 = const true; // scope 0 at $DIR/array_index.rs:5:18: 5:33
25-
+ assert(const true, "index out of bounds: the len is {} but the index is {}", const 4_usize, const 2_usize) -> bb1; // scope 0 at $DIR/array_index.rs:5:18: 5:33
25+
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> bb1; // scope 0 at $DIR/array_index.rs:5:18: 5:33
2626
}
2727

2828
bb1: {

src/test/mir-opt/const_prop/array_index.main.ConstProp.64bit.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
_3 = const 2_usize; // scope 0 at $DIR/array_index.rs:5:31: 5:32
2121
_4 = const 4_usize; // scope 0 at $DIR/array_index.rs:5:18: 5:33
2222
- _5 = Lt(_3, _4); // scope 0 at $DIR/array_index.rs:5:18: 5:33
23-
- assert(move _5, "index out of bounds: the len is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:5:18: 5:33
23+
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> bb1; // scope 0 at $DIR/array_index.rs:5:18: 5:33
2424
+ _5 = const true; // scope 0 at $DIR/array_index.rs:5:18: 5:33
25-
+ assert(const true, "index out of bounds: the len is {} but the index is {}", const 4_usize, const 2_usize) -> bb1; // scope 0 at $DIR/array_index.rs:5:18: 5:33
25+
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> bb1; // scope 0 at $DIR/array_index.rs:5:18: 5:33
2626
}
2727

2828
bb1: {

src/test/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.diff

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@
2424
StorageLive(_3); // scope 1 at $DIR/bad_op_div_by_zero.rs:5:18: 5:19
2525
- _3 = _1; // scope 1 at $DIR/bad_op_div_by_zero.rs:5:18: 5:19
2626
- _4 = Eq(_3, const 0_i32); // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
27-
- assert(!move _4, "attempt to divide {} by zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
27+
- assert(!move _4, "attempt to divide `{}` by zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
2828
+ _3 = const 0_i32; // scope 1 at $DIR/bad_op_div_by_zero.rs:5:18: 5:19
2929
+ _4 = const true; // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
30-
+ assert(!const true, "attempt to divide {} by zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
30+
+ assert(!const true, "attempt to divide `{}` by zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
3131
}
3232

3333
bb1: {
3434
- _5 = Eq(_3, const -1_i32); // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
3535
- _6 = Eq(const 1_i32, const i32::MIN); // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
3636
- _7 = BitAnd(move _5, move _6); // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
37-
- assert(!move _7, "attempt to compute `{} / {}` which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
37+
- assert(!move _7, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
3838
+ _5 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
3939
+ _6 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
4040
+ _7 = const false; // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
41-
+ assert(!const false, "attempt to compute `{} / {}` which would overflow", const 1_i32, const 0_i32) -> bb2; // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
41+
+ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, const 0_i32) -> bb2; // scope 1 at $DIR/bad_op_div_by_zero.rs:5:14: 5:19
4242
}
4343

4444
bb2: {

src/test/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.diff

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@
2424
StorageLive(_3); // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:18: 5:19
2525
- _3 = _1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:18: 5:19
2626
- _4 = Eq(_3, const 0_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
27-
- assert(!move _4, "attempt to calculate the remainder of {} with a divisor of zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
27+
- assert(!move _4, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
2828
+ _3 = const 0_i32; // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:18: 5:19
2929
+ _4 = const true; // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
30-
+ assert(!const true, "attempt to calculate the remainder of {} with a divisor of zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
30+
+ assert(!const true, "attempt to calculate the remainder of `{}` with a divisor of zero", const 1_i32) -> bb1; // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
3131
}
3232

3333
bb1: {
3434
- _5 = Eq(_3, const -1_i32); // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
3535
- _6 = Eq(const 1_i32, const i32::MIN); // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
3636
- _7 = BitAnd(move _5, move _6); // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
37-
- assert(!move _7, "attempt to compute the remainder of `{} % {}` which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
37+
- assert(!move _7, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
3838
+ _5 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
3939
+ _6 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
4040
+ _7 = const false; // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
41-
+ assert(!const false, "attempt to compute the remainder of `{} % {}` which would overflow", const 1_i32, const 0_i32) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
41+
+ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, const 0_i32) -> bb2; // scope 1 at $DIR/bad_op_mod_by_zero.rs:5:14: 5:19
4242
}
4343

4444
bb2: {

src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
_6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:23: 7:24
4343
_7 = Len((*_1)); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:18: 7:25
4444
- _8 = Lt(_6, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:18: 7:25
45-
- assert(move _8, "index out of bounds: the len is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:18: 7:25
45+
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:18: 7:25
4646
+ _8 = Lt(const 3_usize, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:18: 7:25
47-
+ assert(move _8, "index out of bounds: the len is {} but the index is {}", move _7, const 3_usize) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:18: 7:25
47+
+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:18: 7:25
4848
}
4949

5050
bb1: {

src/test/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@
4242
_6 = const 3_usize; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:23: 7:24
4343
_7 = Len((*_1)); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:18: 7:25
4444
- _8 = Lt(_6, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:18: 7:25
45-
- assert(move _8, "index out of bounds: the len is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:18: 7:25
45+
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:18: 7:25
4646
+ _8 = Lt(const 3_usize, _7); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:18: 7:25
47-
+ assert(move _8, "index out of bounds: the len is {} but the index is {}", move _7, const 3_usize) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:18: 7:25
47+
+ assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, const 3_usize) -> bb1; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:7:18: 7:25
4848
}
4949

5050
bb1: {

0 commit comments

Comments
 (0)