rust/compiler/rustc_expand/src
Mara Bos 755dd14e00
Rollup merge of #78836 - fanzier:struct-and-slice-destructuring, r=petrochenkov
Implement destructuring assignment for structs and slices

This is the second step towards implementing destructuring assignment (RFC: rust-lang/rfcs#2909, tracking issue: #71126). This PR is the second part of #71156, which was split up to allow for easier review.

Note that the first PR (#78748) is not merged yet, so it is included as the first commit in this one. I thought this would allow the review to start earlier because I have some time this weekend to respond to reviews. If ``@petrochenkov`` prefers to wait until the first PR is merged, I totally understand, of course.

This PR implements destructuring assignment for (tuple) structs and slices. In order to do this, the following *parser change* was necessary: struct expressions are not required to have a base expression, i.e. `Struct { a: 1, .. }` becomes legal (in order to act like a struct pattern).

Unfortunately, this PR slightly regresses the diagnostics implemented in #77283. However, it is only a missing help message in `src/test/ui/issues/issue-77218.rs`. Other instances of this diagnostic are not affected. Since I don't exactly understand how this help message works and how to fix it yet, I was hoping it's OK to regress this temporarily and fix it in a follow-up PR.

Thanks to ``@varkor`` who helped with the implementation, particularly around the struct rest changes.

r? ``@petrochenkov``
2020-11-12 19:46:09 +01:00
..
mbe rustc_ast: visit_mac -> visit_mac_call 2020-11-03 23:39:51 +03:00
mut_visit rustc_ast: visit_mac -> visit_mac_call 2020-11-03 23:39:51 +03:00
parse Move lexer unit tests to rustc_lexer 2020-08-30 19:53:36 +02:00
tokenstream mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
base.rs Use the right span for errors about #[deprecated] attributes. 2020-11-01 20:48:58 +01:00
build.rs Implement destructuring assignment for structs and slices 2020-11-11 12:10:52 +00:00
config.rs Auto merge of #78782 - petrochenkov:nodoctok, r=Aaron1011 2020-11-12 00:33:55 +00:00
expand.rs Auto merge of #78782 - petrochenkov:nodoctok, r=Aaron1011 2020-11-12 00:33:55 +00:00
lib.rs Remove redundant #![feature(...)] 's from compiler/ 2020-09-17 07:58:45 +02:00
mbe.rs Fix some more clippy warnings 2020-10-30 10:12:56 -04:00
module.rs Syntactically permit unsafety on mods 2020-09-10 06:56:33 -07:00
placeholders.rs Rollup merge of #78710 - petrochenkov:macvisit, r=davidtwco 2020-11-09 19:06:55 +01:00
proc_macro.rs Improve E0777 help message 2020-10-02 16:33:44 +02:00
proc_macro_server.rs Rollup merge of #75146 - tmiasko:range-overflow, r=Mark-Simulacrum 2020-09-16 01:30:30 +02:00
tests.rs mv compiler to compiler/ 2020-08-30 18:45:07 +03:00