1
Fork 0

Rollup merge of #111004 - clubby789:migrate-mir-transform, r=oli-obk

Migrate `mir_transform` to translatable diagnostics

cc #100717
This commit is contained in:
Michael Goulet 2023-05-08 09:30:22 -07:00 committed by GitHub
commit 68594142b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 470 additions and 200 deletions

View file

@ -1,6 +1,6 @@
//! Lowers intrinsic calls
use crate::MirPass;
use crate::{errors, MirPass};
use rustc_middle::mir::*;
use rustc_middle::ty::subst::SubstsRef;
use rustc_middle::ty::{self, Ty, TyCtxt};
@ -310,11 +310,7 @@ fn resolve_rust_intrinsic<'tcx>(
}
fn validate_simd_shuffle<'tcx>(tcx: TyCtxt<'tcx>, args: &[Operand<'tcx>], span: Span) {
match &args[2] {
Operand::Constant(_) => {} // all good
_ => {
let msg = "last argument of `simd_shuffle` is required to be a `const` item";
tcx.sess.span_err(span, msg);
}
if !matches!(args[2], Operand::Constant(_)) {
tcx.sess.emit_err(errors::SimdShuffleLastConst { span });
}
}