pub static CONST_EVAL_MUTABLE_PTR_IN_FINAL_VALUE: &'static Lint
Expand description
The const_eval_mutable_ptr_in_final_value
lint detects if a mutable pointer
has leaked into the final value of a const expression.
§Example
pub enum JsValue {
Undefined,
Object(std::cell::Cell<bool>),
}
impl ::std::ops::Drop for JsValue {
fn drop(&mut self) {}
}
const UNDEFINED: &JsValue = &JsValue::Undefined;
fn main() {
}
{{produces}}
§Explanation
In the 1.77 release, the const evaluation machinery adopted some stricter rules to reject expressions with values that could end up holding mutable references to state stored in static memory (which is inherently immutable).
This is a future-incompatible lint to ease the transition to an error. See issue #122153 for more details.