1
Fork 0
rust/compiler/rustc_lint/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
..
nonstandard_style
array_into_iter.rs Link to edition guide instead of issues for 2021 lints. 2021-08-09 17:45:01 +02:00
builtin.rs feature(const_generics) -> feature(const_param_types) 2021-08-30 11:00:21 +02:00
context.rs rustc_target: require TyAbiInterface in LayoutOf. 2021-08-27 13:09:32 +03:00
early.rs Add additional missing lint handling logic 2021-07-17 23:03:58 -05:00
internal.rs Auto merge of #86827 - camsteffen:hash-lint-resolved, r=oli-obk 2021-07-13 15:06:10 +00:00
late.rs Treat macros as HIR items 2021-08-28 00:16:34 -07:00
levels.rs Treat macros as HIR items 2021-08-28 00:16:34 -07:00
lib.rs Warn when [T; N].into_iter() is ambiguous in the new edition. 2021-08-30 21:27:31 +02:00
methods.rs Fix doctest 2020-10-26 18:19:49 -04:00
non_ascii_idents.rs Stablize non_ascii_idents feature. 2021-04-08 02:52:00 +08:00
non_fmt_panic.rs Auto merge of #88083 - m-ou-se:non-fmt-panics-suggest-debug, r=estebank 2021-08-17 16:43:40 +00:00
nonstandard_style.rs Fix more “a”/“an” typos 2021-08-22 17:27:18 +02:00
noop_method_call.rs review 2021-08-26 11:14:31 +02:00
passes.rs Add inferred args to typeck 2021-07-25 07:28:51 +00:00
redundant_semicolon.rs Lint on redundant trailing semicolon after item 2020-12-29 16:30:02 -05:00
tests.rs Update to last upstream version 2021-07-08 17:14:28 +02:00
traits.rs Rollup merge of #86747 - FabianWolff:issue-86653, r=GuillaumeGomez 2021-08-22 20:52:50 +02:00
types.rs make unevaluated const substs optional 2021-08-26 11:00:30 +02:00
unused.rs Handle let-else initializer edge case errors 2021-08-30 20:18:42 -05:00