diff options
| author | Christian Poveda <christianpoveda@protonmail.com> | 2019-11-21 14:33:39 -0500 |
|---|---|---|
| committer | Christian Poveda <christianpoveda@protonmail.com> | 2019-12-02 09:03:41 -0500 |
| commit | 1f420b9891c962656eac16831c772cbd56afff24 (patch) | |
| tree | fd20e9fb7a16a2965e29a295b70a3e901fd556fc | |
| parent | d24ae2577fad83d581d090816303b0f1842f1514 (diff) | |
| download | rust-1f420b9891c962656eac16831c772cbd56afff24.tar.gz rust-1f420b9891c962656eac16831c772cbd56afff24.zip | |
Allow mutable borrows in constant bodies
| -rw-r--r-- | src/librustc_mir/transform/check_consts/ops.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/librustc_mir/transform/check_consts/ops.rs b/src/librustc_mir/transform/check_consts/ops.rs index a4f12a4e54f..117d628af25 100644 --- a/src/librustc_mir/transform/check_consts/ops.rs +++ b/src/librustc_mir/transform/check_consts/ops.rs @@ -183,6 +183,10 @@ impl NonConstOp for Loop { #[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 { |
