diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-08-26 22:14:31 +0200 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-08-26 22:14:31 +0200 |
| commit | 2bd27fbdfe309f3f6abd76f72f379247d49048b7 (patch) | |
| tree | 448aebcbf11a933e47906549f0f56952ee12d018 /src/libsyntax | |
| parent | acb11305e8d7298750797d45324c0ecb3cc6c256 (diff) | |
| download | rust-2bd27fbdfe309f3f6abd76f72f379247d49048b7.tar.gz rust-2bd27fbdfe309f3f6abd76f72f379247d49048b7.zip | |
parser: fix span for leading vert.
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/parse/parser/pat.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libsyntax/parse/parser/pat.rs b/src/libsyntax/parse/parser/pat.rs index f2e269e03ba..78c9a289b37 100644 --- a/src/libsyntax/parse/parser/pat.rs +++ b/src/libsyntax/parse/parser/pat.rs @@ -50,6 +50,7 @@ impl<'a> Parser<'a> { pub(super) fn parse_top_pat(&mut self, gate_or: GateOr) -> PResult<'a, P<Pat>> { // Allow a '|' before the pats (RFCs 1925, 2530, and 2535). let gated_leading_vert = self.eat_or_separator() && gate_or == GateOr::Yes; + let leading_vert_span = self.prev_span; // Parse the possibly-or-pattern. let pat = self.parse_pat_with_or(None, gate_or, RecoverComma::Yes)?; @@ -61,7 +62,7 @@ impl<'a> Parser<'a> { if gated_leading_vert { let mut or_pattern_spans = self.sess.gated_spans.or_patterns.borrow_mut(); if or_pattern_spans.is_empty() { - or_pattern_spans.push(self.prev_span); + or_pattern_spans.push(leading_vert_span); } } |
