about summary refs log tree commit diff
path: root/library/std/src/sys/unix/stack_overflow.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
commitf66af286411956386da9dbb3ca1527ae271ab618 (patch)
tree220d9d35726ba549bd1fde56ca4ff04b52617ab3 /library/std/src/sys/unix/stack_overflow.rs
parentf32191f78f389169701d0820985e5e8f1fc9c2e7 (diff)
parent8cf35643106bba09b5d6c71ceac74dc58573f371 (diff)
downloadrust-f66af286411956386da9dbb3ca1527ae271ab618.tar.gz
rust-f66af286411956386da9dbb3ca1527ae271ab618.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 'library/std/src/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions