rust/compiler/rustc_parse/src/parser
bors c2a408840a 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.
2021-09-01 01:02:42 +00:00
..
attr_wrapper.rs Fix more “a”/“an” typos 2021-08-22 17:27:18 +02:00
attr.rs Recover from a misplaced inner doc comment 2021-07-02 11:47:26 -05:00
diagnostics.rs Use multispan suggestions more often 2021-07-30 09:26:31 -07:00
expr.rs Rollup merge of #88450 - notriddle:notriddle/maybe_whole_expr, r=cjgillot 2021-08-31 10:41:22 +02:00
generics.rs Require passing an AttrWrapper to collect_tokens_trailing_token 2021-02-13 12:07:15 -05:00
item.rs Remove box syntax from rustc_parse 2021-08-18 09:25:26 +02:00
mod.rs Auto merge of #88262 - klensy:pprust-cow, r=nagisa 2021-08-29 17:46:29 +00:00
nonterminal.rs Use if-let guards in the codebase 2021-08-25 20:24:35 +02:00
pat.rs Use multispan suggestions more often 2021-07-30 09:26:31 -07:00
path.rs Fix handling of unmatched angle brackets in parser 2021-06-05 00:31:28 +02:00
stmt.rs Handle let-else initializer edge case errors 2021-08-30 20:18:42 -05:00
ty.rs Introduce ~const 2021-08-27 05:07:37 +00:00