X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc_mir%2Ftransform%2Fqualify_consts.rs;h=5463b9444731f8c40657f0b156c6ef5609dd3d16;hb=6c1b220fd747bf244f04b380e4d4ae005068f706;hp=3702dd9ad493fb3df20685c10d22e8addca7b8bb;hpb=ffc6225cd2db1d9634259aef38fd0197b12aacf9;p=rust.git diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 3702dd9ad49..5463b944473 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -564,6 +564,7 @@ fn in_call( | "transmute" | "simd_insert" | "simd_extract" + | "ptr_offset_from" => return true, _ => {} @@ -1606,20 +1607,12 @@ fn visit_terminator_kind(&mut self, // 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)); - } } } }