Closed
Description
#[derive(Debug)]
enum Thing {
// variant A has interior mutability
A(std::cell::Cell<bool>),
// variant B clearly does not
B,
}
impl Thing {
// declare_interior_mutable_const triggers here
pub const BB: Thing = Thing::B;
}
fn main() {
// borrow_interior_mutable_const triggers here
println!("Thing::BB = {:?}", Thing::BB);
}
I realize that it isn't possible to know if the thing on the rhs of a const declaration is interior mutable or not without full const evaluation, but trivial cases such as the example shouldn't be too difficult.