We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent de60f72 commit d92e9b7Copy full SHA for d92e9b7
src/librustc_mir/transform/check_consts/ops.rs
@@ -216,7 +216,11 @@ impl NonConstOp for MutBorrow {
216
217
#[derive(Debug)]
218
pub struct MutDeref;
219
-impl NonConstOp for MutDeref {}
+impl NonConstOp for MutDeref {
220
+ fn feature_gate(tcx: TyCtxt<'_>) -> Option<bool> {
221
+ Some(tcx.features().const_mut_refs)
222
+ }
223
+}
224
225
226
pub struct Panic;
src/test/ui/consts/const-mut-refs/const_mut_refs.rs
@@ -7,7 +7,9 @@ struct Foo {
7
}
8
9
const fn bar(foo: &mut Foo) -> usize {
10
- foo.x + 1
+ let x = &mut foo.x;
11
+ *x = 1;
12
+ *x
13
14
15
fn main() {
0 commit comments