We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
promote_consts
1 parent 9bb9833 commit 46b68b0Copy full SHA for 46b68b0
src/librustc_mir/transform/promote_consts.rs
@@ -743,7 +743,17 @@ pub fn validate_candidates(
743
// FIXME(eddyb) also emit the errors for shuffle indices
744
// and `#[rustc_args_required_const]` arguments here.
745
746
- validator.validate_candidate(candidate).is_ok()
+ let is_promotable = validator.validate_candidate(candidate).is_ok();
747
+ match candidate {
748
+ Candidate::Argument { bb, index } if !is_promotable => {
749
+ let span = body[bb].terminator().source_info.span;
750
+ let msg = format!("argument {} is required to be a constant", index + 1);
751
+ tcx.sess.span_err(span, &msg);
752
+ }
753
+ _ => ()
754
755
+
756
+ is_promotable
757
}).collect()
758
}
759
0 commit comments