1
Fork 0

Further improve comments

This commit is contained in:
Jonas Schievink 2020-04-07 19:30:16 +02:00
parent b30d906a98
commit b8f416d67f

View file

@ -29,8 +29,9 @@ fn check_fn_for_unconditional_recursion<'tcx>(
) {
let self_calls = find_blocks_calling_self(tcx, &body, def_id);
// Stores a list of `Span`s for every basic block. Those are the spans of `Call` terminators
// where we know that one of them will definitely be reached.
// Stores a list of `Span`s for every basic block. Those are the spans of self-calls where we
// know that one of them will definitely be reached. If the list is empty, the block either
// wasn't processed yet or will not always go to a self-call.
let mut results = IndexVec::from_elem_n(vec![], body.basic_blocks().len());
// We start the analysis at the self calls and work backwards.
@ -51,7 +52,7 @@ fn check_fn_for_unconditional_recursion<'tcx>(
// If *all* successors of `bb` lead to a self-call, emit notes at all of their
// locations.
// Converging successors without unwind paths.
// Determine all "relevant" successors. We ignore successors only reached via unwinding.
let terminator = body[bb].terminator();
let relevant_successors = match &terminator.kind {
TerminatorKind::Call { destination: None, .. }