Skip to content

Commit c036594

Browse files
committed
promote_consts: eargerly return when there are no candidates
There is no need to do it when mustn't.
1 parent 2870891 commit c036594

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compiler/rustc_mir_transform/src/promote_consts.rs

+5
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,11 @@ fn promote_candidates<'tcx>(
970970
// Visit candidates in reverse, in case they're nested.
971971
debug!(promote_candidates = ?candidates);
972972

973+
// eagerly fail fast
974+
if candidates.is_empty() {
975+
return IndexVec::new();
976+
}
977+
973978
let mut promotions = IndexVec::new();
974979

975980
let mut extra_statements = vec![];

0 commit comments

Comments
 (0)