about summary refs log tree commit diff
path: root/src/librustc_parse
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-12-02 21:56:11 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-12-02 22:13:13 +0300
commit498737c8e9cf52be1bde3bef7ffa24a3d0540257 (patch)
treed9138a2f9d99deec3d024bf9811702df66abdd70 /src/librustc_parse
parentcf71538094b03c9c7116eceabc4985ab3b5e558a (diff)
Address review comments
Diffstat (limited to 'src/librustc_parse')
-rw-r--r--src/librustc_parse/lib.rs2
-rw-r--r--src/librustc_parse/parser/mod.rs3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/librustc_parse/lib.rs b/src/librustc_parse/lib.rs
index 3924da5ca67..a22b383e5f3 100644
--- a/src/librustc_parse/lib.rs
+++ b/src/librustc_parse/lib.rs
@@ -277,6 +277,8 @@ pub fn parse_in_attr<'a, T>(
 ) -> PResult<'a, T> {
     let mut parser = Parser::new(
         sess,
+        // FIXME(#66940, Centril | petrochenkov): refactor this function so it doesn't
+        // require reconstructing and immediately re-parsing delimiters.
         attr.get_normal_item().args.outer_tokens(),
         None,
         false,
diff --git a/src/librustc_parse/parser/mod.rs b/src/librustc_parse/parser/mod.rs
index a5cacc110ce..28689720044 100644
--- a/src/librustc_parse/parser/mod.rs
+++ b/src/librustc_parse/parser/mod.rs
@@ -1024,7 +1024,8 @@ impl<'a> Parser<'a> {
                        self.check(&token::OpenDelim(DelimToken::Brace)) {
             match self.parse_token_tree() {
                 TokenTree::Delimited(dspan, delim, tokens) =>
-                    MacArgs::Delimited(dspan, MacDelimiter::from_token(delim), tokens),
+                    // We've confirmed above that there is a delimiter so unwrapping is OK.
+                    MacArgs::Delimited(dspan, MacDelimiter::from_token(delim).unwrap(), tokens),
                 _ => unreachable!(),
             }
         } else if !delimited_only {