From 580d357b5adef605fc731d295ca53ab8532e26fb Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Tue, 9 Nov 2021 16:13:44 +1100 Subject: [PATCH] Change the `assert` in `is_useful` to a `debug_assert`. It's hot in the `match-stress-enum` benchmark. --- compiler/rustc_mir_build/src/thir/pattern/usefulness.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs b/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs index d959d2f7f6f3f..067b0506e308c 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/usefulness.rs @@ -797,7 +797,7 @@ fn is_useful<'p, 'tcx>( return ret; } - assert!(rows.iter().all(|r| r.len() == v.len())); + debug_assert!(rows.iter().all(|r| r.len() == v.len())); let ty = v.head().ty(); let is_non_exhaustive = cx.is_foreign_non_exhaustive_enum(ty);