diff --git a/tests/ui/infinite_loop.rs b/tests/ui/infinite_loop.rs index d86e6c042b3..cc694583eec 100644 --- a/tests/ui/infinite_loop.rs +++ b/tests/ui/infinite_loop.rs @@ -94,8 +94,22 @@ fn used_immutable() { } } +use std::cell::Cell; + +fn maybe_i_mutate(i: &Cell) { unimplemented!() } + +fn internally_mutable() { + let b = Cell::new(true); + + while b.get() { // b cannot be silently coerced to `bool` + maybe_i_mutate(&b); + println!("OK - Method call within condition"); + } +} + fn main() { immutable_condition(); unused_var(); used_immutable(); + internally_mutable(); }