diff --git a/src/tools/tidy/src/issues.txt b/src/tools/tidy/src/issues.txt index 81437473b2d25..51af8898470b3 100644 --- a/src/tools/tidy/src/issues.txt +++ b/src/tools/tidy/src/issues.txt @@ -3225,7 +3225,6 @@ "ui/nll/user-annotations/issue-55748-pat-types-constrain-bindings.rs", "ui/nll/user-annotations/issue-57731-ascibed-coupled-types.rs", "ui/numbers-arithmetic/issue-105626.rs", -"ui/numbers-arithmetic/issue-8460-const.rs", "ui/numbers-arithmetic/issue-8460.rs", "ui/object-safety/issue-102762.rs", "ui/object-safety/issue-102933.rs", diff --git a/tests/ui/lint/lint-overflowing-ops.noopt.stderr b/tests/ui/lint/lint-overflowing-ops.noopt.stderr index 93fc19ce79e44..265868ccc6108 100644 --- a/tests/ui/lint/lint-overflowing-ops.noopt.stderr +++ b/tests/ui/lint/lint-overflowing-ops.noopt.stderr @@ -1,5 +1,5 @@ error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:26:14 + --> $DIR/lint-overflowing-ops.rs:28:14 | LL | let _n = 1u8 << 8; | ^^^^^^^^ attempt to shift left by `8_i32`, which would overflow @@ -11,427 +11,445 @@ LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:212:15 + --> $DIR/lint-overflowing-ops.rs:226:15 + | +LL | let _n = &(-i8::MIN); + | ^^^^^^^^^^ attempt to negate `i8::MIN`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:223:15 | LL | let _n = &(usize::MAX * 5); | ^^^^^^^^^^^^^^^^ attempt to compute `usize::MAX * 5_usize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:209:15 + --> $DIR/lint-overflowing-ops.rs:220:15 | LL | let _n = &(isize::MAX * 5); | ^^^^^^^^^^^^^^^^ attempt to compute `isize::MAX * 5_isize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:206:15 + --> $DIR/lint-overflowing-ops.rs:217:15 | LL | let _n = &(i128::MAX * 5); | ^^^^^^^^^^^^^^^ attempt to compute `i128::MAX * 5_i128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:203:15 + --> $DIR/lint-overflowing-ops.rs:214:15 | LL | let _n = &(i64::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `i64::MAX * 5_i64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:200:15 + --> $DIR/lint-overflowing-ops.rs:211:15 | LL | let _n = &(i32::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `i32::MAX * 5_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:197:15 + --> $DIR/lint-overflowing-ops.rs:208:15 | LL | let _n = &(i16::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `i16::MAX * 5_i16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:194:15 + --> $DIR/lint-overflowing-ops.rs:205:15 | LL | let _n = &(i8::MAX * i8::MAX); | ^^^^^^^^^^^^^^^^^^^ attempt to compute `i8::MAX * i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:191:15 + --> $DIR/lint-overflowing-ops.rs:202:15 | LL | let _n = &(u128::MAX * 5); | ^^^^^^^^^^^^^^^ attempt to compute `u128::MAX * 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:188:15 + --> $DIR/lint-overflowing-ops.rs:199:15 | LL | let _n = &(u64::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `u64::MAX * 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:185:15 + --> $DIR/lint-overflowing-ops.rs:196:15 | LL | let _n = &(u32::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `u32::MAX * 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:182:15 + --> $DIR/lint-overflowing-ops.rs:193:15 | LL | let _n = &(u16::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `u16::MAX * 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:179:15 + --> $DIR/lint-overflowing-ops.rs:190:15 | LL | let _n = &(u8::MAX * 5); | ^^^^^^^^^^^^^ attempt to compute `u8::MAX * 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:174:15 + --> $DIR/lint-overflowing-ops.rs:185:15 | LL | let _n = &(1usize - 5); | ^^^^^^^^^^^^ attempt to compute `1_usize - 5_usize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:171:15 + --> $DIR/lint-overflowing-ops.rs:182:15 | LL | let _n = &(-5isize - isize::MAX); | ^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `-5_isize - isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:168:15 + --> $DIR/lint-overflowing-ops.rs:179:15 | LL | let _n = &(-5i128 - i128::MAX); | ^^^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i128 - i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:165:15 + --> $DIR/lint-overflowing-ops.rs:176:15 | LL | let _n = &(-5i64 - i64::MAX); | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i64 - i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:162:15 + --> $DIR/lint-overflowing-ops.rs:173:15 | LL | let _n = &(-5i32 - i32::MAX); | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i32 - i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:159:15 + --> $DIR/lint-overflowing-ops.rs:170:15 | LL | let _n = &(-5i16 - i16::MAX); | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i16 - i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:156:15 + --> $DIR/lint-overflowing-ops.rs:167:15 | LL | let _n = &(-5i8 - i8::MAX); | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i8 - i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:153:15 + --> $DIR/lint-overflowing-ops.rs:164:15 | LL | let _n = &(1u128 - 5); | ^^^^^^^^^^^ attempt to compute `1_u128 - 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:150:15 + --> $DIR/lint-overflowing-ops.rs:161:15 | LL | let _n = &(1u64 - 5); | ^^^^^^^^^^ attempt to compute `1_u64 - 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:147:15 + --> $DIR/lint-overflowing-ops.rs:158:15 | LL | let _n = &(1u32 - 5); | ^^^^^^^^^^ attempt to compute `1_u32 - 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:144:15 + --> $DIR/lint-overflowing-ops.rs:155:15 | LL | let _n = &(1u16 - 5); | ^^^^^^^^^^ attempt to compute `1_u16 - 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:141:15 + --> $DIR/lint-overflowing-ops.rs:152:15 | LL | let _n = &(1u8 - 5); | ^^^^^^^^^ attempt to compute `1_u8 - 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:136:15 + --> $DIR/lint-overflowing-ops.rs:147:15 | LL | let _n = &(1usize + usize::MAX); | ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `1_usize + usize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:133:15 + --> $DIR/lint-overflowing-ops.rs:144:15 | LL | let _n = &(1isize + isize::MAX); | ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `1_isize + isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:130:15 + --> $DIR/lint-overflowing-ops.rs:141:15 | LL | let _n = &(1i128 + i128::MAX); | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_i128 + i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:127:15 + --> $DIR/lint-overflowing-ops.rs:138:15 | LL | let _n = &(1i64 + i64::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i64 + i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:124:15 + --> $DIR/lint-overflowing-ops.rs:135:15 | LL | let _n = &(1i32 + i32::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i32 + i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:121:15 + --> $DIR/lint-overflowing-ops.rs:132:15 | LL | let _n = &(1i16 + i16::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i16 + i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:118:15 + --> $DIR/lint-overflowing-ops.rs:129:15 | LL | let _n = &(1i8 + i8::MAX); | ^^^^^^^^^^^^^^^ attempt to compute `1_i8 + i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:115:15 + --> $DIR/lint-overflowing-ops.rs:126:15 | LL | let _n = &(1u128 + u128::MAX); | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_u128 + u128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:112:15 + --> $DIR/lint-overflowing-ops.rs:123:15 | LL | let _n = &(1u64 + u64::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u64 + u64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:109:15 + --> $DIR/lint-overflowing-ops.rs:120:15 | LL | let _n = &(1u32 + u32::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u32 + u32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:106:15 + --> $DIR/lint-overflowing-ops.rs:117:15 | LL | let _n = &(1u16 + u16::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u16 + u16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:103:15 + --> $DIR/lint-overflowing-ops.rs:114:15 | LL | let _n = &(1u8 + u8::MAX); | ^^^^^^^^^^^^^^^ attempt to compute `1_u8 + u8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:98:15 + --> $DIR/lint-overflowing-ops.rs:110:15 + | +LL | let _n = &(1i64 >> [64][0]); + | ^^^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:107:15 | LL | let _n = &(1_usize >> BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:95:15 + --> $DIR/lint-overflowing-ops.rs:104:15 | LL | let _n = &(1_isize >> BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:92:15 + --> $DIR/lint-overflowing-ops.rs:101:15 | LL | let _n = &(1i128 >> 128); | ^^^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:89:15 + --> $DIR/lint-overflowing-ops.rs:98:15 | LL | let _n = &(1i64 >> 64); | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:86:15 + --> $DIR/lint-overflowing-ops.rs:95:15 | LL | let _n = &(1i32 >> 32); | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:83:15 + --> $DIR/lint-overflowing-ops.rs:92:15 | LL | let _n = &(1i16 >> 16); | ^^^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:80:15 + --> $DIR/lint-overflowing-ops.rs:89:15 | LL | let _n = &(1i8 >> 8); | ^^^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:77:15 + --> $DIR/lint-overflowing-ops.rs:86:15 | LL | let _n = &(1u128 >> 128); | ^^^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:74:15 + --> $DIR/lint-overflowing-ops.rs:83:15 | LL | let _n = &(1u64 >> 64); | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:71:15 + --> $DIR/lint-overflowing-ops.rs:80:15 | LL | let _n = &(1u32 >> 32); | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:68:15 + --> $DIR/lint-overflowing-ops.rs:77:15 | LL | let _n = &(1u16 >> 16); | ^^^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:65:15 + --> $DIR/lint-overflowing-ops.rs:74:15 | LL | let _n = &(1u8 >> 8); | ^^^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:60:15 + --> $DIR/lint-overflowing-ops.rs:65:15 + | +LL | let _n = &(1 << -1); + | ^^^^^^^^^ attempt to shift left by `-1_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:62:15 | LL | let _n = &(1_usize << BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:57:15 + --> $DIR/lint-overflowing-ops.rs:59:15 | LL | let _n = &(1_isize << BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:54:15 + --> $DIR/lint-overflowing-ops.rs:56:15 | LL | let _n = &(1i128 << 128); | ^^^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:51:15 + --> $DIR/lint-overflowing-ops.rs:53:15 | LL | let _n = &(1i64 << 64); | ^^^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:48:15 + --> $DIR/lint-overflowing-ops.rs:50:15 | LL | let _n = &(1i32 << 32); | ^^^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:45:15 + --> $DIR/lint-overflowing-ops.rs:47:15 | LL | let _n = &(1i16 << 16); | ^^^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:42:15 + --> $DIR/lint-overflowing-ops.rs:44:15 | LL | let _n = &(1i8 << 8); | ^^^^^^^^^^ attempt to shift left by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:39:15 + --> $DIR/lint-overflowing-ops.rs:41:15 | LL | let _n = &(1u128 << 128); | ^^^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:36:15 + --> $DIR/lint-overflowing-ops.rs:38:15 | LL | let _n = &(1u64 << 64); | ^^^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:33:15 + --> $DIR/lint-overflowing-ops.rs:35:15 | LL | let _n = &(1u32 << 32); | ^^^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:30:15 + --> $DIR/lint-overflowing-ops.rs:32:15 | LL | let _n = &(1u16 << 16); | ^^^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:27:15 + --> $DIR/lint-overflowing-ops.rs:29:15 | LL | let _n = &(1u8 << 8); | ^^^^^^^^^^ attempt to shift left by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:29:14 + --> $DIR/lint-overflowing-ops.rs:31:14 | LL | let _n = 1u16 << 16; | ^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:32:14 + --> $DIR/lint-overflowing-ops.rs:34:14 | LL | let _n = 1u32 << 32; | ^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:35:14 + --> $DIR/lint-overflowing-ops.rs:37:14 | LL | let _n = 1u64 << 64; | ^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:38:14 + --> $DIR/lint-overflowing-ops.rs:40:14 | LL | let _n = 1u128 << 128; | ^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:41:14 + --> $DIR/lint-overflowing-ops.rs:43:14 | LL | let _n = 1i8 << 8; | ^^^^^^^^ attempt to shift left by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:44:14 + --> $DIR/lint-overflowing-ops.rs:46:14 | LL | let _n = 1i16 << 16; | ^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:47:14 + --> $DIR/lint-overflowing-ops.rs:49:14 | LL | let _n = 1i32 << 32; | ^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:50:14 + --> $DIR/lint-overflowing-ops.rs:52:14 | LL | let _n = 1i64 << 64; | ^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:53:14 + --> $DIR/lint-overflowing-ops.rs:55:14 | LL | let _n = 1i128 << 128; | ^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:56:14 + --> $DIR/lint-overflowing-ops.rs:58:14 | LL | let _n = 1_isize << BITS; | ^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:59:14 + --> $DIR/lint-overflowing-ops.rs:61:14 | LL | let _n = 1_usize << BITS; | ^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow @@ -439,293 +457,329 @@ LL | let _n = 1_usize << BITS; error: this arithmetic operation will overflow --> $DIR/lint-overflowing-ops.rs:64:14 | +LL | let _n = 1 << -1; + | ^^^^^^^ attempt to shift left by `-1_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:69:14 + | +LL | let _n = -1_i64 >> 64; + | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:70:14 + | +LL | let _n = -1_i32 >> 32; + | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:71:14 + | +LL | let _n = -1_i32 >> -1; + | ^^^^^^^^^^^^ attempt to shift right by `-1_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:73:14 + | LL | let _n = 1u8 >> 8; | ^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:67:14 + --> $DIR/lint-overflowing-ops.rs:76:14 | LL | let _n = 1u16 >> 16; | ^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:70:14 + --> $DIR/lint-overflowing-ops.rs:79:14 | LL | let _n = 1u32 >> 32; | ^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:73:14 + --> $DIR/lint-overflowing-ops.rs:82:14 | LL | let _n = 1u64 >> 64; | ^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:76:14 + --> $DIR/lint-overflowing-ops.rs:85:14 | LL | let _n = 1u128 >> 128; | ^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:79:14 + --> $DIR/lint-overflowing-ops.rs:88:14 | LL | let _n = 1i8 >> 8; | ^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:82:14 + --> $DIR/lint-overflowing-ops.rs:91:14 | LL | let _n = 1i16 >> 16; | ^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:85:14 + --> $DIR/lint-overflowing-ops.rs:94:14 | LL | let _n = 1i32 >> 32; | ^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:88:14 + --> $DIR/lint-overflowing-ops.rs:97:14 | LL | let _n = 1i64 >> 64; | ^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:91:14 + --> $DIR/lint-overflowing-ops.rs:100:14 | LL | let _n = 1i128 >> 128; | ^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:94:14 + --> $DIR/lint-overflowing-ops.rs:103:14 | LL | let _n = 1_isize >> BITS; | ^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:97:14 + --> $DIR/lint-overflowing-ops.rs:106:14 | LL | let _n = 1_usize >> BITS; | ^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:102:14 + --> $DIR/lint-overflowing-ops.rs:109:14 + | +LL | let _n = 1i64 >> [64][0]; + | ^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:113:14 | LL | let _n = 1u8 + u8::MAX; | ^^^^^^^^^^^^^ attempt to compute `1_u8 + u8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:105:14 + --> $DIR/lint-overflowing-ops.rs:116:14 | LL | let _n = 1u16 + u16::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_u16 + u16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:108:14 + --> $DIR/lint-overflowing-ops.rs:119:14 | LL | let _n = 1u32 + u32::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_u32 + u32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:111:14 + --> $DIR/lint-overflowing-ops.rs:122:14 | LL | let _n = 1u64 + u64::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_u64 + u64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:114:14 + --> $DIR/lint-overflowing-ops.rs:125:14 | LL | let _n = 1u128 + u128::MAX; | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u128 + u128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:117:14 + --> $DIR/lint-overflowing-ops.rs:128:14 | LL | let _n = 1i8 + i8::MAX; | ^^^^^^^^^^^^^ attempt to compute `1_i8 + i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:120:14 + --> $DIR/lint-overflowing-ops.rs:131:14 | LL | let _n = 1i16 + i16::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_i16 + i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:123:14 + --> $DIR/lint-overflowing-ops.rs:134:14 | LL | let _n = 1i32 + i32::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_i32 + i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:126:14 + --> $DIR/lint-overflowing-ops.rs:137:14 | LL | let _n = 1i64 + i64::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_i64 + i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:129:14 + --> $DIR/lint-overflowing-ops.rs:140:14 | LL | let _n = 1i128 + i128::MAX; | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i128 + i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:132:14 + --> $DIR/lint-overflowing-ops.rs:143:14 | LL | let _n = 1isize + isize::MAX; | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_isize + isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:135:14 + --> $DIR/lint-overflowing-ops.rs:146:14 | LL | let _n = 1usize + usize::MAX; | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_usize + usize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:140:14 + --> $DIR/lint-overflowing-ops.rs:151:14 | LL | let _n = 1u8 - 5; | ^^^^^^^ attempt to compute `1_u8 - 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:143:14 + --> $DIR/lint-overflowing-ops.rs:154:14 | LL | let _n = 1u16 - 5; | ^^^^^^^^ attempt to compute `1_u16 - 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:146:14 + --> $DIR/lint-overflowing-ops.rs:157:14 | LL | let _n = 1u32 - 5; | ^^^^^^^^ attempt to compute `1_u32 - 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:149:14 + --> $DIR/lint-overflowing-ops.rs:160:14 | LL | let _n = 1u64 - 5 ; | ^^^^^^^^ attempt to compute `1_u64 - 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:152:14 + --> $DIR/lint-overflowing-ops.rs:163:14 | LL | let _n = 1u128 - 5 ; | ^^^^^^^^^ attempt to compute `1_u128 - 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:155:14 + --> $DIR/lint-overflowing-ops.rs:166:14 | LL | let _n = -5i8 - i8::MAX; | ^^^^^^^^^^^^^^ attempt to compute `-5_i8 - i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:158:14 + --> $DIR/lint-overflowing-ops.rs:169:14 | LL | let _n = -5i16 - i16::MAX; | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i16 - i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:161:14 + --> $DIR/lint-overflowing-ops.rs:172:14 | LL | let _n = -5i32 - i32::MAX; | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i32 - i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:164:14 + --> $DIR/lint-overflowing-ops.rs:175:14 | LL | let _n = -5i64 - i64::MAX; | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i64 - i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:167:14 + --> $DIR/lint-overflowing-ops.rs:178:14 | LL | let _n = -5i128 - i128::MAX; | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i128 - i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:170:14 + --> $DIR/lint-overflowing-ops.rs:181:14 | LL | let _n = -5isize - isize::MAX; | ^^^^^^^^^^^^^^^^^^^^ attempt to compute `-5_isize - isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:173:14 + --> $DIR/lint-overflowing-ops.rs:184:14 | LL | let _n = 1usize - 5; | ^^^^^^^^^^ attempt to compute `1_usize - 5_usize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:178:14 + --> $DIR/lint-overflowing-ops.rs:189:14 | LL | let _n = u8::MAX * 5; | ^^^^^^^^^^^ attempt to compute `u8::MAX * 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:181:14 + --> $DIR/lint-overflowing-ops.rs:192:14 | LL | let _n = u16::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `u16::MAX * 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:184:14 + --> $DIR/lint-overflowing-ops.rs:195:14 | LL | let _n = u32::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `u32::MAX * 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:187:14 + --> $DIR/lint-overflowing-ops.rs:198:14 | LL | let _n = u64::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `u64::MAX * 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:190:14 + --> $DIR/lint-overflowing-ops.rs:201:14 | LL | let _n = u128::MAX * 5; | ^^^^^^^^^^^^^ attempt to compute `u128::MAX * 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:193:14 + --> $DIR/lint-overflowing-ops.rs:204:14 | LL | let _n = i8::MAX * i8::MAX; | ^^^^^^^^^^^^^^^^^ attempt to compute `i8::MAX * i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:196:14 + --> $DIR/lint-overflowing-ops.rs:207:14 | LL | let _n = i16::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `i16::MAX * 5_i16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:199:14 + --> $DIR/lint-overflowing-ops.rs:210:14 | LL | let _n = i32::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `i32::MAX * 5_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:202:14 + --> $DIR/lint-overflowing-ops.rs:213:14 | LL | let _n = i64::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `i64::MAX * 5_i64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:205:14 + --> $DIR/lint-overflowing-ops.rs:216:14 | LL | let _n = i128::MAX * 5; | ^^^^^^^^^^^^^ attempt to compute `i128::MAX * 5_i128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:208:14 + --> $DIR/lint-overflowing-ops.rs:219:14 | LL | let _n = isize::MAX * 5; | ^^^^^^^^^^^^^^ attempt to compute `isize::MAX * 5_isize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:211:14 + --> $DIR/lint-overflowing-ops.rs:222:14 | LL | let _n = usize::MAX * 5; | ^^^^^^^^^^^^^^ attempt to compute `usize::MAX * 5_usize`, which would overflow +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:225:14 + | +LL | let _n = -i8::MIN; + | ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow + error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:216:14 + --> $DIR/lint-overflowing-ops.rs:230:14 | LL | let _n = 1u8 / 0; | ^^^^^^^ attempt to divide `1_u8` by zero @@ -733,298 +787,442 @@ LL | let _n = 1u8 / 0; = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:217:15 + --> $DIR/lint-overflowing-ops.rs:231:15 | LL | let _n = &(1u8 / 0); | ^^^^^^^^^ attempt to divide `1_u8` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:219:14 + --> $DIR/lint-overflowing-ops.rs:233:14 | LL | let _n = 1u16 / 0; | ^^^^^^^^ attempt to divide `1_u16` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:220:15 + --> $DIR/lint-overflowing-ops.rs:234:15 | LL | let _n = &(1u16 / 0); | ^^^^^^^^^^ attempt to divide `1_u16` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:222:14 + --> $DIR/lint-overflowing-ops.rs:236:14 | LL | let _n = 1u32 / 0; | ^^^^^^^^ attempt to divide `1_u32` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:223:15 + --> $DIR/lint-overflowing-ops.rs:237:15 | LL | let _n = &(1u32 / 0); | ^^^^^^^^^^ attempt to divide `1_u32` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:225:14 + --> $DIR/lint-overflowing-ops.rs:239:14 | LL | let _n = 1u64 / 0; | ^^^^^^^^ attempt to divide `1_u64` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:226:15 + --> $DIR/lint-overflowing-ops.rs:240:15 | LL | let _n = &(1u64 / 0); | ^^^^^^^^^^ attempt to divide `1_u64` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:228:14 + --> $DIR/lint-overflowing-ops.rs:242:14 | LL | let _n = 1u128 / 0; | ^^^^^^^^^ attempt to divide `1_u128` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:229:15 + --> $DIR/lint-overflowing-ops.rs:243:15 | LL | let _n = &(1u128 / 0); | ^^^^^^^^^^^ attempt to divide `1_u128` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:231:14 + --> $DIR/lint-overflowing-ops.rs:245:14 | LL | let _n = 1i8 / 0; | ^^^^^^^ attempt to divide `1_i8` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:232:15 + --> $DIR/lint-overflowing-ops.rs:246:15 | LL | let _n = &(1i8 / 0); | ^^^^^^^^^ attempt to divide `1_i8` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:234:14 + --> $DIR/lint-overflowing-ops.rs:248:14 | LL | let _n = 1i16 / 0; | ^^^^^^^^ attempt to divide `1_i16` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:235:15 + --> $DIR/lint-overflowing-ops.rs:249:15 | LL | let _n = &(1i16 / 0); | ^^^^^^^^^^ attempt to divide `1_i16` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:237:14 + --> $DIR/lint-overflowing-ops.rs:251:14 | LL | let _n = 1i32 / 0; | ^^^^^^^^ attempt to divide `1_i32` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:238:15 + --> $DIR/lint-overflowing-ops.rs:252:15 | LL | let _n = &(1i32 / 0); | ^^^^^^^^^^ attempt to divide `1_i32` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:240:14 + --> $DIR/lint-overflowing-ops.rs:254:14 | LL | let _n = 1i64 / 0; | ^^^^^^^^ attempt to divide `1_i64` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:241:15 + --> $DIR/lint-overflowing-ops.rs:255:15 | LL | let _n = &(1i64 / 0); | ^^^^^^^^^^ attempt to divide `1_i64` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:243:14 + --> $DIR/lint-overflowing-ops.rs:257:14 | LL | let _n = 1i128 / 0; | ^^^^^^^^^ attempt to divide `1_i128` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:244:15 + --> $DIR/lint-overflowing-ops.rs:258:15 | LL | let _n = &(1i128 / 0); | ^^^^^^^^^^^ attempt to divide `1_i128` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:246:14 + --> $DIR/lint-overflowing-ops.rs:260:14 | LL | let _n = 1isize / 0; | ^^^^^^^^^^ attempt to divide `1_isize` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:247:15 + --> $DIR/lint-overflowing-ops.rs:261:15 | LL | let _n = &(1isize / 0); | ^^^^^^^^^^^^ attempt to divide `1_isize` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:249:14 + --> $DIR/lint-overflowing-ops.rs:263:14 | LL | let _n = 1usize / 0; | ^^^^^^^^^^ attempt to divide `1_usize` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:250:15 + --> $DIR/lint-overflowing-ops.rs:264:15 | LL | let _n = &(1usize / 0); | ^^^^^^^^^^^^ attempt to divide `1_usize` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:254:14 + --> $DIR/lint-overflowing-ops.rs:268:14 | LL | let _n = 1u8 % 0; | ^^^^^^^ attempt to calculate the remainder of `1_u8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:255:15 + --> $DIR/lint-overflowing-ops.rs:269:15 | LL | let _n = &(1u8 % 0); | ^^^^^^^^^ attempt to calculate the remainder of `1_u8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:257:14 + --> $DIR/lint-overflowing-ops.rs:271:14 | LL | let _n = 1u16 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_u16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:258:15 + --> $DIR/lint-overflowing-ops.rs:272:15 | LL | let _n = &(1u16 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_u16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:260:14 + --> $DIR/lint-overflowing-ops.rs:274:14 | LL | let _n = 1u32 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_u32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:261:15 + --> $DIR/lint-overflowing-ops.rs:275:15 | LL | let _n = &(1u32 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_u32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:263:14 + --> $DIR/lint-overflowing-ops.rs:277:14 | LL | let _n = 1u64 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_u64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:264:15 + --> $DIR/lint-overflowing-ops.rs:278:15 | LL | let _n = &(1u64 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_u64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:266:14 + --> $DIR/lint-overflowing-ops.rs:280:14 | LL | let _n = 1u128 % 0; | ^^^^^^^^^ attempt to calculate the remainder of `1_u128` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:267:15 + --> $DIR/lint-overflowing-ops.rs:281:15 | LL | let _n = &(1u128 % 0); | ^^^^^^^^^^^ attempt to calculate the remainder of `1_u128` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:269:14 + --> $DIR/lint-overflowing-ops.rs:283:14 | LL | let _n = 1i8 % 0; | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:270:15 + --> $DIR/lint-overflowing-ops.rs:284:15 | LL | let _n = &(1i8 % 0); | ^^^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:272:14 + --> $DIR/lint-overflowing-ops.rs:286:14 | LL | let _n = 1i16 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:273:15 + --> $DIR/lint-overflowing-ops.rs:287:15 | LL | let _n = &(1i16 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:275:14 + --> $DIR/lint-overflowing-ops.rs:289:14 | LL | let _n = 1i32 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:276:15 + --> $DIR/lint-overflowing-ops.rs:290:15 | LL | let _n = &(1i32 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:278:14 + --> $DIR/lint-overflowing-ops.rs:292:14 | LL | let _n = 1i64 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:279:15 + --> $DIR/lint-overflowing-ops.rs:293:15 | LL | let _n = &(1i64 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:281:14 + --> $DIR/lint-overflowing-ops.rs:295:14 | LL | let _n = 1i128 % 0; | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:282:15 + --> $DIR/lint-overflowing-ops.rs:296:15 | LL | let _n = &(1i128 % 0); | ^^^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:284:14 + --> $DIR/lint-overflowing-ops.rs:298:14 | LL | let _n = 1isize % 0; | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:285:15 + --> $DIR/lint-overflowing-ops.rs:299:15 | LL | let _n = &(1isize % 0); | ^^^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:287:14 + --> $DIR/lint-overflowing-ops.rs:301:14 | LL | let _n = 1usize % 0; | ^^^^^^^^^^ attempt to calculate the remainder of `1_usize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:288:15 + --> $DIR/lint-overflowing-ops.rs:302:15 | LL | let _n = &(1usize % 0); | ^^^^^^^^^^^^ attempt to calculate the remainder of `1_usize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:292:14 + --> $DIR/lint-overflowing-ops.rs:306:14 | LL | let _n = [1, 2, 3][4]; | ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4 error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:293:15 + --> $DIR/lint-overflowing-ops.rs:307:15 | LL | let _n = &([1, 2, 3][4]); | ^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4 -error: aborting due to 170 previous errors +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:311:36 + | +LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:313:36 + | +LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:315:36 + | +LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:317:36 + | +LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:319:36 + | +LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:321:36 + | +LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:323:36 + | +LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); + | ^^^^^^^^^^ attempt to divide `1_isize` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:325:36 + | +LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); + | ^^^^^^^ attempt to divide `1_i8` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:327:36 + | +LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); + | ^^^^^^^^ attempt to divide `1_i16` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:329:36 + | +LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); + | ^^^^^^^^ attempt to divide `1_i32` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:331:36 + | +LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); + | ^^^^^^^^ attempt to divide `1_i64` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:333:36 + | +LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); + | ^^^^^^^^^ attempt to divide `1_i128` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:335:36 + | +LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:337:36 + | +LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:339:36 + | +LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:341:36 + | +LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:343:36 + | +LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:345:36 + | +LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:347:36 + | +LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); + | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:349:36 + | +LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); + | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:351:36 + | +LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); + | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:353:36 + | +LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); + | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:355:36 + | +LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); + | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:357:36 + | +LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); + | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero + +error: aborting due to 203 previous errors diff --git a/tests/ui/lint/lint-overflowing-ops.opt.stderr b/tests/ui/lint/lint-overflowing-ops.opt.stderr index 93fc19ce79e44..265868ccc6108 100644 --- a/tests/ui/lint/lint-overflowing-ops.opt.stderr +++ b/tests/ui/lint/lint-overflowing-ops.opt.stderr @@ -1,5 +1,5 @@ error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:26:14 + --> $DIR/lint-overflowing-ops.rs:28:14 | LL | let _n = 1u8 << 8; | ^^^^^^^^ attempt to shift left by `8_i32`, which would overflow @@ -11,427 +11,445 @@ LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:212:15 + --> $DIR/lint-overflowing-ops.rs:226:15 + | +LL | let _n = &(-i8::MIN); + | ^^^^^^^^^^ attempt to negate `i8::MIN`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:223:15 | LL | let _n = &(usize::MAX * 5); | ^^^^^^^^^^^^^^^^ attempt to compute `usize::MAX * 5_usize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:209:15 + --> $DIR/lint-overflowing-ops.rs:220:15 | LL | let _n = &(isize::MAX * 5); | ^^^^^^^^^^^^^^^^ attempt to compute `isize::MAX * 5_isize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:206:15 + --> $DIR/lint-overflowing-ops.rs:217:15 | LL | let _n = &(i128::MAX * 5); | ^^^^^^^^^^^^^^^ attempt to compute `i128::MAX * 5_i128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:203:15 + --> $DIR/lint-overflowing-ops.rs:214:15 | LL | let _n = &(i64::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `i64::MAX * 5_i64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:200:15 + --> $DIR/lint-overflowing-ops.rs:211:15 | LL | let _n = &(i32::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `i32::MAX * 5_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:197:15 + --> $DIR/lint-overflowing-ops.rs:208:15 | LL | let _n = &(i16::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `i16::MAX * 5_i16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:194:15 + --> $DIR/lint-overflowing-ops.rs:205:15 | LL | let _n = &(i8::MAX * i8::MAX); | ^^^^^^^^^^^^^^^^^^^ attempt to compute `i8::MAX * i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:191:15 + --> $DIR/lint-overflowing-ops.rs:202:15 | LL | let _n = &(u128::MAX * 5); | ^^^^^^^^^^^^^^^ attempt to compute `u128::MAX * 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:188:15 + --> $DIR/lint-overflowing-ops.rs:199:15 | LL | let _n = &(u64::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `u64::MAX * 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:185:15 + --> $DIR/lint-overflowing-ops.rs:196:15 | LL | let _n = &(u32::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `u32::MAX * 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:182:15 + --> $DIR/lint-overflowing-ops.rs:193:15 | LL | let _n = &(u16::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `u16::MAX * 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:179:15 + --> $DIR/lint-overflowing-ops.rs:190:15 | LL | let _n = &(u8::MAX * 5); | ^^^^^^^^^^^^^ attempt to compute `u8::MAX * 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:174:15 + --> $DIR/lint-overflowing-ops.rs:185:15 | LL | let _n = &(1usize - 5); | ^^^^^^^^^^^^ attempt to compute `1_usize - 5_usize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:171:15 + --> $DIR/lint-overflowing-ops.rs:182:15 | LL | let _n = &(-5isize - isize::MAX); | ^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `-5_isize - isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:168:15 + --> $DIR/lint-overflowing-ops.rs:179:15 | LL | let _n = &(-5i128 - i128::MAX); | ^^^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i128 - i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:165:15 + --> $DIR/lint-overflowing-ops.rs:176:15 | LL | let _n = &(-5i64 - i64::MAX); | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i64 - i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:162:15 + --> $DIR/lint-overflowing-ops.rs:173:15 | LL | let _n = &(-5i32 - i32::MAX); | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i32 - i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:159:15 + --> $DIR/lint-overflowing-ops.rs:170:15 | LL | let _n = &(-5i16 - i16::MAX); | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i16 - i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:156:15 + --> $DIR/lint-overflowing-ops.rs:167:15 | LL | let _n = &(-5i8 - i8::MAX); | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i8 - i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:153:15 + --> $DIR/lint-overflowing-ops.rs:164:15 | LL | let _n = &(1u128 - 5); | ^^^^^^^^^^^ attempt to compute `1_u128 - 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:150:15 + --> $DIR/lint-overflowing-ops.rs:161:15 | LL | let _n = &(1u64 - 5); | ^^^^^^^^^^ attempt to compute `1_u64 - 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:147:15 + --> $DIR/lint-overflowing-ops.rs:158:15 | LL | let _n = &(1u32 - 5); | ^^^^^^^^^^ attempt to compute `1_u32 - 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:144:15 + --> $DIR/lint-overflowing-ops.rs:155:15 | LL | let _n = &(1u16 - 5); | ^^^^^^^^^^ attempt to compute `1_u16 - 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:141:15 + --> $DIR/lint-overflowing-ops.rs:152:15 | LL | let _n = &(1u8 - 5); | ^^^^^^^^^ attempt to compute `1_u8 - 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:136:15 + --> $DIR/lint-overflowing-ops.rs:147:15 | LL | let _n = &(1usize + usize::MAX); | ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `1_usize + usize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:133:15 + --> $DIR/lint-overflowing-ops.rs:144:15 | LL | let _n = &(1isize + isize::MAX); | ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `1_isize + isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:130:15 + --> $DIR/lint-overflowing-ops.rs:141:15 | LL | let _n = &(1i128 + i128::MAX); | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_i128 + i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:127:15 + --> $DIR/lint-overflowing-ops.rs:138:15 | LL | let _n = &(1i64 + i64::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i64 + i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:124:15 + --> $DIR/lint-overflowing-ops.rs:135:15 | LL | let _n = &(1i32 + i32::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i32 + i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:121:15 + --> $DIR/lint-overflowing-ops.rs:132:15 | LL | let _n = &(1i16 + i16::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i16 + i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:118:15 + --> $DIR/lint-overflowing-ops.rs:129:15 | LL | let _n = &(1i8 + i8::MAX); | ^^^^^^^^^^^^^^^ attempt to compute `1_i8 + i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:115:15 + --> $DIR/lint-overflowing-ops.rs:126:15 | LL | let _n = &(1u128 + u128::MAX); | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_u128 + u128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:112:15 + --> $DIR/lint-overflowing-ops.rs:123:15 | LL | let _n = &(1u64 + u64::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u64 + u64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:109:15 + --> $DIR/lint-overflowing-ops.rs:120:15 | LL | let _n = &(1u32 + u32::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u32 + u32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:106:15 + --> $DIR/lint-overflowing-ops.rs:117:15 | LL | let _n = &(1u16 + u16::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u16 + u16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:103:15 + --> $DIR/lint-overflowing-ops.rs:114:15 | LL | let _n = &(1u8 + u8::MAX); | ^^^^^^^^^^^^^^^ attempt to compute `1_u8 + u8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:98:15 + --> $DIR/lint-overflowing-ops.rs:110:15 + | +LL | let _n = &(1i64 >> [64][0]); + | ^^^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:107:15 | LL | let _n = &(1_usize >> BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:95:15 + --> $DIR/lint-overflowing-ops.rs:104:15 | LL | let _n = &(1_isize >> BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:92:15 + --> $DIR/lint-overflowing-ops.rs:101:15 | LL | let _n = &(1i128 >> 128); | ^^^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:89:15 + --> $DIR/lint-overflowing-ops.rs:98:15 | LL | let _n = &(1i64 >> 64); | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:86:15 + --> $DIR/lint-overflowing-ops.rs:95:15 | LL | let _n = &(1i32 >> 32); | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:83:15 + --> $DIR/lint-overflowing-ops.rs:92:15 | LL | let _n = &(1i16 >> 16); | ^^^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:80:15 + --> $DIR/lint-overflowing-ops.rs:89:15 | LL | let _n = &(1i8 >> 8); | ^^^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:77:15 + --> $DIR/lint-overflowing-ops.rs:86:15 | LL | let _n = &(1u128 >> 128); | ^^^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:74:15 + --> $DIR/lint-overflowing-ops.rs:83:15 | LL | let _n = &(1u64 >> 64); | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:71:15 + --> $DIR/lint-overflowing-ops.rs:80:15 | LL | let _n = &(1u32 >> 32); | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:68:15 + --> $DIR/lint-overflowing-ops.rs:77:15 | LL | let _n = &(1u16 >> 16); | ^^^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:65:15 + --> $DIR/lint-overflowing-ops.rs:74:15 | LL | let _n = &(1u8 >> 8); | ^^^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:60:15 + --> $DIR/lint-overflowing-ops.rs:65:15 + | +LL | let _n = &(1 << -1); + | ^^^^^^^^^ attempt to shift left by `-1_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:62:15 | LL | let _n = &(1_usize << BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:57:15 + --> $DIR/lint-overflowing-ops.rs:59:15 | LL | let _n = &(1_isize << BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:54:15 + --> $DIR/lint-overflowing-ops.rs:56:15 | LL | let _n = &(1i128 << 128); | ^^^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:51:15 + --> $DIR/lint-overflowing-ops.rs:53:15 | LL | let _n = &(1i64 << 64); | ^^^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:48:15 + --> $DIR/lint-overflowing-ops.rs:50:15 | LL | let _n = &(1i32 << 32); | ^^^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:45:15 + --> $DIR/lint-overflowing-ops.rs:47:15 | LL | let _n = &(1i16 << 16); | ^^^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:42:15 + --> $DIR/lint-overflowing-ops.rs:44:15 | LL | let _n = &(1i8 << 8); | ^^^^^^^^^^ attempt to shift left by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:39:15 + --> $DIR/lint-overflowing-ops.rs:41:15 | LL | let _n = &(1u128 << 128); | ^^^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:36:15 + --> $DIR/lint-overflowing-ops.rs:38:15 | LL | let _n = &(1u64 << 64); | ^^^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:33:15 + --> $DIR/lint-overflowing-ops.rs:35:15 | LL | let _n = &(1u32 << 32); | ^^^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:30:15 + --> $DIR/lint-overflowing-ops.rs:32:15 | LL | let _n = &(1u16 << 16); | ^^^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:27:15 + --> $DIR/lint-overflowing-ops.rs:29:15 | LL | let _n = &(1u8 << 8); | ^^^^^^^^^^ attempt to shift left by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:29:14 + --> $DIR/lint-overflowing-ops.rs:31:14 | LL | let _n = 1u16 << 16; | ^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:32:14 + --> $DIR/lint-overflowing-ops.rs:34:14 | LL | let _n = 1u32 << 32; | ^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:35:14 + --> $DIR/lint-overflowing-ops.rs:37:14 | LL | let _n = 1u64 << 64; | ^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:38:14 + --> $DIR/lint-overflowing-ops.rs:40:14 | LL | let _n = 1u128 << 128; | ^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:41:14 + --> $DIR/lint-overflowing-ops.rs:43:14 | LL | let _n = 1i8 << 8; | ^^^^^^^^ attempt to shift left by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:44:14 + --> $DIR/lint-overflowing-ops.rs:46:14 | LL | let _n = 1i16 << 16; | ^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:47:14 + --> $DIR/lint-overflowing-ops.rs:49:14 | LL | let _n = 1i32 << 32; | ^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:50:14 + --> $DIR/lint-overflowing-ops.rs:52:14 | LL | let _n = 1i64 << 64; | ^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:53:14 + --> $DIR/lint-overflowing-ops.rs:55:14 | LL | let _n = 1i128 << 128; | ^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:56:14 + --> $DIR/lint-overflowing-ops.rs:58:14 | LL | let _n = 1_isize << BITS; | ^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:59:14 + --> $DIR/lint-overflowing-ops.rs:61:14 | LL | let _n = 1_usize << BITS; | ^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow @@ -439,293 +457,329 @@ LL | let _n = 1_usize << BITS; error: this arithmetic operation will overflow --> $DIR/lint-overflowing-ops.rs:64:14 | +LL | let _n = 1 << -1; + | ^^^^^^^ attempt to shift left by `-1_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:69:14 + | +LL | let _n = -1_i64 >> 64; + | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:70:14 + | +LL | let _n = -1_i32 >> 32; + | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:71:14 + | +LL | let _n = -1_i32 >> -1; + | ^^^^^^^^^^^^ attempt to shift right by `-1_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:73:14 + | LL | let _n = 1u8 >> 8; | ^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:67:14 + --> $DIR/lint-overflowing-ops.rs:76:14 | LL | let _n = 1u16 >> 16; | ^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:70:14 + --> $DIR/lint-overflowing-ops.rs:79:14 | LL | let _n = 1u32 >> 32; | ^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:73:14 + --> $DIR/lint-overflowing-ops.rs:82:14 | LL | let _n = 1u64 >> 64; | ^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:76:14 + --> $DIR/lint-overflowing-ops.rs:85:14 | LL | let _n = 1u128 >> 128; | ^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:79:14 + --> $DIR/lint-overflowing-ops.rs:88:14 | LL | let _n = 1i8 >> 8; | ^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:82:14 + --> $DIR/lint-overflowing-ops.rs:91:14 | LL | let _n = 1i16 >> 16; | ^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:85:14 + --> $DIR/lint-overflowing-ops.rs:94:14 | LL | let _n = 1i32 >> 32; | ^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:88:14 + --> $DIR/lint-overflowing-ops.rs:97:14 | LL | let _n = 1i64 >> 64; | ^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:91:14 + --> $DIR/lint-overflowing-ops.rs:100:14 | LL | let _n = 1i128 >> 128; | ^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:94:14 + --> $DIR/lint-overflowing-ops.rs:103:14 | LL | let _n = 1_isize >> BITS; | ^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:97:14 + --> $DIR/lint-overflowing-ops.rs:106:14 | LL | let _n = 1_usize >> BITS; | ^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:102:14 + --> $DIR/lint-overflowing-ops.rs:109:14 + | +LL | let _n = 1i64 >> [64][0]; + | ^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:113:14 | LL | let _n = 1u8 + u8::MAX; | ^^^^^^^^^^^^^ attempt to compute `1_u8 + u8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:105:14 + --> $DIR/lint-overflowing-ops.rs:116:14 | LL | let _n = 1u16 + u16::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_u16 + u16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:108:14 + --> $DIR/lint-overflowing-ops.rs:119:14 | LL | let _n = 1u32 + u32::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_u32 + u32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:111:14 + --> $DIR/lint-overflowing-ops.rs:122:14 | LL | let _n = 1u64 + u64::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_u64 + u64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:114:14 + --> $DIR/lint-overflowing-ops.rs:125:14 | LL | let _n = 1u128 + u128::MAX; | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u128 + u128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:117:14 + --> $DIR/lint-overflowing-ops.rs:128:14 | LL | let _n = 1i8 + i8::MAX; | ^^^^^^^^^^^^^ attempt to compute `1_i8 + i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:120:14 + --> $DIR/lint-overflowing-ops.rs:131:14 | LL | let _n = 1i16 + i16::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_i16 + i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:123:14 + --> $DIR/lint-overflowing-ops.rs:134:14 | LL | let _n = 1i32 + i32::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_i32 + i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:126:14 + --> $DIR/lint-overflowing-ops.rs:137:14 | LL | let _n = 1i64 + i64::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_i64 + i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:129:14 + --> $DIR/lint-overflowing-ops.rs:140:14 | LL | let _n = 1i128 + i128::MAX; | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i128 + i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:132:14 + --> $DIR/lint-overflowing-ops.rs:143:14 | LL | let _n = 1isize + isize::MAX; | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_isize + isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:135:14 + --> $DIR/lint-overflowing-ops.rs:146:14 | LL | let _n = 1usize + usize::MAX; | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_usize + usize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:140:14 + --> $DIR/lint-overflowing-ops.rs:151:14 | LL | let _n = 1u8 - 5; | ^^^^^^^ attempt to compute `1_u8 - 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:143:14 + --> $DIR/lint-overflowing-ops.rs:154:14 | LL | let _n = 1u16 - 5; | ^^^^^^^^ attempt to compute `1_u16 - 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:146:14 + --> $DIR/lint-overflowing-ops.rs:157:14 | LL | let _n = 1u32 - 5; | ^^^^^^^^ attempt to compute `1_u32 - 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:149:14 + --> $DIR/lint-overflowing-ops.rs:160:14 | LL | let _n = 1u64 - 5 ; | ^^^^^^^^ attempt to compute `1_u64 - 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:152:14 + --> $DIR/lint-overflowing-ops.rs:163:14 | LL | let _n = 1u128 - 5 ; | ^^^^^^^^^ attempt to compute `1_u128 - 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:155:14 + --> $DIR/lint-overflowing-ops.rs:166:14 | LL | let _n = -5i8 - i8::MAX; | ^^^^^^^^^^^^^^ attempt to compute `-5_i8 - i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:158:14 + --> $DIR/lint-overflowing-ops.rs:169:14 | LL | let _n = -5i16 - i16::MAX; | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i16 - i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:161:14 + --> $DIR/lint-overflowing-ops.rs:172:14 | LL | let _n = -5i32 - i32::MAX; | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i32 - i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:164:14 + --> $DIR/lint-overflowing-ops.rs:175:14 | LL | let _n = -5i64 - i64::MAX; | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i64 - i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:167:14 + --> $DIR/lint-overflowing-ops.rs:178:14 | LL | let _n = -5i128 - i128::MAX; | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i128 - i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:170:14 + --> $DIR/lint-overflowing-ops.rs:181:14 | LL | let _n = -5isize - isize::MAX; | ^^^^^^^^^^^^^^^^^^^^ attempt to compute `-5_isize - isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:173:14 + --> $DIR/lint-overflowing-ops.rs:184:14 | LL | let _n = 1usize - 5; | ^^^^^^^^^^ attempt to compute `1_usize - 5_usize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:178:14 + --> $DIR/lint-overflowing-ops.rs:189:14 | LL | let _n = u8::MAX * 5; | ^^^^^^^^^^^ attempt to compute `u8::MAX * 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:181:14 + --> $DIR/lint-overflowing-ops.rs:192:14 | LL | let _n = u16::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `u16::MAX * 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:184:14 + --> $DIR/lint-overflowing-ops.rs:195:14 | LL | let _n = u32::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `u32::MAX * 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:187:14 + --> $DIR/lint-overflowing-ops.rs:198:14 | LL | let _n = u64::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `u64::MAX * 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:190:14 + --> $DIR/lint-overflowing-ops.rs:201:14 | LL | let _n = u128::MAX * 5; | ^^^^^^^^^^^^^ attempt to compute `u128::MAX * 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:193:14 + --> $DIR/lint-overflowing-ops.rs:204:14 | LL | let _n = i8::MAX * i8::MAX; | ^^^^^^^^^^^^^^^^^ attempt to compute `i8::MAX * i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:196:14 + --> $DIR/lint-overflowing-ops.rs:207:14 | LL | let _n = i16::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `i16::MAX * 5_i16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:199:14 + --> $DIR/lint-overflowing-ops.rs:210:14 | LL | let _n = i32::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `i32::MAX * 5_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:202:14 + --> $DIR/lint-overflowing-ops.rs:213:14 | LL | let _n = i64::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `i64::MAX * 5_i64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:205:14 + --> $DIR/lint-overflowing-ops.rs:216:14 | LL | let _n = i128::MAX * 5; | ^^^^^^^^^^^^^ attempt to compute `i128::MAX * 5_i128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:208:14 + --> $DIR/lint-overflowing-ops.rs:219:14 | LL | let _n = isize::MAX * 5; | ^^^^^^^^^^^^^^ attempt to compute `isize::MAX * 5_isize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:211:14 + --> $DIR/lint-overflowing-ops.rs:222:14 | LL | let _n = usize::MAX * 5; | ^^^^^^^^^^^^^^ attempt to compute `usize::MAX * 5_usize`, which would overflow +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:225:14 + | +LL | let _n = -i8::MIN; + | ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow + error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:216:14 + --> $DIR/lint-overflowing-ops.rs:230:14 | LL | let _n = 1u8 / 0; | ^^^^^^^ attempt to divide `1_u8` by zero @@ -733,298 +787,442 @@ LL | let _n = 1u8 / 0; = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:217:15 + --> $DIR/lint-overflowing-ops.rs:231:15 | LL | let _n = &(1u8 / 0); | ^^^^^^^^^ attempt to divide `1_u8` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:219:14 + --> $DIR/lint-overflowing-ops.rs:233:14 | LL | let _n = 1u16 / 0; | ^^^^^^^^ attempt to divide `1_u16` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:220:15 + --> $DIR/lint-overflowing-ops.rs:234:15 | LL | let _n = &(1u16 / 0); | ^^^^^^^^^^ attempt to divide `1_u16` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:222:14 + --> $DIR/lint-overflowing-ops.rs:236:14 | LL | let _n = 1u32 / 0; | ^^^^^^^^ attempt to divide `1_u32` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:223:15 + --> $DIR/lint-overflowing-ops.rs:237:15 | LL | let _n = &(1u32 / 0); | ^^^^^^^^^^ attempt to divide `1_u32` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:225:14 + --> $DIR/lint-overflowing-ops.rs:239:14 | LL | let _n = 1u64 / 0; | ^^^^^^^^ attempt to divide `1_u64` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:226:15 + --> $DIR/lint-overflowing-ops.rs:240:15 | LL | let _n = &(1u64 / 0); | ^^^^^^^^^^ attempt to divide `1_u64` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:228:14 + --> $DIR/lint-overflowing-ops.rs:242:14 | LL | let _n = 1u128 / 0; | ^^^^^^^^^ attempt to divide `1_u128` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:229:15 + --> $DIR/lint-overflowing-ops.rs:243:15 | LL | let _n = &(1u128 / 0); | ^^^^^^^^^^^ attempt to divide `1_u128` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:231:14 + --> $DIR/lint-overflowing-ops.rs:245:14 | LL | let _n = 1i8 / 0; | ^^^^^^^ attempt to divide `1_i8` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:232:15 + --> $DIR/lint-overflowing-ops.rs:246:15 | LL | let _n = &(1i8 / 0); | ^^^^^^^^^ attempt to divide `1_i8` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:234:14 + --> $DIR/lint-overflowing-ops.rs:248:14 | LL | let _n = 1i16 / 0; | ^^^^^^^^ attempt to divide `1_i16` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:235:15 + --> $DIR/lint-overflowing-ops.rs:249:15 | LL | let _n = &(1i16 / 0); | ^^^^^^^^^^ attempt to divide `1_i16` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:237:14 + --> $DIR/lint-overflowing-ops.rs:251:14 | LL | let _n = 1i32 / 0; | ^^^^^^^^ attempt to divide `1_i32` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:238:15 + --> $DIR/lint-overflowing-ops.rs:252:15 | LL | let _n = &(1i32 / 0); | ^^^^^^^^^^ attempt to divide `1_i32` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:240:14 + --> $DIR/lint-overflowing-ops.rs:254:14 | LL | let _n = 1i64 / 0; | ^^^^^^^^ attempt to divide `1_i64` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:241:15 + --> $DIR/lint-overflowing-ops.rs:255:15 | LL | let _n = &(1i64 / 0); | ^^^^^^^^^^ attempt to divide `1_i64` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:243:14 + --> $DIR/lint-overflowing-ops.rs:257:14 | LL | let _n = 1i128 / 0; | ^^^^^^^^^ attempt to divide `1_i128` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:244:15 + --> $DIR/lint-overflowing-ops.rs:258:15 | LL | let _n = &(1i128 / 0); | ^^^^^^^^^^^ attempt to divide `1_i128` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:246:14 + --> $DIR/lint-overflowing-ops.rs:260:14 | LL | let _n = 1isize / 0; | ^^^^^^^^^^ attempt to divide `1_isize` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:247:15 + --> $DIR/lint-overflowing-ops.rs:261:15 | LL | let _n = &(1isize / 0); | ^^^^^^^^^^^^ attempt to divide `1_isize` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:249:14 + --> $DIR/lint-overflowing-ops.rs:263:14 | LL | let _n = 1usize / 0; | ^^^^^^^^^^ attempt to divide `1_usize` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:250:15 + --> $DIR/lint-overflowing-ops.rs:264:15 | LL | let _n = &(1usize / 0); | ^^^^^^^^^^^^ attempt to divide `1_usize` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:254:14 + --> $DIR/lint-overflowing-ops.rs:268:14 | LL | let _n = 1u8 % 0; | ^^^^^^^ attempt to calculate the remainder of `1_u8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:255:15 + --> $DIR/lint-overflowing-ops.rs:269:15 | LL | let _n = &(1u8 % 0); | ^^^^^^^^^ attempt to calculate the remainder of `1_u8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:257:14 + --> $DIR/lint-overflowing-ops.rs:271:14 | LL | let _n = 1u16 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_u16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:258:15 + --> $DIR/lint-overflowing-ops.rs:272:15 | LL | let _n = &(1u16 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_u16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:260:14 + --> $DIR/lint-overflowing-ops.rs:274:14 | LL | let _n = 1u32 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_u32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:261:15 + --> $DIR/lint-overflowing-ops.rs:275:15 | LL | let _n = &(1u32 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_u32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:263:14 + --> $DIR/lint-overflowing-ops.rs:277:14 | LL | let _n = 1u64 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_u64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:264:15 + --> $DIR/lint-overflowing-ops.rs:278:15 | LL | let _n = &(1u64 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_u64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:266:14 + --> $DIR/lint-overflowing-ops.rs:280:14 | LL | let _n = 1u128 % 0; | ^^^^^^^^^ attempt to calculate the remainder of `1_u128` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:267:15 + --> $DIR/lint-overflowing-ops.rs:281:15 | LL | let _n = &(1u128 % 0); | ^^^^^^^^^^^ attempt to calculate the remainder of `1_u128` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:269:14 + --> $DIR/lint-overflowing-ops.rs:283:14 | LL | let _n = 1i8 % 0; | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:270:15 + --> $DIR/lint-overflowing-ops.rs:284:15 | LL | let _n = &(1i8 % 0); | ^^^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:272:14 + --> $DIR/lint-overflowing-ops.rs:286:14 | LL | let _n = 1i16 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:273:15 + --> $DIR/lint-overflowing-ops.rs:287:15 | LL | let _n = &(1i16 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:275:14 + --> $DIR/lint-overflowing-ops.rs:289:14 | LL | let _n = 1i32 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:276:15 + --> $DIR/lint-overflowing-ops.rs:290:15 | LL | let _n = &(1i32 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:278:14 + --> $DIR/lint-overflowing-ops.rs:292:14 | LL | let _n = 1i64 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:279:15 + --> $DIR/lint-overflowing-ops.rs:293:15 | LL | let _n = &(1i64 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:281:14 + --> $DIR/lint-overflowing-ops.rs:295:14 | LL | let _n = 1i128 % 0; | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:282:15 + --> $DIR/lint-overflowing-ops.rs:296:15 | LL | let _n = &(1i128 % 0); | ^^^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:284:14 + --> $DIR/lint-overflowing-ops.rs:298:14 | LL | let _n = 1isize % 0; | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:285:15 + --> $DIR/lint-overflowing-ops.rs:299:15 | LL | let _n = &(1isize % 0); | ^^^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:287:14 + --> $DIR/lint-overflowing-ops.rs:301:14 | LL | let _n = 1usize % 0; | ^^^^^^^^^^ attempt to calculate the remainder of `1_usize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:288:15 + --> $DIR/lint-overflowing-ops.rs:302:15 | LL | let _n = &(1usize % 0); | ^^^^^^^^^^^^ attempt to calculate the remainder of `1_usize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:292:14 + --> $DIR/lint-overflowing-ops.rs:306:14 | LL | let _n = [1, 2, 3][4]; | ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4 error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:293:15 + --> $DIR/lint-overflowing-ops.rs:307:15 | LL | let _n = &([1, 2, 3][4]); | ^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4 -error: aborting due to 170 previous errors +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:311:36 + | +LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:313:36 + | +LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:315:36 + | +LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:317:36 + | +LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:319:36 + | +LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:321:36 + | +LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:323:36 + | +LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); + | ^^^^^^^^^^ attempt to divide `1_isize` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:325:36 + | +LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); + | ^^^^^^^ attempt to divide `1_i8` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:327:36 + | +LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); + | ^^^^^^^^ attempt to divide `1_i16` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:329:36 + | +LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); + | ^^^^^^^^ attempt to divide `1_i32` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:331:36 + | +LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); + | ^^^^^^^^ attempt to divide `1_i64` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:333:36 + | +LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); + | ^^^^^^^^^ attempt to divide `1_i128` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:335:36 + | +LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:337:36 + | +LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:339:36 + | +LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:341:36 + | +LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:343:36 + | +LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:345:36 + | +LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:347:36 + | +LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); + | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:349:36 + | +LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); + | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:351:36 + | +LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); + | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:353:36 + | +LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); + | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:355:36 + | +LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); + | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:357:36 + | +LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); + | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero + +error: aborting due to 203 previous errors diff --git a/tests/ui/lint/lint-overflowing-ops.opt_with_overflow_checks.stderr b/tests/ui/lint/lint-overflowing-ops.opt_with_overflow_checks.stderr index 93fc19ce79e44..265868ccc6108 100644 --- a/tests/ui/lint/lint-overflowing-ops.opt_with_overflow_checks.stderr +++ b/tests/ui/lint/lint-overflowing-ops.opt_with_overflow_checks.stderr @@ -1,5 +1,5 @@ error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:26:14 + --> $DIR/lint-overflowing-ops.rs:28:14 | LL | let _n = 1u8 << 8; | ^^^^^^^^ attempt to shift left by `8_i32`, which would overflow @@ -11,427 +11,445 @@ LL | #![deny(arithmetic_overflow)] | ^^^^^^^^^^^^^^^^^^^ error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:212:15 + --> $DIR/lint-overflowing-ops.rs:226:15 + | +LL | let _n = &(-i8::MIN); + | ^^^^^^^^^^ attempt to negate `i8::MIN`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:223:15 | LL | let _n = &(usize::MAX * 5); | ^^^^^^^^^^^^^^^^ attempt to compute `usize::MAX * 5_usize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:209:15 + --> $DIR/lint-overflowing-ops.rs:220:15 | LL | let _n = &(isize::MAX * 5); | ^^^^^^^^^^^^^^^^ attempt to compute `isize::MAX * 5_isize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:206:15 + --> $DIR/lint-overflowing-ops.rs:217:15 | LL | let _n = &(i128::MAX * 5); | ^^^^^^^^^^^^^^^ attempt to compute `i128::MAX * 5_i128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:203:15 + --> $DIR/lint-overflowing-ops.rs:214:15 | LL | let _n = &(i64::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `i64::MAX * 5_i64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:200:15 + --> $DIR/lint-overflowing-ops.rs:211:15 | LL | let _n = &(i32::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `i32::MAX * 5_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:197:15 + --> $DIR/lint-overflowing-ops.rs:208:15 | LL | let _n = &(i16::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `i16::MAX * 5_i16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:194:15 + --> $DIR/lint-overflowing-ops.rs:205:15 | LL | let _n = &(i8::MAX * i8::MAX); | ^^^^^^^^^^^^^^^^^^^ attempt to compute `i8::MAX * i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:191:15 + --> $DIR/lint-overflowing-ops.rs:202:15 | LL | let _n = &(u128::MAX * 5); | ^^^^^^^^^^^^^^^ attempt to compute `u128::MAX * 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:188:15 + --> $DIR/lint-overflowing-ops.rs:199:15 | LL | let _n = &(u64::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `u64::MAX * 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:185:15 + --> $DIR/lint-overflowing-ops.rs:196:15 | LL | let _n = &(u32::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `u32::MAX * 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:182:15 + --> $DIR/lint-overflowing-ops.rs:193:15 | LL | let _n = &(u16::MAX * 5); | ^^^^^^^^^^^^^^ attempt to compute `u16::MAX * 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:179:15 + --> $DIR/lint-overflowing-ops.rs:190:15 | LL | let _n = &(u8::MAX * 5); | ^^^^^^^^^^^^^ attempt to compute `u8::MAX * 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:174:15 + --> $DIR/lint-overflowing-ops.rs:185:15 | LL | let _n = &(1usize - 5); | ^^^^^^^^^^^^ attempt to compute `1_usize - 5_usize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:171:15 + --> $DIR/lint-overflowing-ops.rs:182:15 | LL | let _n = &(-5isize - isize::MAX); | ^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `-5_isize - isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:168:15 + --> $DIR/lint-overflowing-ops.rs:179:15 | LL | let _n = &(-5i128 - i128::MAX); | ^^^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i128 - i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:165:15 + --> $DIR/lint-overflowing-ops.rs:176:15 | LL | let _n = &(-5i64 - i64::MAX); | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i64 - i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:162:15 + --> $DIR/lint-overflowing-ops.rs:173:15 | LL | let _n = &(-5i32 - i32::MAX); | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i32 - i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:159:15 + --> $DIR/lint-overflowing-ops.rs:170:15 | LL | let _n = &(-5i16 - i16::MAX); | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i16 - i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:156:15 + --> $DIR/lint-overflowing-ops.rs:167:15 | LL | let _n = &(-5i8 - i8::MAX); | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i8 - i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:153:15 + --> $DIR/lint-overflowing-ops.rs:164:15 | LL | let _n = &(1u128 - 5); | ^^^^^^^^^^^ attempt to compute `1_u128 - 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:150:15 + --> $DIR/lint-overflowing-ops.rs:161:15 | LL | let _n = &(1u64 - 5); | ^^^^^^^^^^ attempt to compute `1_u64 - 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:147:15 + --> $DIR/lint-overflowing-ops.rs:158:15 | LL | let _n = &(1u32 - 5); | ^^^^^^^^^^ attempt to compute `1_u32 - 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:144:15 + --> $DIR/lint-overflowing-ops.rs:155:15 | LL | let _n = &(1u16 - 5); | ^^^^^^^^^^ attempt to compute `1_u16 - 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:141:15 + --> $DIR/lint-overflowing-ops.rs:152:15 | LL | let _n = &(1u8 - 5); | ^^^^^^^^^ attempt to compute `1_u8 - 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:136:15 + --> $DIR/lint-overflowing-ops.rs:147:15 | LL | let _n = &(1usize + usize::MAX); | ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `1_usize + usize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:133:15 + --> $DIR/lint-overflowing-ops.rs:144:15 | LL | let _n = &(1isize + isize::MAX); | ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `1_isize + isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:130:15 + --> $DIR/lint-overflowing-ops.rs:141:15 | LL | let _n = &(1i128 + i128::MAX); | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_i128 + i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:127:15 + --> $DIR/lint-overflowing-ops.rs:138:15 | LL | let _n = &(1i64 + i64::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i64 + i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:124:15 + --> $DIR/lint-overflowing-ops.rs:135:15 | LL | let _n = &(1i32 + i32::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i32 + i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:121:15 + --> $DIR/lint-overflowing-ops.rs:132:15 | LL | let _n = &(1i16 + i16::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i16 + i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:118:15 + --> $DIR/lint-overflowing-ops.rs:129:15 | LL | let _n = &(1i8 + i8::MAX); | ^^^^^^^^^^^^^^^ attempt to compute `1_i8 + i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:115:15 + --> $DIR/lint-overflowing-ops.rs:126:15 | LL | let _n = &(1u128 + u128::MAX); | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_u128 + u128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:112:15 + --> $DIR/lint-overflowing-ops.rs:123:15 | LL | let _n = &(1u64 + u64::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u64 + u64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:109:15 + --> $DIR/lint-overflowing-ops.rs:120:15 | LL | let _n = &(1u32 + u32::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u32 + u32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:106:15 + --> $DIR/lint-overflowing-ops.rs:117:15 | LL | let _n = &(1u16 + u16::MAX); | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u16 + u16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:103:15 + --> $DIR/lint-overflowing-ops.rs:114:15 | LL | let _n = &(1u8 + u8::MAX); | ^^^^^^^^^^^^^^^ attempt to compute `1_u8 + u8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:98:15 + --> $DIR/lint-overflowing-ops.rs:110:15 + | +LL | let _n = &(1i64 >> [64][0]); + | ^^^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:107:15 | LL | let _n = &(1_usize >> BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:95:15 + --> $DIR/lint-overflowing-ops.rs:104:15 | LL | let _n = &(1_isize >> BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:92:15 + --> $DIR/lint-overflowing-ops.rs:101:15 | LL | let _n = &(1i128 >> 128); | ^^^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:89:15 + --> $DIR/lint-overflowing-ops.rs:98:15 | LL | let _n = &(1i64 >> 64); | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:86:15 + --> $DIR/lint-overflowing-ops.rs:95:15 | LL | let _n = &(1i32 >> 32); | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:83:15 + --> $DIR/lint-overflowing-ops.rs:92:15 | LL | let _n = &(1i16 >> 16); | ^^^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:80:15 + --> $DIR/lint-overflowing-ops.rs:89:15 | LL | let _n = &(1i8 >> 8); | ^^^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:77:15 + --> $DIR/lint-overflowing-ops.rs:86:15 | LL | let _n = &(1u128 >> 128); | ^^^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:74:15 + --> $DIR/lint-overflowing-ops.rs:83:15 | LL | let _n = &(1u64 >> 64); | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:71:15 + --> $DIR/lint-overflowing-ops.rs:80:15 | LL | let _n = &(1u32 >> 32); | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:68:15 + --> $DIR/lint-overflowing-ops.rs:77:15 | LL | let _n = &(1u16 >> 16); | ^^^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:65:15 + --> $DIR/lint-overflowing-ops.rs:74:15 | LL | let _n = &(1u8 >> 8); | ^^^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:60:15 + --> $DIR/lint-overflowing-ops.rs:65:15 + | +LL | let _n = &(1 << -1); + | ^^^^^^^^^ attempt to shift left by `-1_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:62:15 | LL | let _n = &(1_usize << BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:57:15 + --> $DIR/lint-overflowing-ops.rs:59:15 | LL | let _n = &(1_isize << BITS); | ^^^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:54:15 + --> $DIR/lint-overflowing-ops.rs:56:15 | LL | let _n = &(1i128 << 128); | ^^^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:51:15 + --> $DIR/lint-overflowing-ops.rs:53:15 | LL | let _n = &(1i64 << 64); | ^^^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:48:15 + --> $DIR/lint-overflowing-ops.rs:50:15 | LL | let _n = &(1i32 << 32); | ^^^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:45:15 + --> $DIR/lint-overflowing-ops.rs:47:15 | LL | let _n = &(1i16 << 16); | ^^^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:42:15 + --> $DIR/lint-overflowing-ops.rs:44:15 | LL | let _n = &(1i8 << 8); | ^^^^^^^^^^ attempt to shift left by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:39:15 + --> $DIR/lint-overflowing-ops.rs:41:15 | LL | let _n = &(1u128 << 128); | ^^^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:36:15 + --> $DIR/lint-overflowing-ops.rs:38:15 | LL | let _n = &(1u64 << 64); | ^^^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:33:15 + --> $DIR/lint-overflowing-ops.rs:35:15 | LL | let _n = &(1u32 << 32); | ^^^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:30:15 + --> $DIR/lint-overflowing-ops.rs:32:15 | LL | let _n = &(1u16 << 16); | ^^^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:27:15 + --> $DIR/lint-overflowing-ops.rs:29:15 | LL | let _n = &(1u8 << 8); | ^^^^^^^^^^ attempt to shift left by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:29:14 + --> $DIR/lint-overflowing-ops.rs:31:14 | LL | let _n = 1u16 << 16; | ^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:32:14 + --> $DIR/lint-overflowing-ops.rs:34:14 | LL | let _n = 1u32 << 32; | ^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:35:14 + --> $DIR/lint-overflowing-ops.rs:37:14 | LL | let _n = 1u64 << 64; | ^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:38:14 + --> $DIR/lint-overflowing-ops.rs:40:14 | LL | let _n = 1u128 << 128; | ^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:41:14 + --> $DIR/lint-overflowing-ops.rs:43:14 | LL | let _n = 1i8 << 8; | ^^^^^^^^ attempt to shift left by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:44:14 + --> $DIR/lint-overflowing-ops.rs:46:14 | LL | let _n = 1i16 << 16; | ^^^^^^^^^^ attempt to shift left by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:47:14 + --> $DIR/lint-overflowing-ops.rs:49:14 | LL | let _n = 1i32 << 32; | ^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:50:14 + --> $DIR/lint-overflowing-ops.rs:52:14 | LL | let _n = 1i64 << 64; | ^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:53:14 + --> $DIR/lint-overflowing-ops.rs:55:14 | LL | let _n = 1i128 << 128; | ^^^^^^^^^^^^ attempt to shift left by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:56:14 + --> $DIR/lint-overflowing-ops.rs:58:14 | LL | let _n = 1_isize << BITS; | ^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:59:14 + --> $DIR/lint-overflowing-ops.rs:61:14 | LL | let _n = 1_usize << BITS; | ^^^^^^^^^^^^^^^ attempt to shift left by `%BITS%`, which would overflow @@ -439,293 +457,329 @@ LL | let _n = 1_usize << BITS; error: this arithmetic operation will overflow --> $DIR/lint-overflowing-ops.rs:64:14 | +LL | let _n = 1 << -1; + | ^^^^^^^ attempt to shift left by `-1_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:69:14 + | +LL | let _n = -1_i64 >> 64; + | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:70:14 + | +LL | let _n = -1_i32 >> 32; + | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:71:14 + | +LL | let _n = -1_i32 >> -1; + | ^^^^^^^^^^^^ attempt to shift right by `-1_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:73:14 + | LL | let _n = 1u8 >> 8; | ^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:67:14 + --> $DIR/lint-overflowing-ops.rs:76:14 | LL | let _n = 1u16 >> 16; | ^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:70:14 + --> $DIR/lint-overflowing-ops.rs:79:14 | LL | let _n = 1u32 >> 32; | ^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:73:14 + --> $DIR/lint-overflowing-ops.rs:82:14 | LL | let _n = 1u64 >> 64; | ^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:76:14 + --> $DIR/lint-overflowing-ops.rs:85:14 | LL | let _n = 1u128 >> 128; | ^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:79:14 + --> $DIR/lint-overflowing-ops.rs:88:14 | LL | let _n = 1i8 >> 8; | ^^^^^^^^ attempt to shift right by `8_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:82:14 + --> $DIR/lint-overflowing-ops.rs:91:14 | LL | let _n = 1i16 >> 16; | ^^^^^^^^^^ attempt to shift right by `16_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:85:14 + --> $DIR/lint-overflowing-ops.rs:94:14 | LL | let _n = 1i32 >> 32; | ^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:88:14 + --> $DIR/lint-overflowing-ops.rs:97:14 | LL | let _n = 1i64 >> 64; | ^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:91:14 + --> $DIR/lint-overflowing-ops.rs:100:14 | LL | let _n = 1i128 >> 128; | ^^^^^^^^^^^^ attempt to shift right by `128_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:94:14 + --> $DIR/lint-overflowing-ops.rs:103:14 | LL | let _n = 1_isize >> BITS; | ^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:97:14 + --> $DIR/lint-overflowing-ops.rs:106:14 | LL | let _n = 1_usize >> BITS; | ^^^^^^^^^^^^^^^ attempt to shift right by `%BITS%`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:102:14 + --> $DIR/lint-overflowing-ops.rs:109:14 + | +LL | let _n = 1i64 >> [64][0]; + | ^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow + +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:113:14 | LL | let _n = 1u8 + u8::MAX; | ^^^^^^^^^^^^^ attempt to compute `1_u8 + u8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:105:14 + --> $DIR/lint-overflowing-ops.rs:116:14 | LL | let _n = 1u16 + u16::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_u16 + u16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:108:14 + --> $DIR/lint-overflowing-ops.rs:119:14 | LL | let _n = 1u32 + u32::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_u32 + u32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:111:14 + --> $DIR/lint-overflowing-ops.rs:122:14 | LL | let _n = 1u64 + u64::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_u64 + u64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:114:14 + --> $DIR/lint-overflowing-ops.rs:125:14 | LL | let _n = 1u128 + u128::MAX; | ^^^^^^^^^^^^^^^^^ attempt to compute `1_u128 + u128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:117:14 + --> $DIR/lint-overflowing-ops.rs:128:14 | LL | let _n = 1i8 + i8::MAX; | ^^^^^^^^^^^^^ attempt to compute `1_i8 + i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:120:14 + --> $DIR/lint-overflowing-ops.rs:131:14 | LL | let _n = 1i16 + i16::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_i16 + i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:123:14 + --> $DIR/lint-overflowing-ops.rs:134:14 | LL | let _n = 1i32 + i32::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_i32 + i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:126:14 + --> $DIR/lint-overflowing-ops.rs:137:14 | LL | let _n = 1i64 + i64::MAX; | ^^^^^^^^^^^^^^^ attempt to compute `1_i64 + i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:129:14 + --> $DIR/lint-overflowing-ops.rs:140:14 | LL | let _n = 1i128 + i128::MAX; | ^^^^^^^^^^^^^^^^^ attempt to compute `1_i128 + i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:132:14 + --> $DIR/lint-overflowing-ops.rs:143:14 | LL | let _n = 1isize + isize::MAX; | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_isize + isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:135:14 + --> $DIR/lint-overflowing-ops.rs:146:14 | LL | let _n = 1usize + usize::MAX; | ^^^^^^^^^^^^^^^^^^^ attempt to compute `1_usize + usize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:140:14 + --> $DIR/lint-overflowing-ops.rs:151:14 | LL | let _n = 1u8 - 5; | ^^^^^^^ attempt to compute `1_u8 - 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:143:14 + --> $DIR/lint-overflowing-ops.rs:154:14 | LL | let _n = 1u16 - 5; | ^^^^^^^^ attempt to compute `1_u16 - 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:146:14 + --> $DIR/lint-overflowing-ops.rs:157:14 | LL | let _n = 1u32 - 5; | ^^^^^^^^ attempt to compute `1_u32 - 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:149:14 + --> $DIR/lint-overflowing-ops.rs:160:14 | LL | let _n = 1u64 - 5 ; | ^^^^^^^^ attempt to compute `1_u64 - 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:152:14 + --> $DIR/lint-overflowing-ops.rs:163:14 | LL | let _n = 1u128 - 5 ; | ^^^^^^^^^ attempt to compute `1_u128 - 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:155:14 + --> $DIR/lint-overflowing-ops.rs:166:14 | LL | let _n = -5i8 - i8::MAX; | ^^^^^^^^^^^^^^ attempt to compute `-5_i8 - i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:158:14 + --> $DIR/lint-overflowing-ops.rs:169:14 | LL | let _n = -5i16 - i16::MAX; | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i16 - i16::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:161:14 + --> $DIR/lint-overflowing-ops.rs:172:14 | LL | let _n = -5i32 - i32::MAX; | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i32 - i32::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:164:14 + --> $DIR/lint-overflowing-ops.rs:175:14 | LL | let _n = -5i64 - i64::MAX; | ^^^^^^^^^^^^^^^^ attempt to compute `-5_i64 - i64::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:167:14 + --> $DIR/lint-overflowing-ops.rs:178:14 | LL | let _n = -5i128 - i128::MAX; | ^^^^^^^^^^^^^^^^^^ attempt to compute `-5_i128 - i128::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:170:14 + --> $DIR/lint-overflowing-ops.rs:181:14 | LL | let _n = -5isize - isize::MAX; | ^^^^^^^^^^^^^^^^^^^^ attempt to compute `-5_isize - isize::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:173:14 + --> $DIR/lint-overflowing-ops.rs:184:14 | LL | let _n = 1usize - 5; | ^^^^^^^^^^ attempt to compute `1_usize - 5_usize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:178:14 + --> $DIR/lint-overflowing-ops.rs:189:14 | LL | let _n = u8::MAX * 5; | ^^^^^^^^^^^ attempt to compute `u8::MAX * 5_u8`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:181:14 + --> $DIR/lint-overflowing-ops.rs:192:14 | LL | let _n = u16::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `u16::MAX * 5_u16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:184:14 + --> $DIR/lint-overflowing-ops.rs:195:14 | LL | let _n = u32::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `u32::MAX * 5_u32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:187:14 + --> $DIR/lint-overflowing-ops.rs:198:14 | LL | let _n = u64::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `u64::MAX * 5_u64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:190:14 + --> $DIR/lint-overflowing-ops.rs:201:14 | LL | let _n = u128::MAX * 5; | ^^^^^^^^^^^^^ attempt to compute `u128::MAX * 5_u128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:193:14 + --> $DIR/lint-overflowing-ops.rs:204:14 | LL | let _n = i8::MAX * i8::MAX; | ^^^^^^^^^^^^^^^^^ attempt to compute `i8::MAX * i8::MAX`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:196:14 + --> $DIR/lint-overflowing-ops.rs:207:14 | LL | let _n = i16::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `i16::MAX * 5_i16`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:199:14 + --> $DIR/lint-overflowing-ops.rs:210:14 | LL | let _n = i32::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `i32::MAX * 5_i32`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:202:14 + --> $DIR/lint-overflowing-ops.rs:213:14 | LL | let _n = i64::MAX * 5; | ^^^^^^^^^^^^ attempt to compute `i64::MAX * 5_i64`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:205:14 + --> $DIR/lint-overflowing-ops.rs:216:14 | LL | let _n = i128::MAX * 5; | ^^^^^^^^^^^^^ attempt to compute `i128::MAX * 5_i128`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:208:14 + --> $DIR/lint-overflowing-ops.rs:219:14 | LL | let _n = isize::MAX * 5; | ^^^^^^^^^^^^^^ attempt to compute `isize::MAX * 5_isize`, which would overflow error: this arithmetic operation will overflow - --> $DIR/lint-overflowing-ops.rs:211:14 + --> $DIR/lint-overflowing-ops.rs:222:14 | LL | let _n = usize::MAX * 5; | ^^^^^^^^^^^^^^ attempt to compute `usize::MAX * 5_usize`, which would overflow +error: this arithmetic operation will overflow + --> $DIR/lint-overflowing-ops.rs:225:14 + | +LL | let _n = -i8::MIN; + | ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow + error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:216:14 + --> $DIR/lint-overflowing-ops.rs:230:14 | LL | let _n = 1u8 / 0; | ^^^^^^^ attempt to divide `1_u8` by zero @@ -733,298 +787,442 @@ LL | let _n = 1u8 / 0; = note: `#[deny(unconditional_panic)]` on by default error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:217:15 + --> $DIR/lint-overflowing-ops.rs:231:15 | LL | let _n = &(1u8 / 0); | ^^^^^^^^^ attempt to divide `1_u8` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:219:14 + --> $DIR/lint-overflowing-ops.rs:233:14 | LL | let _n = 1u16 / 0; | ^^^^^^^^ attempt to divide `1_u16` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:220:15 + --> $DIR/lint-overflowing-ops.rs:234:15 | LL | let _n = &(1u16 / 0); | ^^^^^^^^^^ attempt to divide `1_u16` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:222:14 + --> $DIR/lint-overflowing-ops.rs:236:14 | LL | let _n = 1u32 / 0; | ^^^^^^^^ attempt to divide `1_u32` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:223:15 + --> $DIR/lint-overflowing-ops.rs:237:15 | LL | let _n = &(1u32 / 0); | ^^^^^^^^^^ attempt to divide `1_u32` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:225:14 + --> $DIR/lint-overflowing-ops.rs:239:14 | LL | let _n = 1u64 / 0; | ^^^^^^^^ attempt to divide `1_u64` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:226:15 + --> $DIR/lint-overflowing-ops.rs:240:15 | LL | let _n = &(1u64 / 0); | ^^^^^^^^^^ attempt to divide `1_u64` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:228:14 + --> $DIR/lint-overflowing-ops.rs:242:14 | LL | let _n = 1u128 / 0; | ^^^^^^^^^ attempt to divide `1_u128` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:229:15 + --> $DIR/lint-overflowing-ops.rs:243:15 | LL | let _n = &(1u128 / 0); | ^^^^^^^^^^^ attempt to divide `1_u128` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:231:14 + --> $DIR/lint-overflowing-ops.rs:245:14 | LL | let _n = 1i8 / 0; | ^^^^^^^ attempt to divide `1_i8` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:232:15 + --> $DIR/lint-overflowing-ops.rs:246:15 | LL | let _n = &(1i8 / 0); | ^^^^^^^^^ attempt to divide `1_i8` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:234:14 + --> $DIR/lint-overflowing-ops.rs:248:14 | LL | let _n = 1i16 / 0; | ^^^^^^^^ attempt to divide `1_i16` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:235:15 + --> $DIR/lint-overflowing-ops.rs:249:15 | LL | let _n = &(1i16 / 0); | ^^^^^^^^^^ attempt to divide `1_i16` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:237:14 + --> $DIR/lint-overflowing-ops.rs:251:14 | LL | let _n = 1i32 / 0; | ^^^^^^^^ attempt to divide `1_i32` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:238:15 + --> $DIR/lint-overflowing-ops.rs:252:15 | LL | let _n = &(1i32 / 0); | ^^^^^^^^^^ attempt to divide `1_i32` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:240:14 + --> $DIR/lint-overflowing-ops.rs:254:14 | LL | let _n = 1i64 / 0; | ^^^^^^^^ attempt to divide `1_i64` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:241:15 + --> $DIR/lint-overflowing-ops.rs:255:15 | LL | let _n = &(1i64 / 0); | ^^^^^^^^^^ attempt to divide `1_i64` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:243:14 + --> $DIR/lint-overflowing-ops.rs:257:14 | LL | let _n = 1i128 / 0; | ^^^^^^^^^ attempt to divide `1_i128` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:244:15 + --> $DIR/lint-overflowing-ops.rs:258:15 | LL | let _n = &(1i128 / 0); | ^^^^^^^^^^^ attempt to divide `1_i128` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:246:14 + --> $DIR/lint-overflowing-ops.rs:260:14 | LL | let _n = 1isize / 0; | ^^^^^^^^^^ attempt to divide `1_isize` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:247:15 + --> $DIR/lint-overflowing-ops.rs:261:15 | LL | let _n = &(1isize / 0); | ^^^^^^^^^^^^ attempt to divide `1_isize` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:249:14 + --> $DIR/lint-overflowing-ops.rs:263:14 | LL | let _n = 1usize / 0; | ^^^^^^^^^^ attempt to divide `1_usize` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:250:15 + --> $DIR/lint-overflowing-ops.rs:264:15 | LL | let _n = &(1usize / 0); | ^^^^^^^^^^^^ attempt to divide `1_usize` by zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:254:14 + --> $DIR/lint-overflowing-ops.rs:268:14 | LL | let _n = 1u8 % 0; | ^^^^^^^ attempt to calculate the remainder of `1_u8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:255:15 + --> $DIR/lint-overflowing-ops.rs:269:15 | LL | let _n = &(1u8 % 0); | ^^^^^^^^^ attempt to calculate the remainder of `1_u8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:257:14 + --> $DIR/lint-overflowing-ops.rs:271:14 | LL | let _n = 1u16 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_u16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:258:15 + --> $DIR/lint-overflowing-ops.rs:272:15 | LL | let _n = &(1u16 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_u16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:260:14 + --> $DIR/lint-overflowing-ops.rs:274:14 | LL | let _n = 1u32 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_u32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:261:15 + --> $DIR/lint-overflowing-ops.rs:275:15 | LL | let _n = &(1u32 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_u32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:263:14 + --> $DIR/lint-overflowing-ops.rs:277:14 | LL | let _n = 1u64 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_u64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:264:15 + --> $DIR/lint-overflowing-ops.rs:278:15 | LL | let _n = &(1u64 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_u64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:266:14 + --> $DIR/lint-overflowing-ops.rs:280:14 | LL | let _n = 1u128 % 0; | ^^^^^^^^^ attempt to calculate the remainder of `1_u128` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:267:15 + --> $DIR/lint-overflowing-ops.rs:281:15 | LL | let _n = &(1u128 % 0); | ^^^^^^^^^^^ attempt to calculate the remainder of `1_u128` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:269:14 + --> $DIR/lint-overflowing-ops.rs:283:14 | LL | let _n = 1i8 % 0; | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:270:15 + --> $DIR/lint-overflowing-ops.rs:284:15 | LL | let _n = &(1i8 % 0); | ^^^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:272:14 + --> $DIR/lint-overflowing-ops.rs:286:14 | LL | let _n = 1i16 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:273:15 + --> $DIR/lint-overflowing-ops.rs:287:15 | LL | let _n = &(1i16 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:275:14 + --> $DIR/lint-overflowing-ops.rs:289:14 | LL | let _n = 1i32 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:276:15 + --> $DIR/lint-overflowing-ops.rs:290:15 | LL | let _n = &(1i32 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:278:14 + --> $DIR/lint-overflowing-ops.rs:292:14 | LL | let _n = 1i64 % 0; | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:279:15 + --> $DIR/lint-overflowing-ops.rs:293:15 | LL | let _n = &(1i64 % 0); | ^^^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:281:14 + --> $DIR/lint-overflowing-ops.rs:295:14 | LL | let _n = 1i128 % 0; | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:282:15 + --> $DIR/lint-overflowing-ops.rs:296:15 | LL | let _n = &(1i128 % 0); | ^^^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:284:14 + --> $DIR/lint-overflowing-ops.rs:298:14 | LL | let _n = 1isize % 0; | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:285:15 + --> $DIR/lint-overflowing-ops.rs:299:15 | LL | let _n = &(1isize % 0); | ^^^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:287:14 + --> $DIR/lint-overflowing-ops.rs:301:14 | LL | let _n = 1usize % 0; | ^^^^^^^^^^ attempt to calculate the remainder of `1_usize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:288:15 + --> $DIR/lint-overflowing-ops.rs:302:15 | LL | let _n = &(1usize % 0); | ^^^^^^^^^^^^ attempt to calculate the remainder of `1_usize` with a divisor of zero error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:292:14 + --> $DIR/lint-overflowing-ops.rs:306:14 | LL | let _n = [1, 2, 3][4]; | ^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4 error: this operation will panic at runtime - --> $DIR/lint-overflowing-ops.rs:293:15 + --> $DIR/lint-overflowing-ops.rs:307:15 | LL | let _n = &([1, 2, 3][4]); | ^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 4 -error: aborting due to 170 previous errors +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:311:36 + | +LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:313:36 + | +LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:315:36 + | +LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:317:36 + | +LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:319:36 + | +LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:321:36 + | +LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); + | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:323:36 + | +LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); + | ^^^^^^^^^^ attempt to divide `1_isize` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:325:36 + | +LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); + | ^^^^^^^ attempt to divide `1_i8` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:327:36 + | +LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); + | ^^^^^^^^ attempt to divide `1_i16` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:329:36 + | +LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); + | ^^^^^^^^ attempt to divide `1_i32` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:331:36 + | +LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); + | ^^^^^^^^ attempt to divide `1_i64` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:333:36 + | +LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); + | ^^^^^^^^^ attempt to divide `1_i128` by zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:335:36 + | +LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:337:36 + | +LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:339:36 + | +LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:341:36 + | +LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:343:36 + | +LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:345:36 + | +LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); + | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:347:36 + | +LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); + | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:349:36 + | +LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); + | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:351:36 + | +LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); + | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:353:36 + | +LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); + | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:355:36 + | +LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); + | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero + +error: this operation will panic at runtime + --> $DIR/lint-overflowing-ops.rs:357:36 + | +LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); + | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero + +error: aborting due to 203 previous errors diff --git a/tests/ui/lint/lint-overflowing-ops.rs b/tests/ui/lint/lint-overflowing-ops.rs index e64c210badeff..5305677d166c1 100644 --- a/tests/ui/lint/lint-overflowing-ops.rs +++ b/tests/ui/lint/lint-overflowing-ops.rs @@ -21,6 +21,8 @@ const BITS: usize = 32; #[cfg(target_pointer_width = "64")] const BITS: usize = 64; +use std::thread; + fn main() { // Shift left let _n = 1u8 << 8; //~ ERROR: arithmetic operation will overflow @@ -59,8 +61,15 @@ fn main() { let _n = 1_usize << BITS; //~ ERROR: arithmetic operation will overflow let _n = &(1_usize << BITS); //~ ERROR: arithmetic operation will overflow + let _n = 1 << -1; //~ ERROR: arithmetic operation will overflow + let _n = &(1 << -1); //~ ERROR: arithmetic operation will overflow // Shift right + + let _n = -1_i64 >> 64; //~ ERROR: arithmetic operation will overflow + let _n = -1_i32 >> 32; //~ ERROR: arithmetic operation will overflow + let _n = -1_i32 >> -1; //~ ERROR: arithmetic operation will overflow + let _n = 1u8 >> 8; //~ ERROR: arithmetic operation will overflow let _n = &(1u8 >> 8); //~ ERROR: arithmetic operation will overflow @@ -97,6 +106,8 @@ fn main() { let _n = 1_usize >> BITS; //~ ERROR: arithmetic operation will overflow let _n = &(1_usize >> BITS); //~ ERROR: arithmetic operation will overflow + let _n = 1i64 >> [64][0]; //~ ERROR: arithmetic operation will overflow + let _n = &(1i64 >> [64][0]); //~ ERROR: arithmetic operation will overflow // Addition let _n = 1u8 + u8::MAX; //~ ERROR: arithmetic operation will overflow @@ -211,6 +222,9 @@ fn main() { let _n = usize::MAX * 5; //~ ERROR: arithmetic operation will overflow let _n = &(usize::MAX * 5); //~ ERROR: arithmetic operation will overflow + let _n = -i8::MIN; //~ ERROR this arithmetic operation will overflow + let _n = &(-i8::MIN); //~ ERROR this arithmetic operation will overflow + // Division let _n = 1u8 / 0; //~ ERROR: this operation will panic at runtime @@ -291,4 +305,55 @@ fn main() { // Out of bounds access let _n = [1, 2, 3][4]; //~ ERROR: this operation will panic at runtime let _n = &([1, 2, 3][4]); //~ ERROR: this operation will panic at runtime + + + // issue-8460-const + assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); + //~^ ERROR operation will panic + assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); + //~^ ERROR operation will panic } diff --git a/tests/ui/numbers-arithmetic/issue-8460-const.noopt.stderr b/tests/ui/numbers-arithmetic/issue-8460-const.noopt.stderr deleted file mode 100644 index 2fba94d07401c..0000000000000 --- a/tests/ui/numbers-arithmetic/issue-8460-const.noopt.stderr +++ /dev/null @@ -1,148 +0,0 @@ -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:11:36 - | -LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow - | - = note: `#[deny(unconditional_panic)]` on by default - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:13:36 - | -LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:15:36 - | -LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:17:36 - | -LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:19:36 - | -LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:21:36 - | -LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:23:36 - | -LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to divide `1_isize` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:25:36 - | -LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); - | ^^^^^^^ attempt to divide `1_i8` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:27:36 - | -LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i16` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:29:36 - | -LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i32` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:31:36 - | -LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i64` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:33:36 - | -LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); - | ^^^^^^^^^ attempt to divide `1_i128` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:35:36 - | -LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:37:36 - | -LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:39:36 - | -LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:41:36 - | -LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:43:36 - | -LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:45:36 - | -LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:47:36 - | -LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:49:36 - | -LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); - | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:51:36 - | -LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:53:36 - | -LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:55:36 - | -LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:57:36 - | -LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); - | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero - -error: aborting due to 24 previous errors - diff --git a/tests/ui/numbers-arithmetic/issue-8460-const.opt.stderr b/tests/ui/numbers-arithmetic/issue-8460-const.opt.stderr deleted file mode 100644 index 2fba94d07401c..0000000000000 --- a/tests/ui/numbers-arithmetic/issue-8460-const.opt.stderr +++ /dev/null @@ -1,148 +0,0 @@ -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:11:36 - | -LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow - | - = note: `#[deny(unconditional_panic)]` on by default - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:13:36 - | -LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:15:36 - | -LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:17:36 - | -LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:19:36 - | -LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:21:36 - | -LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:23:36 - | -LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to divide `1_isize` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:25:36 - | -LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); - | ^^^^^^^ attempt to divide `1_i8` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:27:36 - | -LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i16` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:29:36 - | -LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i32` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:31:36 - | -LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i64` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:33:36 - | -LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); - | ^^^^^^^^^ attempt to divide `1_i128` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:35:36 - | -LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:37:36 - | -LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:39:36 - | -LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:41:36 - | -LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:43:36 - | -LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:45:36 - | -LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:47:36 - | -LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:49:36 - | -LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); - | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:51:36 - | -LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:53:36 - | -LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:55:36 - | -LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:57:36 - | -LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); - | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero - -error: aborting due to 24 previous errors - diff --git a/tests/ui/numbers-arithmetic/issue-8460-const.opt_with_overflow_checks.stderr b/tests/ui/numbers-arithmetic/issue-8460-const.opt_with_overflow_checks.stderr deleted file mode 100644 index 2fba94d07401c..0000000000000 --- a/tests/ui/numbers-arithmetic/issue-8460-const.opt_with_overflow_checks.stderr +++ /dev/null @@ -1,148 +0,0 @@ -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:11:36 - | -LL | assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN / -1_isize`, which would overflow - | - = note: `#[deny(unconditional_panic)]` on by default - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:13:36 - | -LL | assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^ attempt to compute `i8::MIN / -1_i8`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:15:36 - | -LL | assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i16::MIN / -1_i16`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:17:36 - | -LL | assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i32::MIN / -1_i32`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:19:36 - | -LL | assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i64::MIN / -1_i64`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:21:36 - | -LL | assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); - | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN / -1_i128`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:23:36 - | -LL | assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to divide `1_isize` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:25:36 - | -LL | assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); - | ^^^^^^^ attempt to divide `1_i8` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:27:36 - | -LL | assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i16` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:29:36 - | -LL | assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i32` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:31:36 - | -LL | assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); - | ^^^^^^^^ attempt to divide `1_i64` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:33:36 - | -LL | assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); - | ^^^^^^^^^ attempt to divide `1_i128` by zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:35:36 - | -LL | assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^^^ attempt to compute `isize::MIN % -1_isize`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:37:36 - | -LL | assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^ attempt to compute `i8::MIN % -1_i8`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:39:36 - | -LL | assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i16::MIN % -1_i16`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:41:36 - | -LL | assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i32::MIN % -1_i32`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:43:36 - | -LL | assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^ attempt to compute `i64::MIN % -1_i64`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:45:36 - | -LL | assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); - | ^^^^^^^^^^^^^^ attempt to compute `i128::MIN % -1_i128`, which would overflow - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:47:36 - | -LL | assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); - | ^^^^^^^^^^ attempt to calculate the remainder of `1_isize` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:49:36 - | -LL | assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); - | ^^^^^^^ attempt to calculate the remainder of `1_i8` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:51:36 - | -LL | assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i16` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:53:36 - | -LL | assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i32` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:55:36 - | -LL | assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); - | ^^^^^^^^ attempt to calculate the remainder of `1_i64` with a divisor of zero - -error: this operation will panic at runtime - --> $DIR/issue-8460-const.rs:57:36 - | -LL | assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); - | ^^^^^^^^^ attempt to calculate the remainder of `1_i128` with a divisor of zero - -error: aborting due to 24 previous errors - diff --git a/tests/ui/numbers-arithmetic/issue-8460-const.rs b/tests/ui/numbers-arithmetic/issue-8460-const.rs deleted file mode 100644 index 223c05d72d60f..0000000000000 --- a/tests/ui/numbers-arithmetic/issue-8460-const.rs +++ /dev/null @@ -1,59 +0,0 @@ -//@ revisions: noopt opt opt_with_overflow_checks -//@[noopt]compile-flags: -C opt-level=0 -//@[opt]compile-flags: -O -//@[opt_with_overflow_checks]compile-flags: -C overflow-checks=on -O - -//@ build-fail - -use std::thread; - -fn main() { - assert!(thread::spawn(move|| { isize::MIN / -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i8::MIN / -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i16::MIN / -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i32::MIN / -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i64::MIN / -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i128::MIN / -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1isize / 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i8 / 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i16 / 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i32 / 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i64 / 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i128 / 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { isize::MIN % -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i8::MIN % -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i16::MIN % -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i32::MIN % -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i64::MIN % -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { i128::MIN % -1; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1isize % 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i8 % 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i16 % 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i32 % 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i64 % 0; }).join().is_err()); - //~^ ERROR operation will panic - assert!(thread::spawn(move|| { 1i128 % 0; }).join().is_err()); - //~^ ERROR operation will panic -} diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-1.rs b/tests/ui/numbers-arithmetic/overflowing-lsh-1.rs deleted file mode 100644 index 0d300709be21f..0000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-1.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ build-fail -//@ compile-flags: -C debug-assertions - -#![deny(arithmetic_overflow)] - -fn main() { - let _x = 1_i32 << 32; - //~^ ERROR: this arithmetic operation will overflow -} diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-1.stderr b/tests/ui/numbers-arithmetic/overflowing-lsh-1.stderr deleted file mode 100644 index 5d2c4a6c8e270..0000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-1.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: this arithmetic operation will overflow - --> $DIR/overflowing-lsh-1.rs:7:14 - | -LL | let _x = 1_i32 << 32; - | ^^^^^^^^^^^ attempt to shift left by `32_i32`, which would overflow - | -note: the lint level is defined here - --> $DIR/overflowing-lsh-1.rs:4:9 - | -LL | #![deny(arithmetic_overflow)] - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-2.rs b/tests/ui/numbers-arithmetic/overflowing-lsh-2.rs deleted file mode 100644 index 6d7be30d3027d..0000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-2.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ build-fail -//@ compile-flags: -C debug-assertions - -#![deny(arithmetic_overflow)] - -fn main() { - let _x = 1 << -1; - //~^ ERROR: this arithmetic operation will overflow -} diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-2.stderr b/tests/ui/numbers-arithmetic/overflowing-lsh-2.stderr deleted file mode 100644 index 8ac72aefe0dc0..0000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-2.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: this arithmetic operation will overflow - --> $DIR/overflowing-lsh-2.rs:7:14 - | -LL | let _x = 1 << -1; - | ^^^^^^^ attempt to shift left by `-1_i32`, which would overflow - | -note: the lint level is defined here - --> $DIR/overflowing-lsh-2.rs:4:9 - | -LL | #![deny(arithmetic_overflow)] - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-3.rs b/tests/ui/numbers-arithmetic/overflowing-lsh-3.rs deleted file mode 100644 index 65f536f627d49..0000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-3.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ build-fail -//@ compile-flags: -C debug-assertions - -#![deny(arithmetic_overflow)] - -fn main() { - let _x = 1_u64 << 64; - //~^ ERROR: this arithmetic operation will overflow -} diff --git a/tests/ui/numbers-arithmetic/overflowing-lsh-3.stderr b/tests/ui/numbers-arithmetic/overflowing-lsh-3.stderr deleted file mode 100644 index 43d541b030433..0000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-lsh-3.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: this arithmetic operation will overflow - --> $DIR/overflowing-lsh-3.rs:7:14 - | -LL | let _x = 1_u64 << 64; - | ^^^^^^^^^^^ attempt to shift left by `64_i32`, which would overflow - | -note: the lint level is defined here - --> $DIR/overflowing-lsh-3.rs:4:9 - | -LL | #![deny(arithmetic_overflow)] - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/numbers-arithmetic/overflowing-neg.rs b/tests/ui/numbers-arithmetic/overflowing-neg.rs deleted file mode 100644 index ab49662b98f9f..0000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-neg.rs +++ /dev/null @@ -1,10 +0,0 @@ -//@ run-fail -//@ error-pattern:attempt to negate with overflow -//@ ignore-emscripten no processes -//@ compile-flags: -C debug-assertions - -#![allow(arithmetic_overflow)] - -fn main() { - let _x = -i8::MIN; -} diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-1.rs b/tests/ui/numbers-arithmetic/overflowing-rsh-1.rs deleted file mode 100644 index 20971e4807e15..0000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-1.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ build-fail -//@ compile-flags: -C debug-assertions - -#![deny(arithmetic_overflow)] - -fn main() { - let _x = -1_i32 >> 32; - //~^ ERROR: this arithmetic operation will overflow -} diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-1.stderr b/tests/ui/numbers-arithmetic/overflowing-rsh-1.stderr deleted file mode 100644 index 62763e9e1df8b..0000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-1.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: this arithmetic operation will overflow - --> $DIR/overflowing-rsh-1.rs:7:14 - | -LL | let _x = -1_i32 >> 32; - | ^^^^^^^^^^^^ attempt to shift right by `32_i32`, which would overflow - | -note: the lint level is defined here - --> $DIR/overflowing-rsh-1.rs:4:9 - | -LL | #![deny(arithmetic_overflow)] - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-2.rs b/tests/ui/numbers-arithmetic/overflowing-rsh-2.rs deleted file mode 100644 index c9829ad27938e..0000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-2.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ build-fail -//@ compile-flags: -C debug-assertions - -#![deny(arithmetic_overflow)] - -fn main() { - let _x = -1_i32 >> -1; - //~^ ERROR: this arithmetic operation will overflow -} diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-2.stderr b/tests/ui/numbers-arithmetic/overflowing-rsh-2.stderr deleted file mode 100644 index 519e62fef7d89..0000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-2.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: this arithmetic operation will overflow - --> $DIR/overflowing-rsh-2.rs:7:14 - | -LL | let _x = -1_i32 >> -1; - | ^^^^^^^^^^^^ attempt to shift right by `-1_i32`, which would overflow - | -note: the lint level is defined here - --> $DIR/overflowing-rsh-2.rs:4:9 - | -LL | #![deny(arithmetic_overflow)] - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-3.rs b/tests/ui/numbers-arithmetic/overflowing-rsh-3.rs deleted file mode 100644 index e2de731e9abd7..0000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-3.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ build-fail -//@ compile-flags: -C debug-assertions - -#![deny(arithmetic_overflow)] - -fn main() { - let _x = -1_i64 >> 64; - //~^ ERROR: this arithmetic operation will overflow -} diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-3.stderr b/tests/ui/numbers-arithmetic/overflowing-rsh-3.stderr deleted file mode 100644 index de24ea1fcde93..0000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-3.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: this arithmetic operation will overflow - --> $DIR/overflowing-rsh-3.rs:7:14 - | -LL | let _x = -1_i64 >> 64; - | ^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow - | -note: the lint level is defined here - --> $DIR/overflowing-rsh-3.rs:4:9 - | -LL | #![deny(arithmetic_overflow)] - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error - diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-5.rs b/tests/ui/numbers-arithmetic/overflowing-rsh-5.rs deleted file mode 100644 index 8088ee58ea822..0000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-5.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@ build-fail -//@ compile-flags: -C debug-assertions - -#![deny(arithmetic_overflow)] - -fn main() { - let _n = 1i64 >> [64][0]; - //~^ ERROR: this arithmetic operation will overflow -} diff --git a/tests/ui/numbers-arithmetic/overflowing-rsh-5.stderr b/tests/ui/numbers-arithmetic/overflowing-rsh-5.stderr deleted file mode 100644 index e9a1572d3cc9d..0000000000000 --- a/tests/ui/numbers-arithmetic/overflowing-rsh-5.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: this arithmetic operation will overflow - --> $DIR/overflowing-rsh-5.rs:7:14 - | -LL | let _n = 1i64 >> [64][0]; - | ^^^^^^^^^^^^^^^ attempt to shift right by `64_i32`, which would overflow - | -note: the lint level is defined here - --> $DIR/overflowing-rsh-5.rs:4:9 - | -LL | #![deny(arithmetic_overflow)] - | ^^^^^^^^^^^^^^^^^^^ - -error: aborting due to 1 previous error -