]> git.lizzy.rs Git - rust.git/commitdiff
Use `bug!` instead of `panic!`
authorCamelid <37223377+camelid@users.noreply.github.com>
Mon, 1 Jun 2020 17:52:07 +0000 (10:52 -0700)
committerGitHub <noreply@github.com>
Mon, 1 Jun 2020 17:52:07 +0000 (10:52 -0700)
Co-authored-by: varkor <github@varkor.com>
src/librustc_typeck/astconv.rs

index 9b47c4c7dde700b11c0096fce401d86eea789924..7173ed3d24ec84d763b1985d4137a0880207788f 100644 (file)
@@ -489,7 +489,9 @@ fn generic_arg_mismatch_err(sess: &Session, arg: &GenericArg<'_>, kind: &'static
             "lifetime" => ParamKindOrd::Lifetime,
             "type" => ParamKindOrd::Type,
             "constant" => ParamKindOrd::Const,
-            _ => panic!(),
+            // It's more concise to match on the string representation, though it means
+            // the match is non-exhaustive.
+            _ => bug!("invalid generic parameter kind"),
         };
         let arg_ord = match arg {
             GenericArg::Lifetime(_) => ParamKindOrd::Lifetime,