about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Scherer <github35764891676564198441@oli-obk.de>2018-11-20 12:25:44 +0100
committerOliver Scherer <github35764891676564198441@oli-obk.de>2018-11-20 12:25:44 +0100
commit7d96f2c4814cdf07860d31e8e8b9695eb9628972 (patch)
tree7081ff4bdf88c0bbdeff02bc10ea0bc4079d4df8
parentf70abe8d07023bc58cac03a989ddbd37332fa10f (diff)
downloadrust-7d96f2c4814cdf07860d31e8e8b9695eb9628972.tar.gz
rust-7d96f2c4814cdf07860d31e8e8b9695eb9628972.zip
Document qualify_consts more
-rw-r--r--src/librustc_mir/transform/qualify_consts.rs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs
index 1371b9a9977..f8ecd963457 100644
--- a/src/librustc_mir/transform/qualify_consts.rs
+++ b/src/librustc_mir/transform/qualify_consts.rs
@@ -247,11 +247,16 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
             let mut dest = dest;
             let index = loop {
                 match dest {
+                    // with `const_let` active, we treat all locals equal
                     Place::Local(index) => break *index,
+                    // projections are transparent for assignments
+                    // we qualify the entire destination at once, even if just a field would have
+                    // stricter qualification
                     Place::Projection(proj) => dest = &proj.base,
                     Place::Promoted(..) => bug!("promoteds don't exist yet during promotion"),
                     Place::Static(..) => {
-                        // Catch more errors in the destination.
+                        // Catch more errors in the destination. `visit_place` also checks that we
+                        // do not try to access statics from constants or try to mutate statics
                         self.visit_place(
                             dest,
                             PlaceContext::MutatingUse(MutatingUseContext::Store),