Skip to content

Commit 1f420b9

Browse files
committed
Allow mutable borrows in constant bodies
1 parent d24ae25 commit 1f420b9

File tree

1 file changed

+4
-0
lines changed
  • src/librustc_mir/transform/check_consts

1 file changed

+4
-0
lines changed

src/librustc_mir/transform/check_consts/ops.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ impl NonConstOp for Loop {
183183
#[derive(Debug)]
184184
pub struct MutBorrow(pub BorrowKind);
185185
impl NonConstOp for MutBorrow {
186+
fn feature_gate(tcx: TyCtxt<'_>) -> Option<bool> {
187+
Some(tcx.features().const_mut_refs)
188+
}
189+
186190
fn emit_error(&self, item: &Item<'_, '_>, span: Span) {
187191
let kind = self.0;
188192
if let BorrowKind::Mut { .. } = kind {

0 commit comments

Comments
 (0)