chore: replace panic! with internal_error

This commit is contained in:
Jarl André Hübenthal 2023-04-21 19:57:14 +02:00
parent f6221fb9e9
commit 8bf888a5e6
No known key found for this signature in database
8 changed files with 27 additions and 17 deletions

View file

@ -1378,31 +1378,31 @@ pub fn canonicalize_expr<'a>(
// Below this point, we shouln't see any of these nodes anymore because
// operator desugaring should have removed them!
bad_expr @ ast::Expr::ParensAround(_) => {
panic!(
internal_error!(
"A ParensAround did not get removed during operator desugaring somehow: {:#?}",
bad_expr
);
}
bad_expr @ ast::Expr::SpaceBefore(_, _) => {
panic!(
internal_error!(
"A SpaceBefore did not get removed during operator desugaring somehow: {:#?}",
bad_expr
);
}
bad_expr @ ast::Expr::SpaceAfter(_, _) => {
panic!(
internal_error!(
"A SpaceAfter did not get removed during operator desugaring somehow: {:#?}",
bad_expr
);
}
bad_expr @ ast::Expr::BinOps { .. } => {
panic!(
internal_error!(
"A binary operator chain did not get desugared somehow: {:#?}",
bad_expr
);
}
bad_expr @ ast::Expr::UnaryOp(_, _) => {
panic!(
internal_error!(
"A unary operator did not get desugared somehow: {:#?}",
bad_expr
);
@ -1814,7 +1814,7 @@ fn canonicalize_field<'a>(
// A label with no value, e.g. `{ name }` (this is sugar for { name: name })
LabelOnly(_) => {
panic!("Somehow a LabelOnly record field was not desugared!");
internal_error!("Somehow a LabelOnly record field was not desugared!");
}
SpaceBefore(sub_field, _) | SpaceAfter(sub_field, _) => {
@ -1822,7 +1822,7 @@ fn canonicalize_field<'a>(
}
Malformed(_string) => {
panic!("TODO canonicalize malformed record field");
internal_error!("TODO canonicalize malformed record field");
}
}
}