rust/compiler/rustc_middle/src
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
..
dep_graph Update DepNode's size 2021-07-10 21:46:31 +08:00
hir Remove obsolete MacroDef variant of OwnerNode 2021-08-28 00:24:30 -07:00
ich rename assert_matches module 2021-07-16 09:18:14 -07:00
infer Miscellaneous inlining improvements 2021-06-02 08:49:58 +02:00
middle Auto merge of #87739 - Aaron1011:remove-used-attrs, r=wesleywiser 2021-08-24 03:58:22 +00:00
mir Rollup merge of #86362 - ptrojahn:insert_vars_and_temps, r=jackh726 2021-08-31 17:54:53 +02:00
query Auto merge of #87280 - lcnr:lazy-anon-const-default-substs, r=nikomatsakis 2021-08-26 22:26:23 +00:00
traits Enforce diverging let...else 2021-08-30 20:18:42 -05:00
ty Rollup merge of #88486 - bjorn3:better_arena_macro, r=jackh726 2021-08-31 10:41:25 +02:00
util Make panic/assert calls in rustc compatible with Rust 2021. 2021-02-03 22:42:53 +01:00
arena.rs Remove unused arena macro args 2021-08-30 13:09:38 +02:00
lib.rs Use if-let guards in the codebase 2021-08-25 20:24:35 +02:00
lint.rs Rename force-warns to force-warn 2021-07-21 15:41:10 +02:00
macros.rs Auto merge of #78779 - LeSeulArtichaut:ty-visitor-return, r=oli-obk 2020-11-17 12:24:34 +00:00
tests.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
thir.rs Various pattern cleanups 2021-08-25 20:24:39 +02:00