about summary refs log tree commit diff
path: root/compiler/rustc_mir/src/transform/coverage/debug.rs
diff options
context:
space:
mode:
authorJonas Schievink <jonasschievink@gmail.com>2020-11-15 13:39:48 +0100
committerGitHub <noreply@github.com>2020-11-15 13:39:48 +0100
commit27a15721c56db1e2a88b52a394844a8c5f61eb65 (patch)
tree6441fe913d6157d33c80c38dcdc444036fd1f960 /compiler/rustc_mir/src/transform/coverage/debug.rs
parent0c7a48c5f0863843ee2002d40f2bc08ae3777bd9 (diff)
parent864e554b9a994f9448a6acb956d77838b949fe6e (diff)
downloadrust-27a15721c56db1e2a88b52a394844a8c5f61eb65.tar.gz
rust-27a15721c56db1e2a88b52a394844a8c5f61eb65.zip
Rollup merge of #79016 - fanzier:underscore-expressions, r=petrochenkov
Make `_` an expression, to discard values in destructuring assignments

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

With this PR, an underscore `_` is parsed as an expression but is allowed *only* on the left-hand side of a destructuring assignment. There it simply discards a value, similarly to the wildcard `_` in patterns. For instance,
```rust
(a, _) = (1, 2)
```
will simply assign 1 to `a` and discard the 2. Note that for consistency,
```
_ = foo
```
is also allowed and equivalent to just `foo`.

Thanks to ````@varkor```` who helped with the implementation, particularly around pre-expansion gating.

r? ````@petrochenkov````
Diffstat (limited to 'compiler/rustc_mir/src/transform/coverage/debug.rs')
0 files changed, 0 insertions, 0 deletions