diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-12-19 16:24:06 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-02-27 09:47:22 +1100 |
| commit | a8364f3b2ad63c19037bdf060e49ad9ca07e16b6 (patch) | |
| tree | d1bcb36f85666127d1461d5faf49394810e3dfad /compiler/rustc_interface/src/errors.rs | |
| parent | ac91805f3179fc2225c60e8ccf5a1daa09d43f3d (diff) | |
| download | rust-a8364f3b2ad63c19037bdf060e49ad9ca07e16b6.tar.gz rust-a8364f3b2ad63c19037bdf060e49ad9ca07e16b6.zip | |
In `AssocOp::AssignOp`, use `BinOpKind` instead of `BinOpToken`
`AssocOp::AssignOp` contains a `BinOpToken`. `ExprKind::AssignOp` contains a `BinOpKind`. Given that `AssocOp` is basically a cut-down version of `ExprKind`, it makes sense to make `AssocOp` more like `ExprKind`. Especially given that `AssocOp` and `BinOpKind` use semantic operation names (e.g. `Mul`, `Div`), but `BinOpToken` uses syntactic names (e.g. `Star`, `Slash`). This results in more concise code, and removes the need for various conversions. (Note that the removed functions `hirbinop2assignop` and `astbinop2assignop` are semantically identical, because `hir::BinOp` is just a synonum for `ast::BinOp`!) The only downside to this is that it allows the possibility of some nonsensical combinations, such as `AssocOp::AssignOp(BinOpKind::Lt)`. But `ExprKind::AssignOp` already has that problem. The problem can be fixed for both types in the future with some effort, by introducing an `AssignOpKind` type.
Diffstat (limited to 'compiler/rustc_interface/src/errors.rs')
0 files changed, 0 insertions, 0 deletions
