Skip to content

Commit

Permalink
promote_consts: fail fast if there are no candidates
Browse files Browse the repository at this point in the history
  • Loading branch information
tesuji committed Jun 1, 2024
1 parent 0bc0f68 commit 9a1a5a2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compiler/rustc_mir_transform/src/promote_consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,11 @@ fn promote_candidates<'tcx>(
// Visit candidates in reverse, in case they're nested.
debug!(promote_candidates = ?candidates);

// eagerly fail fast
if candidates.is_empty() {
return IndexVec::new();
}

let mut promotions = IndexVec::new();

let mut extra_statements = vec![];
Expand Down

0 comments on commit 9a1a5a2

Please sign in to comment.