about summary refs log tree commit diff
path: root/compiler/rustc_llvm/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-09-01 01:02:42 +0000
committerbors <bors@rust-lang.org>2021-09-01 01:02:42 +0000
commitc2a408840ad18f74280805535f0b7193528ff3df (patch)
tree5d8815373247ba476a90946678a2c19e713f8780 /compiler/rustc_llvm/src
parenta3956106d12cebec91be0637759e29ab6908b4cd (diff)
parent3ff1d6bbf427cfb3d504092c93f261b49577170e (diff)
downloadrust-c2a408840ad18f74280805535f0b7193528ff3df.tar.gz
rust-c2a408840ad18f74280805535f0b7193528ff3df.zip
Auto merge of #87688 - camsteffen:let-else, r=cjgillot
Introduce `let...else`

Tracking issue: #87335

The trickiest part for me was enforcing the diverging else block with clear diagnostics. Perhaps the obvious solution is to expand to `let _: ! = ..`, but I decided against this because, when a "mismatched type" error is found in typeck, there is no way to trace where in the HIR the expected type originated, AFAICT. In order to pass down this information, I believe we should introduce `Expectation::LetElseNever(HirId)` or maybe add `HirId` to `Expectation::HasType`, but I left that as a future enhancement. For now, I simply assert that the block is `!` with a custom `ObligationCauseCode`, and I think this is clear enough, at least to start. The downside here is that the error points at the entire block rather than the specific expression with the wrong type. I left a todo to this effect.

Overall, I believe this PR is feature-complete with regard to the RFC.
Diffstat (limited to 'compiler/rustc_llvm/src')
0 files changed, 0 insertions, 0 deletions