Rollup merge of #128978 - compiler-errors:assert-matches, r=jieyouxu
Use `assert_matches` around the compiler more It's a useful assertion, especially since it actually prints out the LHS.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
//! The `Visitor` responsible for actually checking a `mir::Body` for invalid operations.
|
||||
|
||||
use std::assert_matches::assert_matches;
|
||||
use std::mem;
|
||||
use std::ops::Deref;
|
||||
|
||||
@@ -590,7 +591,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
|
||||
if is_int_bool_or_char(lhs_ty) && is_int_bool_or_char(rhs_ty) {
|
||||
// Int, bool, and char operations are fine.
|
||||
} else if lhs_ty.is_fn_ptr() || lhs_ty.is_unsafe_ptr() {
|
||||
assert!(matches!(
|
||||
assert_matches!(
|
||||
op,
|
||||
BinOp::Eq
|
||||
| BinOp::Ne
|
||||
@@ -599,7 +600,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
|
||||
| BinOp::Ge
|
||||
| BinOp::Gt
|
||||
| BinOp::Offset
|
||||
));
|
||||
);
|
||||
|
||||
self.check_op(ops::RawPtrComparison);
|
||||
} else if lhs_ty.is_floating_point() || rhs_ty.is_floating_point() {
|
||||
|
||||
Reference in New Issue
Block a user