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,5 +1,7 @@
//! Miscellaneous type-system utilities that are too small to deserve their own modules.
use std::assert_matches::assert_matches;
use hir::LangItem;
use rustc_ast::Mutability;
use rustc_data_structures::fx::FxIndexSet;
@@ -92,7 +94,7 @@ pub fn type_allowed_to_implement_const_param_ty<'tcx>(
lang_item: LangItem,
parent_cause: ObligationCause<'tcx>,
) -> Result<(), ConstParamTyImplementationError<'tcx>> {
assert!(matches!(lang_item, LangItem::ConstParamTy | LangItem::UnsizedConstParamTy));
assert_matches!(lang_item, LangItem::ConstParamTy | LangItem::UnsizedConstParamTy);
let inner_tys: Vec<_> = match *self_type.kind() {
// Trivially okay as these types are all: