about summary refs log tree commit diff
path: root/src/libsyntax/ext/tt/macro_parser.rs
diff options
context:
space:
mode:
authorJulien Cretin <cretin@google.com>2019-05-29 20:29:51 +0200
committerJulien Cretin <cretin@google.com>2019-07-19 19:59:11 +0200
commit82abc0db816e7441a0d89a3eaa51f439a03f4506 (patch)
tree9674a3548e72a1b15ef4a05022ebd2dd6cfa36ad /src/libsyntax/ext/tt/macro_parser.rs
parent527dce7137f7a3c7bf47d9a503abf25f88ea22de (diff)
downloadrust-82abc0db816e7441a0d89a3eaa51f439a03f4506.tar.gz
rust-82abc0db816e7441a0d89a3eaa51f439a03f4506.zip
Remember the span of the Kleene operator in macros
This is needed for having complete error messages where reporting macro variable
errors. Here is what they would look like:

error: meta-variable repeats with different kleene operator
  --> $DIR/issue-61053-different-kleene.rs:3:57
   |
LL |     ( $( $i:ident = $($j:ident),+ );* ) => { $( $( $i = $j; )* )* };
   |                                 - expected repetition   ^^   - conflicting repetition
Diffstat (limited to 'src/libsyntax/ext/tt/macro_parser.rs')
-rw-r--r--src/libsyntax/ext/tt/macro_parser.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index fc8aa4793bc..ae1979540ff 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -557,8 +557,8 @@ fn inner_parse_loop<'root, 'tt>(
                     // implicitly disallowing OneOrMore from having 0 matches here. Thus, that will
                     // result in a "no rules expected token" error by virtue of this matcher not
                     // working.
-                    if seq.op == quoted::KleeneOp::ZeroOrMore
-                        || seq.op == quoted::KleeneOp::ZeroOrOne
+                    if seq.kleene.op == quoted::KleeneOp::ZeroOrMore
+                        || seq.kleene.op == quoted::KleeneOp::ZeroOrOne
                     {
                         let mut new_item = item.clone();
                         new_item.match_cur += seq.num_captures;
@@ -573,7 +573,7 @@ fn inner_parse_loop<'root, 'tt>(
                     cur_items.push(MatcherPosHandle::Box(Box::new(MatcherPos {
                         stack: smallvec![],
                         sep: seq.separator.clone(),
-                        seq_op: Some(seq.op),
+                        seq_op: Some(seq.kleene.op),
                         idx: 0,
                         matches,
                         match_lo: item.match_cur,