]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/borrow_check/mod.rs
0-length arrays can even be mutably promoted
[rust.git] / src / librustc_mir / borrow_check / mod.rs
index b3d7337cffe115b43ef5db31d68bcbf0a76b8dae..84e3ecd509687cba5a3dfc9fcded7513656cbf49 100644 (file)
@@ -1864,8 +1864,12 @@ fn is_mutable<'d>(
                     }),
                 }
             }
-            // promoteds may never be mutated
-            Place::Promoted(_) => bug!("encountered mutable promoted"),
+            // The rules for promotion are made by `qualify_consts`, there wouldn't even be a
+            // `Place::Promoted` if the promotion weren't 100% legal. So we just forward this
+            Place::Promoted(_) => Ok(RootPlace {
+                place,
+                is_local_mutation_allowed,
+            }),
             Place::Static(ref static_) => {
                 if self.tcx.is_static(static_.def_id) != Some(hir::Mutability::MutMutable) {
                     Err(place)