Allow mutable borrows in constant bodies

This commit is contained in:
Christian Poveda 2019-11-21 14:33:39 -05:00
parent d24ae2577f
commit 1f420b9891

View File

@ -183,6 +183,10 @@ fn emit_error(&self, item: &Item<'_, '_>, span: Span) {
#[derive(Debug)]
pub struct MutBorrow(pub BorrowKind);
impl NonConstOp for MutBorrow {
fn feature_gate(tcx: TyCtxt<'_>) -> Option<bool> {
Some(tcx.features().const_mut_refs)
}
fn emit_error(&self, item: &Item<'_, '_>, span: Span) {
let kind = self.0;
if let BorrowKind::Mut { .. } = kind {