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);
|
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 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue