]> git.lizzy.rs Git - rust.git/commit
Rollup merge of #81869 - mark-i-m:leading-vert, r=petrochenkov
authorDylan DPC <dylan.dpc@gmail.com>
Wed, 17 Feb 2021 22:51:16 +0000 (23:51 +0100)
committerGitHub <noreply@github.com>
Wed, 17 Feb 2021 22:51:16 +0000 (23:51 +0100)
commit91e5384fc0d4b7babc360dca12c5a9d88332f13b
treec1c5d50bc96f0ada0f2491c7eaa94997c5861f37
parentd2232506629b3de71db97694889928bf91330566
parentaee1e59e6f00876a881e9d8c2ff00e0f11f896eb
Rollup merge of #81869 - mark-i-m:leading-vert, r=petrochenkov

Simplify pattern grammar, improve or-pattern diagnostics

This implements the change under FCP in https://github.com/rust-lang/rust/issues/81415. It allows nested or-patterns to contain a leading `|`, simplifying the [grammar for patterns](https://github.com/rust-lang/reference/pull/957/files?short_path=cc629f1#diff-cc629f15712821139bc706c63b3845ab59a008e2a998e08ffad42e3aebcbcbe2).

Along the way, we also improve the diagnostics around a few specially-handled cases, such as using `||` instead of `|`, using or-patterns in fn params, including the leading `|` in the pattern span, etc.

r? `@petrochenkov`
compiler/rustc_expand/src/expand.rs