Skip to content

Commit 9a1a5a2

Browse files
committed
promote_consts: fail fast if there are no candidates
1 parent 0bc0f68 commit 9a1a5a2

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)