Skip to content

Commit

Permalink
Don't panic on unsupport logical operators
Browse files Browse the repository at this point in the history
`todo!` panics, causing the entire language server to crash rather than failing
gracefully on functions containing these operators.
  • Loading branch information
dschoepe committed Feb 2, 2025
1 parent 7a3e0bf commit 33e2d52
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions crates/hir-ty/src/mir/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1032,13 +1032,13 @@ impl<'ctx> MirLowerCtx<'ctx> {
syntax::ast::LogicOp::And => 0,
syntax::ast::LogicOp::Or => 1,
syntax::ast::LogicOp::Imply => {
todo!()
not_supported!("not yet implemented")
}
syntax::ast::LogicOp::RevImply => {
todo!()
not_supported!("not yet implemented")
}
syntax::ast::LogicOp::Iff => {
todo!()
not_supported!("not yet implemented")
}
};
let start_of_then = self.new_basic_block();
Expand Down Expand Up @@ -1077,9 +1077,9 @@ impl<'ctx> MirLowerCtx<'ctx> {
hir_def::hir::BinaryOp::LogicOp(op) => match op {
hir_def::hir::LogicOp::And => BinOp::BitAnd, // FIXME: make these short circuit
hir_def::hir::LogicOp::Or => BinOp::BitOr,
hir_def::hir::LogicOp::Imply => todo!(),
hir_def::hir::LogicOp::RevImply => todo!(),
hir_def::hir::LogicOp::Iff => todo!(),
hir_def::hir::LogicOp::Imply => not_supported!("not yet implemented"),
hir_def::hir::LogicOp::RevImply => not_supported!("not yet implemented"),
hir_def::hir::LogicOp::Iff => not_supported!("not yet implemented"),
},
hir_def::hir::BinaryOp::ArithOp(op) => BinOp::from(op),
hir_def::hir::BinaryOp::CmpOp(op) => BinOp::from(op),
Expand Down

0 comments on commit 33e2d52

Please sign in to comment.