Skip to content

[arithmetic_side_effects] Fix #10590 #10615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions clippy_lints/src/operators/arithmetic_side_effects.rs
Original file line number Diff line number Diff line change
@@ -185,6 +185,34 @@ impl ArithmeticSideEffects {
}
}

/// There are some integer methods like `wrapping_div` that will panic depending on the
/// provided input.
fn manage_method_call<'tcx>(
&mut self,
args: &[hir::Expr<'tcx>],
cx: &LateContext<'tcx>,
ps: &hir::PathSegment<'tcx>,
receiver: &hir::Expr<'tcx>,
) {
const METHODS: &[&str] = &["saturating_div", "wrapping_div", "wrapping_rem", "wrapping_rem_euclid"];
let Some(arg) = args.first() else { return; };
if constant_simple(cx, cx.typeck_results(), receiver).is_some() {
return;
}
let instance_ty = cx.typeck_results().expr_ty(receiver);
if !Self::is_integral(instance_ty) {
return;
}
if METHODS.iter().copied().all(|method| method != ps.ident.as_str()) {
return;
}
let (actual_arg, _) = peel_hir_expr_refs(arg);
match Self::literal_integer(cx, actual_arg) {
None | Some(0) => self.issue_lint(cx, arg),
Some(_) => {},
}
}

fn manage_unary_ops<'tcx>(
&mut self,
cx: &LateContext<'tcx>,
@@ -224,6 +252,9 @@ impl<'tcx> LateLintPass<'tcx> for ArithmeticSideEffects {
hir::ExprKind::AssignOp(op, lhs, rhs) | hir::ExprKind::Binary(op, lhs, rhs) => {
self.manage_bin_ops(cx, expr, op, lhs, rhs);
},
hir::ExprKind::MethodCall(ps, receiver, args, _) => {
self.manage_method_call(args, cx, ps, receiver);
},
hir::ExprKind::Unary(un_op, un_expr) => {
self.manage_unary_ops(cx, expr, un_expr, *un_op);
},
22 changes: 22 additions & 0 deletions tests/ui/arithmetic_side_effects.rs
Original file line number Diff line number Diff line change
@@ -276,6 +276,17 @@ pub fn non_overflowing_ops_or_ops_already_handled_by_the_compiler_should_not_tri
_n = &1 * _n;
_n = 23 + 85;

// Method
_n.saturating_div(1);
_n.wrapping_div(1);
_n.wrapping_rem(1);
_n.wrapping_rem_euclid(1);

_n.saturating_div(1);
_n.checked_div(1);
_n.checked_rem(1);
_n.checked_rem_euclid(1);

// Unary
_n = -2147483647;
_n = -i32::MAX;
@@ -383,6 +394,17 @@ pub fn unknown_ops_or_runtime_ops_that_can_overflow() {
_custom = Custom << _custom;
_custom = &Custom << _custom;

// Method
_n.saturating_div(0);
_n.wrapping_div(0);
_n.wrapping_rem(0);
_n.wrapping_rem_euclid(0);

_n.saturating_div(_n);
_n.wrapping_div(_n);
_n.wrapping_rem(_n);
_n.wrapping_rem_euclid(_n);

// Unary
_n = -_n;
_n = -&_n;
268 changes: 158 additions & 110 deletions tests/ui/arithmetic_side_effects.stderr
Original file line number Diff line number Diff line change
@@ -1,658 +1,706 @@
error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:293:5
--> $DIR/arithmetic_side_effects.rs:304:5
|
LL | _n += 1;
| ^^^^^^^
|
= note: `-D clippy::arithmetic-side-effects` implied by `-D warnings`

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:294:5
--> $DIR/arithmetic_side_effects.rs:305:5
|
LL | _n += &1;
| ^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:295:5
--> $DIR/arithmetic_side_effects.rs:306:5
|
LL | _n -= 1;
| ^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:296:5
--> $DIR/arithmetic_side_effects.rs:307:5
|
LL | _n -= &1;
| ^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:297:5
--> $DIR/arithmetic_side_effects.rs:308:5
|
LL | _n /= 0;
| ^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:298:5
--> $DIR/arithmetic_side_effects.rs:309:5
|
LL | _n /= &0;
| ^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:299:5
--> $DIR/arithmetic_side_effects.rs:310:5
|
LL | _n %= 0;
| ^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:300:5
--> $DIR/arithmetic_side_effects.rs:311:5
|
LL | _n %= &0;
| ^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:301:5
--> $DIR/arithmetic_side_effects.rs:312:5
|
LL | _n *= 2;
| ^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:302:5
--> $DIR/arithmetic_side_effects.rs:313:5
|
LL | _n *= &2;
| ^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:303:5
--> $DIR/arithmetic_side_effects.rs:314:5
|
LL | _n += -1;
| ^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:304:5
--> $DIR/arithmetic_side_effects.rs:315:5
|
LL | _n += &-1;
| ^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:305:5
--> $DIR/arithmetic_side_effects.rs:316:5
|
LL | _n -= -1;
| ^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:306:5
--> $DIR/arithmetic_side_effects.rs:317:5
|
LL | _n -= &-1;
| ^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:307:5
--> $DIR/arithmetic_side_effects.rs:318:5
|
LL | _n /= -0;
| ^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:308:5
--> $DIR/arithmetic_side_effects.rs:319:5
|
LL | _n /= &-0;
| ^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:309:5
--> $DIR/arithmetic_side_effects.rs:320:5
|
LL | _n %= -0;
| ^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:310:5
--> $DIR/arithmetic_side_effects.rs:321:5
|
LL | _n %= &-0;
| ^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:311:5
--> $DIR/arithmetic_side_effects.rs:322:5
|
LL | _n *= -2;
| ^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:312:5
--> $DIR/arithmetic_side_effects.rs:323:5
|
LL | _n *= &-2;
| ^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:313:5
--> $DIR/arithmetic_side_effects.rs:324:5
|
LL | _custom += Custom;
| ^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:314:5
--> $DIR/arithmetic_side_effects.rs:325:5
|
LL | _custom += &Custom;
| ^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:315:5
--> $DIR/arithmetic_side_effects.rs:326:5
|
LL | _custom -= Custom;
| ^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:316:5
--> $DIR/arithmetic_side_effects.rs:327:5
|
LL | _custom -= &Custom;
| ^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:317:5
--> $DIR/arithmetic_side_effects.rs:328:5
|
LL | _custom /= Custom;
| ^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:318:5
--> $DIR/arithmetic_side_effects.rs:329:5
|
LL | _custom /= &Custom;
| ^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:319:5
--> $DIR/arithmetic_side_effects.rs:330:5
|
LL | _custom %= Custom;
| ^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:320:5
--> $DIR/arithmetic_side_effects.rs:331:5
|
LL | _custom %= &Custom;
| ^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:321:5
--> $DIR/arithmetic_side_effects.rs:332:5
|
LL | _custom *= Custom;
| ^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:322:5
--> $DIR/arithmetic_side_effects.rs:333:5
|
LL | _custom *= &Custom;
| ^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:323:5
--> $DIR/arithmetic_side_effects.rs:334:5
|
LL | _custom >>= Custom;
| ^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:324:5
--> $DIR/arithmetic_side_effects.rs:335:5
|
LL | _custom >>= &Custom;
| ^^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:325:5
--> $DIR/arithmetic_side_effects.rs:336:5
|
LL | _custom <<= Custom;
| ^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:326:5
--> $DIR/arithmetic_side_effects.rs:337:5
|
LL | _custom <<= &Custom;
| ^^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:327:5
--> $DIR/arithmetic_side_effects.rs:338:5
|
LL | _custom += -Custom;
| ^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:328:5
--> $DIR/arithmetic_side_effects.rs:339:5
|
LL | _custom += &-Custom;
| ^^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:329:5
--> $DIR/arithmetic_side_effects.rs:340:5
|
LL | _custom -= -Custom;
| ^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:330:5
--> $DIR/arithmetic_side_effects.rs:341:5
|
LL | _custom -= &-Custom;
| ^^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:331:5
--> $DIR/arithmetic_side_effects.rs:342:5
|
LL | _custom /= -Custom;
| ^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:332:5
--> $DIR/arithmetic_side_effects.rs:343:5
|
LL | _custom /= &-Custom;
| ^^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:333:5
--> $DIR/arithmetic_side_effects.rs:344:5
|
LL | _custom %= -Custom;
| ^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:334:5
--> $DIR/arithmetic_side_effects.rs:345:5
|
LL | _custom %= &-Custom;
| ^^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:335:5
--> $DIR/arithmetic_side_effects.rs:346:5
|
LL | _custom *= -Custom;
| ^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:336:5
--> $DIR/arithmetic_side_effects.rs:347:5
|
LL | _custom *= &-Custom;
| ^^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:337:5
--> $DIR/arithmetic_side_effects.rs:348:5
|
LL | _custom >>= -Custom;
| ^^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:338:5
--> $DIR/arithmetic_side_effects.rs:349:5
|
LL | _custom >>= &-Custom;
| ^^^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:339:5
--> $DIR/arithmetic_side_effects.rs:350:5
|
LL | _custom <<= -Custom;
| ^^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:340:5
--> $DIR/arithmetic_side_effects.rs:351:5
|
LL | _custom <<= &-Custom;
| ^^^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:343:10
--> $DIR/arithmetic_side_effects.rs:354:10
|
LL | _n = _n + 1;
| ^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:344:10
--> $DIR/arithmetic_side_effects.rs:355:10
|
LL | _n = _n + &1;
| ^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:345:10
--> $DIR/arithmetic_side_effects.rs:356:10
|
LL | _n = 1 + _n;
| ^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:346:10
--> $DIR/arithmetic_side_effects.rs:357:10
|
LL | _n = &1 + _n;
| ^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:347:10
--> $DIR/arithmetic_side_effects.rs:358:10
|
LL | _n = _n - 1;
| ^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:348:10
--> $DIR/arithmetic_side_effects.rs:359:10
|
LL | _n = _n - &1;
| ^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:349:10
--> $DIR/arithmetic_side_effects.rs:360:10
|
LL | _n = 1 - _n;
| ^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:350:10
--> $DIR/arithmetic_side_effects.rs:361:10
|
LL | _n = &1 - _n;
| ^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:351:10
--> $DIR/arithmetic_side_effects.rs:362:10
|
LL | _n = _n / 0;
| ^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:352:10
--> $DIR/arithmetic_side_effects.rs:363:10
|
LL | _n = _n / &0;
| ^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:353:10
--> $DIR/arithmetic_side_effects.rs:364:10
|
LL | _n = _n % 0;
| ^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:354:10
--> $DIR/arithmetic_side_effects.rs:365:10
|
LL | _n = _n % &0;
| ^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:355:10
--> $DIR/arithmetic_side_effects.rs:366:10
|
LL | _n = _n * 2;
| ^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:356:10
--> $DIR/arithmetic_side_effects.rs:367:10
|
LL | _n = _n * &2;
| ^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:357:10
--> $DIR/arithmetic_side_effects.rs:368:10
|
LL | _n = 2 * _n;
| ^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:358:10
--> $DIR/arithmetic_side_effects.rs:369:10
|
LL | _n = &2 * _n;
| ^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:359:10
--> $DIR/arithmetic_side_effects.rs:370:10
|
LL | _n = 23 + &85;
| ^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:360:10
--> $DIR/arithmetic_side_effects.rs:371:10
|
LL | _n = &23 + 85;
| ^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:361:10
--> $DIR/arithmetic_side_effects.rs:372:10
|
LL | _n = &23 + &85;
| ^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:362:15
--> $DIR/arithmetic_side_effects.rs:373:15
|
LL | _custom = _custom + _custom;
| ^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:363:15
--> $DIR/arithmetic_side_effects.rs:374:15
|
LL | _custom = _custom + &_custom;
| ^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:364:15
--> $DIR/arithmetic_side_effects.rs:375:15
|
LL | _custom = Custom + _custom;
| ^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:365:15
--> $DIR/arithmetic_side_effects.rs:376:15
|
LL | _custom = &Custom + _custom;
| ^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:366:15
--> $DIR/arithmetic_side_effects.rs:377:15
|
LL | _custom = _custom - Custom;
| ^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:367:15
--> $DIR/arithmetic_side_effects.rs:378:15
|
LL | _custom = _custom - &Custom;
| ^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:368:15
--> $DIR/arithmetic_side_effects.rs:379:15
|
LL | _custom = Custom - _custom;
| ^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:369:15
--> $DIR/arithmetic_side_effects.rs:380:15
|
LL | _custom = &Custom - _custom;
| ^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:370:15
--> $DIR/arithmetic_side_effects.rs:381:15
|
LL | _custom = _custom / Custom;
| ^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:371:15
--> $DIR/arithmetic_side_effects.rs:382:15
|
LL | _custom = _custom / &Custom;
| ^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:372:15
--> $DIR/arithmetic_side_effects.rs:383:15
|
LL | _custom = _custom % Custom;
| ^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:373:15
--> $DIR/arithmetic_side_effects.rs:384:15
|
LL | _custom = _custom % &Custom;
| ^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:374:15
--> $DIR/arithmetic_side_effects.rs:385:15
|
LL | _custom = _custom * Custom;
| ^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:375:15
--> $DIR/arithmetic_side_effects.rs:386:15
|
LL | _custom = _custom * &Custom;
| ^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:376:15
--> $DIR/arithmetic_side_effects.rs:387:15
|
LL | _custom = Custom * _custom;
| ^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:377:15
--> $DIR/arithmetic_side_effects.rs:388:15
|
LL | _custom = &Custom * _custom;
| ^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:378:15
--> $DIR/arithmetic_side_effects.rs:389:15
|
LL | _custom = Custom + &Custom;
| ^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:379:15
--> $DIR/arithmetic_side_effects.rs:390:15
|
LL | _custom = &Custom + Custom;
| ^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:380:15
--> $DIR/arithmetic_side_effects.rs:391:15
|
LL | _custom = &Custom + &Custom;
| ^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:381:15
--> $DIR/arithmetic_side_effects.rs:392:15
|
LL | _custom = _custom >> _custom;
| ^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:382:15
--> $DIR/arithmetic_side_effects.rs:393:15
|
LL | _custom = _custom >> &_custom;
| ^^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:383:15
--> $DIR/arithmetic_side_effects.rs:394:15
|
LL | _custom = Custom << _custom;
| ^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:384:15
--> $DIR/arithmetic_side_effects.rs:395:15
|
LL | _custom = &Custom << _custom;
| ^^^^^^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:387:10
--> $DIR/arithmetic_side_effects.rs:398:23
|
LL | _n.saturating_div(0);
| ^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:399:21
|
LL | _n.wrapping_div(0);
| ^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:400:21
|
LL | _n.wrapping_rem(0);
| ^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:401:28
|
LL | _n.wrapping_rem_euclid(0);
| ^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:403:23
|
LL | _n.saturating_div(_n);
| ^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:404:21
|
LL | _n.wrapping_div(_n);
| ^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:405:21
|
LL | _n.wrapping_rem(_n);
| ^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:406:28
|
LL | _n.wrapping_rem_euclid(_n);
| ^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:409:10
|
LL | _n = -_n;
| ^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:388:10
--> $DIR/arithmetic_side_effects.rs:410:10
|
LL | _n = -&_n;
| ^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:389:15
--> $DIR/arithmetic_side_effects.rs:411:15
|
LL | _custom = -_custom;
| ^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:390:15
--> $DIR/arithmetic_side_effects.rs:412:15
|
LL | _custom = -&_custom;
| ^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:399:5
--> $DIR/arithmetic_side_effects.rs:421:5
|
LL | 1 + i;
| ^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:400:5
--> $DIR/arithmetic_side_effects.rs:422:5
|
LL | i * 2;
| ^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:401:5
--> $DIR/arithmetic_side_effects.rs:423:5
|
LL | 1 % i / 2;
| ^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:402:5
--> $DIR/arithmetic_side_effects.rs:424:5
|
LL | i - 2 + 2 - i;
| ^^^^^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:403:5
--> $DIR/arithmetic_side_effects.rs:425:5
|
LL | -i;
| ^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:414:5
--> $DIR/arithmetic_side_effects.rs:436:5
|
LL | i += 1;
| ^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:415:5
--> $DIR/arithmetic_side_effects.rs:437:5
|
LL | i -= 1;
| ^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:416:5
--> $DIR/arithmetic_side_effects.rs:438:5
|
LL | i *= 2;
| ^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:418:5
--> $DIR/arithmetic_side_effects.rs:440:5
|
LL | i /= 0;
| ^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:420:5
--> $DIR/arithmetic_side_effects.rs:442:5
|
LL | i /= var1;
| ^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:421:5
--> $DIR/arithmetic_side_effects.rs:443:5
|
LL | i /= var2;
| ^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:423:5
--> $DIR/arithmetic_side_effects.rs:445:5
|
LL | i %= 0;
| ^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:425:5
--> $DIR/arithmetic_side_effects.rs:447:5
|
LL | i %= var1;
| ^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:426:5
--> $DIR/arithmetic_side_effects.rs:448:5
|
LL | i %= var2;
| ^^^^^^^^^

error: arithmetic operation that can potentially result in unexpected side-effects
--> $DIR/arithmetic_side_effects.rs:436:5
--> $DIR/arithmetic_side_effects.rs:458:5
|
LL | 10 / a
| ^^^^^^

error: aborting due to 109 previous errors
error: aborting due to 117 previous errors