]> git.lizzy.rs Git - rust.git/blobdiff - src/libsyntax/ext/quote.rs
Auto merge of #30641 - tsion:match-range, r=eddyb
[rust.git] / src / libsyntax / ext / quote.rs
index 5e5b815818161de75828c14193a6c4511d8de809..7a1a207a562a1dd23200ef4d0d54d8220bb80b2f 100644 (file)
@@ -8,7 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use ast::{self, Arg, Arm, Block, Expr, Item, Pat, Path, Stmt, TokenTree, Ty};
+use ast::{self, Arg, Arm, Block, Expr, Item, Pat, Stmt, TokenTree, Ty};
 use codemap::Span;
 use ext::base::ExtCtxt;
 use ext::base;
@@ -33,7 +33,7 @@ pub mod rt {
     use ptr::P;
     use std::rc::Rc;
 
-    use ast::{TokenTree, Expr};
+    use ast::TokenTree;
 
     pub use parse::new_parser_from_tts;
     pub use codemap::{BytePos, Span, dummy_spanned, DUMMY_SP};
@@ -178,7 +178,7 @@ fn to_tokens(&self, cx: &ExtCtxt) -> Vec<TokenTree> {
                     let mut v = vec![];
                     for (i, x) in self.iter().enumerate() {
                         if i > 0 {
-                            v.push_all(&$sep);
+                            v.extend_from_slice(&$sep);
                         }
                         v.extend(x.to_tokens(cx));
                     }
@@ -242,6 +242,7 @@ fn to_tokens(&self, cx: &ExtCtxt) -> Vec<TokenTree> {
                 id: ast::DUMMY_NODE_ID,
                 node: ast::ExprLit(P(self.clone())),
                 span: DUMMY_SP,
+                attrs: None,
             }).to_tokens(cx)
         }
     }
@@ -801,7 +802,7 @@ fn parse_arguments_to_quote(cx: &ExtCtxt, tts: &[TokenTree])
 
     let cx_expr = panictry!(p.parse_expr());
     if !panictry!(p.eat(&token::Comma)) {
-        panic!(p.fatal("expected token `,`"));
+        let _ = p.diagnostic().fatal("expected token `,`");
     }
 
     let tts = panictry!(p.parse_all_token_trees());