diff options
| author | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2019-10-29 12:56:59 -0700 |
|---|---|---|
| committer | Dylan MacKenzie <ecstaticmorse@gmail.com> | 2019-10-29 13:58:17 -0700 |
| commit | 122c6fedf4929c262e73158f156c2446c4b8bb84 (patch) | |
| tree | 48aa0d0a457a232de656bb4ac05a09124cb8a41f | |
| parent | 46b68b009ba64330f6ad503a1882a7df637b1a86 (diff) | |
| download | rust-122c6fedf4929c262e73158f156c2446c4b8bb84.tar.gz rust-122c6fedf4929c262e73158f156c2446c4b8bb84.zip | |
Stop emitting error in `qualify_consts` if promotion fails
| -rw-r--r-- | src/librustc_mir/transform/qualify_consts.rs | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 2f77cd5ddf7..49805dfc026 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -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)); - } } } } |
