rust/compiler
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
..
rustc
rustc_apfloat
rustc_arena Remove unused arena macro args 2021-08-30 13:09:38 +02:00
rustc_ast Handle let-else initializer edge case errors 2021-08-30 20:18:42 -05:00
rustc_ast_lowering Auto merge of #87688 - camsteffen:let-else, r=cjgillot 2021-09-01 01:02:42 +00:00
rustc_ast_passes Rollup merge of #88418 - fee1-dead:trait-assoc-tilde-const, r=oli-obk 2021-08-31 17:54:56 +02:00
rustc_ast_pretty Add let-else to AST 2021-08-30 20:17:45 -05:00
rustc_attr
rustc_builtin_macros Add let-else to AST 2021-08-30 20:17:45 -05:00
rustc_codegen_cranelift rustc_target: TyAndLayout::field should never error. 2021-08-30 00:44:09 +03:00
rustc_codegen_llvm Auto merge of #88337 - eddyb:field-failure-is-not-an-option, r=nagisa 2021-08-29 22:54:26 +00:00
rustc_codegen_ssa Auto merge of #88506 - Mark-Simulacrum:fix-rlibs, r=ehuss 2021-08-31 19:33:06 +00:00
rustc_data_structures Rollup merge of #88492 - est31:maybe_uninit_write, r=wesleywiser 2021-08-31 10:41:26 +02:00
rustc_driver
rustc_error_codes feature(const_param_types) -> feature(adt_const_params) 2021-08-30 12:07:36 +02:00
rustc_errors
rustc_expand Add let-else to AST 2021-08-30 20:17:45 -05:00
rustc_feature Add let_else feature gate 2021-08-30 20:18:39 -05:00
rustc_fs_util
rustc_graphviz
rustc_hir Rollup merge of #88486 - bjorn3:better_arena_macro, r=jackh726 2021-08-31 10:41:25 +02:00
rustc_hir_pretty Remove obsolete MacroDef variant of OwnerNode 2021-08-28 00:24:30 -07:00
rustc_incremental
rustc_index
rustc_infer Enforce diverging let...else 2021-08-30 20:18:42 -05:00
rustc_interface
rustc_lexer
rustc_lint Auto merge of #87688 - camsteffen:let-else, r=cjgillot 2021-09-01 01:02:42 +00:00
rustc_lint_defs Tracking issue for UNSUPPORTED_CALLING_CONVENTIONS 2021-08-27 20:47:00 +03:00
rustc_llvm
rustc_macros
rustc_metadata Treat macros as HIR items 2021-08-28 00:16:34 -07:00
rustc_middle Auto merge of #87688 - camsteffen:let-else, r=cjgillot 2021-09-01 01:02:42 +00:00
rustc_mir Auto merge of #88533 - oli-obk:tait_🧊, r=spastorino 2021-08-31 22:15:26 +00:00
rustc_mir_build Handle irrufutable or unreachable let-else 2021-08-30 20:18:43 -05:00
rustc_parse Auto merge of #87688 - camsteffen:let-else, r=cjgillot 2021-09-01 01:02:42 +00:00
rustc_parse_format
rustc_passes Auto merge of #88337 - eddyb:field-failure-is-not-an-option, r=nagisa 2021-08-29 22:54:26 +00:00
rustc_plugin_impl
rustc_privacy rename const_evaluatable_checked to generic_const_exprs 2021-08-30 11:00:21 +02:00
rustc_query_impl
rustc_query_system
rustc_resolve Add let-else to AST 2021-08-30 20:17:45 -05:00
rustc_save_analysis Treat macros as HIR items 2021-08-28 00:16:34 -07:00
rustc_serialize
rustc_session Remove Session.if_let_suggestions 2021-08-27 18:28:22 -05:00
rustc_span Auto merge of #87688 - camsteffen:let-else, r=cjgillot 2021-09-01 01:02:42 +00:00
rustc_symbol_mangling Rollup merge of #85534 - csmoe:demagnle-assert, r=michaelwoerister 2021-08-29 16:25:28 +02:00
rustc_target Disallow the aapcs CC on Aarch64 2021-08-30 13:46:07 +03:00
rustc_trait_selection Enforce diverging let...else 2021-08-30 20:18:42 -05:00
rustc_traits
rustc_ty_utils
rustc_type_ir
rustc_typeck Auto merge of #87688 - camsteffen:let-else, r=cjgillot 2021-09-01 01:02:42 +00:00