use TokenStream rather than &[TokenTree] for built-in macros
That way, we don't loose the jointness info
This commit is contained in:
parent
b3146549ab
commit
fa893a3225
20 changed files with 109 additions and 113 deletions
|
|
@ -57,12 +57,12 @@ extern crate rustc;
|
|||
extern crate rustc_driver;
|
||||
|
||||
use syntax::parse::token::{self, Token};
|
||||
use syntax::tokenstream::TokenTree;
|
||||
use syntax::tokenstream::{TokenTree, TokenStream};
|
||||
use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacEager};
|
||||
use syntax_pos::Span;
|
||||
use rustc_driver::plugin::Registry;
|
||||
|
||||
fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
|
||||
fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: TokenStream)
|
||||
-> Box<dyn MacResult + 'static> {
|
||||
|
||||
static NUMERALS: &'static [(&'static str, usize)] = &[
|
||||
|
|
@ -78,7 +78,7 @@ fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
|
|||
return DummyResult::any(sp);
|
||||
}
|
||||
|
||||
let text = match args[0] {
|
||||
let text = match args.into_trees().next().unwrap() {
|
||||
TokenTree::Token(Token { kind: token::Ident(s, _), .. }) => s.to_string(),
|
||||
_ => {
|
||||
cx.span_err(sp, "argument should be a single identifier");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue