Do not allow arbitrary mutable references in static mut
, just keep with the existing exceptions
This commit is contained in:
parent
00e62fabf1
commit
14f39aa81a
1 changed files with 2 additions and 6 deletions
|
@ -274,12 +274,8 @@ impl NonConstOp for CellBorrow {
|
|||
pub struct MutBorrow(pub hir::BorrowKind);
|
||||
|
||||
impl NonConstOp for MutBorrow {
|
||||
fn status_in_item(&self, ccx: &ConstCx<'_, '_>) -> Status {
|
||||
match ccx.const_kind() {
|
||||
// Mutable statics can handle mutable references in their final value
|
||||
hir::ConstContext::Static(hir::Mutability::Mut) => Status::Allowed,
|
||||
_ => Status::Forbidden,
|
||||
}
|
||||
fn status_in_item(&self, _ccx: &ConstCx<'_, '_>) -> Status {
|
||||
Status::Forbidden
|
||||
}
|
||||
|
||||
fn importance(&self) -> DiagnosticImportance {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue