Remove some unused lint allows

This commit is contained in:
bjorn3 2022-01-30 17:43:09 +01:00
parent 1b8ea0705e
commit 246998f5ec
3 changed files with 13 additions and 20 deletions

View File

@ -8,14 +8,14 @@ use rustc_middle::ty::subst::SubstsRef;
pub(crate) fn codegen_llvm_intrinsic_call<'tcx>(
fx: &mut FunctionCx<'_, '_, 'tcx>,
intrinsic: &str,
substs: SubstsRef<'tcx>,
_substs: SubstsRef<'tcx>,
args: &[mir::Operand<'tcx>],
destination: Option<(CPlace<'tcx>, BasicBlock)>,
) {
let ret = destination.unwrap().0;
intrinsic_match! {
fx, intrinsic, substs, args,
fx, intrinsic, args,
_ => {
fx.tcx.sess.warn(&format!("unsupported llvm intrinsic {}; replacing with trap", intrinsic));
crate::trap::trap_unimplemented(fx, intrinsic);

View File

@ -43,28 +43,21 @@ macro intrinsic_arg {
}
macro intrinsic_match {
($fx:expr, $intrinsic:expr, $substs:expr, $args:expr,
($fx:expr, $intrinsic:expr, $args:expr,
_ => $unknown:block;
$(
$($($name:tt).*)|+ $(if $cond:expr)?, ($($a:ident $arg:ident),*) $content:block;
)*) => {
let _ = $substs; // Silence warning when substs is unused.
match $intrinsic {
$(
$(intrinsic_pat!($($name).*))|* $(if $cond)? => {
#[allow(unused_parens, non_snake_case)]
{
if let [$($arg),*] = $args {
let ($($arg,)*) = (
$(intrinsic_arg!($a $fx, $arg),)*
);
#[warn(unused_parens, non_snake_case)]
{
$content
}
} else {
bug!("wrong number of args for intrinsic {:?}", $intrinsic);
}
if let [$($arg),*] = $args {
let ($($arg,)*) = (
$(intrinsic_arg!($a $fx, $arg),)*
);
$content
} else {
bug!("wrong number of args for intrinsic {:?}", $intrinsic);
}
}
)*
@ -357,7 +350,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
let usize_layout = fx.layout_of(fx.tcx.types.usize);
intrinsic_match! {
fx, intrinsic, substs, args,
fx, intrinsic, args,
_ => {
fx.tcx.sess.span_fatal(span, &format!("unsupported intrinsic {}", intrinsic));
};

View File

@ -68,13 +68,13 @@ macro simd_flt_binop($fx:expr, $op:ident($x:ident, $y:ident) -> $ret:ident) {
pub(super) fn codegen_simd_intrinsic_call<'tcx>(
fx: &mut FunctionCx<'_, '_, 'tcx>,
intrinsic: Symbol,
substs: SubstsRef<'tcx>,
_substs: SubstsRef<'tcx>,
args: &[mir::Operand<'tcx>],
ret: CPlace<'tcx>,
span: Span,
) {
intrinsic_match! {
fx, intrinsic, substs, args,
fx, intrinsic, args,
_ => {
fx.tcx.sess.span_fatal(span, &format!("Unknown SIMD intrinsic {}", intrinsic));
};