Use assert_matches around the compiler

This commit is contained in:
Michael Goulet 2024-08-11 12:10:36 -04:00
parent 68d2e8a66e
commit c361c924a0
39 changed files with 100 additions and 49 deletions

View file

@ -1,3 +1,5 @@
use std::assert_matches::assert_matches;
use libc::{c_char, c_uint};
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
use rustc_codegen_ssa::mir::operand::OperandValue;
@ -89,7 +91,7 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> {
// if the target feature needed by the register class is
// disabled. This is necessary otherwise LLVM will try
// to actually allocate a register for the dummy output.
assert!(matches!(reg, InlineAsmRegOrRegClass::Reg(_)));
assert_matches!(reg, InlineAsmRegOrRegClass::Reg(_));
clobbers.push(format!("~{}", reg_to_llvm(reg, None)));
continue;
} else {

View file

@ -1,3 +1,4 @@
use std::assert_matches::assert_matches;
use std::cmp::Ordering;
use rustc_codegen_ssa::base::{compare_simd_types, wants_msvc_seh, wants_wasm_eh};
@ -1142,7 +1143,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>(
if cfg!(debug_assertions) {
for (ty, arg) in arg_tys.iter().zip(args) {
if ty.is_simd() {
assert!(matches!(arg.val, OperandValue::Immediate(_)));
assert_matches!(arg.val, OperandValue::Immediate(_));
}
}
}

View file

@ -8,6 +8,7 @@
#![allow(internal_features)]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![doc(rust_logo)]
#![feature(assert_matches)]
#![feature(exact_size_is_empty)]
#![feature(extern_types)]
#![feature(hash_raw_entry)]