about summary refs log tree commit diff
path: root/compiler/rustc_mir_build/src/builder/expr/stmt.rs
AgeCommit message (Collapse)AuthorLines
2025-06-23Add `#[loop_match]` for improved DFA codegenbjorn3-0/+3
Co-authored-by: Folkert de Vries <folkert@folkertdev.nl>
2025-04-03Tighten up assignment operator representations.Nicholas Nethercote-2/+8
In the AST, currently we use `BinOpKind` within `ExprKind::AssignOp` and `AssocOp::AssignOp`, even though this allows some nonsensical combinations. E.g. there is no `&&=` operator. Likewise for HIR and THIR. This commit introduces `AssignOpKind` which only includes the ten assignable operators, and uses it in `ExprKind::AssignOp` and `AssocOp::AssignOp`. (And does similar things for `hir::ExprKind` and `thir::ExprKind`.) This avoids the possibility of nonsensical combinations, as seen by the removal of the `bug!` case in `lang_item_for_binop`. The commit is mostly plumbing, including: - Adds an `impl From<AssignOpKind> for BinOpKind` (AST) and `impl From<AssignOp> for BinOp` (MIR/THIR). - `BinOpCategory` can now be created from both `BinOpKind` and `AssignOpKind`. - Replaces the `IsAssign` type with `Op`, which has more information and a few methods. - `suggest_swapping_lhs_and_rhs`: moves the condition to the call site, it's easier that way. - `check_expr_inner`: had to factor out some code into a separate method. I'm on the fence about whether avoiding the nonsensical combinations is worth the extra code.
2025-02-21Put a `BlockTailInfo` in `BlockFrame::TailExpr`.Nicholas Nethercote-2/+1
Because it has the same fields, and avoids the need to deconstruct the latter to construct the former.
2025-02-08Rustfmtbjorn3-5/+5
2024-12-17Rename `rustc_mir_build::build` to `builder`Zalathar-0/+196