I have observed that MIRAI fails to report any warnings when a potential error depends on a value derived from RefCell inside an immediate closure.
Normally, using RefCell results in a "possible attempt" warning due to the uncertainty introduced by interior mutability. However, when this logic is wrapped in a closure (|| { ... })(), the warning is completely suppressed (total silence), rather than being reported as "possible".
To Reproduce
pub fn mul_overflows(cond: std::cell::RefCell<&bool>) -> u64 {
let cond = **cond.borrow();
(|| {
let a: u64 = if cond { 0x8000000000000000 } else { 1 };
a * 2
})()
}
pub fn main() {
mul_overflows(std::cell::RefCell::from(&(true)));
}
Expected Behavior
MIRAI should report a warning (likely possible attempt ...), consistent with the behavior when the code is not wrapped in a closure.
Actual Behavior
MIRAI reports zero warnings.
I have observed that MIRAI fails to report any warnings when a potential error depends on a value derived from
RefCellinside an immediate closure.Normally, using
RefCellresults in a "possible attempt" warning due to the uncertainty introduced by interior mutability. However, when this logic is wrapped in a closure(|| { ... })(), the warning is completely suppressed (total silence), rather than being reported as "possible".To Reproduce
Expected Behavior
MIRAI should report a warning (likely
possible attempt ...), consistent with the behavior when the code is not wrapped in a closure.Actual Behavior
MIRAI reports zero warnings.