Skip to content

Commit 7d96f2c

Browse files
committed
Document qualify_consts more
1 parent f70abe8 commit 7d96f2c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/librustc_mir/transform/qualify_consts.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,16 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
247247
let mut dest = dest;
248248
let index = loop {
249249
match dest {
250+
// with `const_let` active, we treat all locals equal
250251
Place::Local(index) => break *index,
252+
// projections are transparent for assignments
253+
// we qualify the entire destination at once, even if just a field would have
254+
// stricter qualification
251255
Place::Projection(proj) => dest = &proj.base,
252256
Place::Promoted(..) => bug!("promoteds don't exist yet during promotion"),
253257
Place::Static(..) => {
254-
// Catch more errors in the destination.
258+
// Catch more errors in the destination. `visit_place` also checks that we
259+
// do not try to access statics from constants or try to mutate statics
255260
self.visit_place(
256261
dest,
257262
PlaceContext::MutatingUse(MutatingUseContext::Store),

0 commit comments

Comments
 (0)