Skip to content

Commit

Permalink
Stop emitting error in qualify_consts if promotion fails
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed Oct 29, 2019
1 parent 46b68b0 commit 122c6fe
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/librustc_mir/transform/qualify_consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1599,20 +1599,12 @@ impl<'a, 'tcx> Visitor<'tcx> for Checker<'a, 'tcx> {
// This is not a problem, because the argument explicitly
// requests constness, in contrast to regular promotion
// which happens even without the user requesting it.
// We can error out with a hard error if the argument is not
// constant here.
//
// `promote_consts` is responsible for emitting the error if
// the argument is not promotable.
if !IsNotPromotable::in_operand(self, arg) {
debug!("visit_terminator_kind: candidate={:?}", candidate);
self.promotion_candidates.push(candidate);
} else {
if is_shuffle {
span_err!(self.tcx.sess, self.span, E0526,
"shuffle indices are not constant");
} else {
self.tcx.sess.span_err(self.span,
&format!("argument {} is required to be a constant",
i + 1));
}
}
}
}
Expand Down

0 comments on commit 122c6fe

Please sign in to comment.