Skip to content

Commit 122c6fe

Browse files
Stop emitting error in qualify_consts if promotion fails
1 parent 46b68b0 commit 122c6fe

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/librustc_mir/transform/qualify_consts.rs

+3-11
Original file line numberDiff line numberDiff line change
@@ -1599,20 +1599,12 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> {
15991599
// This is not a problem, because the argument explicitly
16001600
// requests constness, in contrast to regular promotion
16011601
// which happens even without the user requesting it.
1602-
// We can error out with a hard error if the argument is not
1603-
// constant here.
1602+
//
1603+
// `promote_consts` is responsible for emitting the error if
1604+
// the argument is not promotable.
16041605
if !IsNotPromotable::in_operand(self, arg) {
16051606
debug!("visit_terminator_kind: candidate={:?}", candidate);
16061607
self.promotion_candidates.push(candidate);
1607-
} else {
1608-
if is_shuffle {
1609-
span_err!(self.tcx.sess, self.span, E0526,
1610-
"shuffle indices are not constant");
1611-
} else {
1612-
self.tcx.sess.span_err(self.span,
1613-
&format!("argument {} is required to be a constant",
1614-
i + 1));
1615-
}
16161608
}
16171609
}
16181610
}

0 commit comments

Comments
 (0)