Skip to content

Commit d7bf358

Browse files
committed
Be more explicit about what's skipped
1 parent 9872160 commit d7bf358

File tree

1 file changed

+32
-33
lines changed

1 file changed

+32
-33
lines changed

src/librustc_mir/transform/qualify_consts.rs

Lines changed: 32 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -366,42 +366,41 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
366366

367367
TerminatorKind::Return => {
368368
if self.tcx.sess.features_untracked().const_let {
369-
break;
370-
}
371-
// Check for unused values. This usually means
372-
// there are extra statements in the AST.
373-
for temp in mir.temps_iter() {
374-
if self.local_qualif[temp].is_none() {
375-
continue;
376-
}
377-
378-
let state = self.temp_promotion_state[temp];
379-
if let TempState::Defined { location, uses: 0 } = state {
380-
let data = &mir[location.block];
381-
let stmt_idx = location.statement_index;
382-
383-
// Get the span for the initialization.
384-
let source_info = if stmt_idx < data.statements.len() {
385-
data.statements[stmt_idx].source_info
386-
} else {
387-
data.terminator().source_info
388-
};
389-
self.span = source_info.span;
369+
// Check for unused values. This usually means
370+
// there are extra statements in the AST.
371+
for temp in mir.temps_iter() {
372+
if self.local_qualif[temp].is_none() {
373+
continue;
374+
}
390375

391-
// Treat this as a statement in the AST.
392-
self.statement_like();
376+
let state = self.temp_promotion_state[temp];
377+
if let TempState::Defined { location, uses: 0 } = state {
378+
let data = &mir[location.block];
379+
let stmt_idx = location.statement_index;
380+
381+
// Get the span for the initialization.
382+
let source_info = if stmt_idx < data.statements.len() {
383+
data.statements[stmt_idx].source_info
384+
} else {
385+
data.terminator().source_info
386+
};
387+
self.span = source_info.span;
388+
389+
// Treat this as a statement in the AST.
390+
self.statement_like();
391+
}
393392
}
394-
}
395393

396-
// Make sure there are no extra unassigned variables.
397-
self.qualif = Qualif::NOT_CONST;
398-
for index in mir.vars_iter() {
399-
if !self.const_fn_arg_vars.contains(index.index()) {
400-
debug!("unassigned variable {:?}", index);
401-
self.assign(&Place::Local(index), Location {
402-
block: bb,
403-
statement_index: usize::MAX,
404-
});
394+
// Make sure there are no extra unassigned variables.
395+
self.qualif = Qualif::NOT_CONST;
396+
for index in mir.vars_iter() {
397+
if !self.const_fn_arg_vars.contains(index.index()) {
398+
debug!("unassigned variable {:?}", index);
399+
self.assign(&Place::Local(index), Location {
400+
block: bb,
401+
statement_index: usize::MAX,
402+
});
403+
}
405404
}
406405
}
407406

0 commit comments

Comments
 (0)