promote_consts: eargerly return when there are no candidates

There is no need to do it when mustn't.
This commit is contained in:
Lzu Tao 2024-06-01 11:18:34 +00:00
parent 28708912fb
commit c03659443a

View file

@ -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![];