1
Fork 0

Do not allow arbitrary mutable references in static mut, just keep with the existing exceptions

This commit is contained in:
oli 2021-01-16 18:06:12 +00:00
parent 00e62fabf1
commit 14f39aa81a

View file

@ -274,12 +274,8 @@ impl NonConstOp for CellBorrow {
pub struct MutBorrow(pub hir::BorrowKind); pub struct MutBorrow(pub hir::BorrowKind);
impl NonConstOp for MutBorrow { impl NonConstOp for MutBorrow {
fn status_in_item(&self, ccx: &ConstCx<'_, '_>) -> Status { fn status_in_item(&self, _ccx: &ConstCx<'_, '_>) -> Status {
match ccx.const_kind() { Status::Forbidden
// Mutable statics can handle mutable references in their final value
hir::ConstContext::Static(hir::Mutability::Mut) => Status::Allowed,
_ => Status::Forbidden,
}
} }
fn importance(&self) -> DiagnosticImportance { fn importance(&self) -> DiagnosticImportance {