Skip to content

Commit 316a401

Browse files
committed
Document our sanity assertion around explicit promotion
1 parent f5c3315 commit 316a401

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/librustc_mir/transform/promote_consts.rs

+4
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,10 @@ pub fn validate_candidates(
736736

737737
let is_promotable = validator.validate_candidate(candidate).is_ok();
738738

739+
// If we use explicit validation, we carry the risk of turning a legitimate run-time
740+
// operation into a failing compile-time operation. Make sure that does not happen
741+
// by asserting that there is no possible run-time behavior here in case promotion
742+
// fails.
739743
if validator.explicit && !is_promotable {
740744
ccx.tcx.sess.delay_span_bug(
741745
ccx.body.span,

0 commit comments

Comments
 (0)