Fix more tests

This commit is contained in:
Mark Mansi 2018-01-26 17:08:50 -06:00
parent 5c4b4fe4d6
commit bd98a93558
3 changed files with 12 additions and 1 deletions

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(macro_at_most_once_rep)]
macro_rules! foo {
($(a)?) => {}
}

View File

@ -18,6 +18,7 @@
extern crate rustc;
extern crate rustc_plugin;
use syntax::feature_gate::Features;
use syntax::parse::token::{NtExpr, NtPat};
use syntax::ast::{Ident, Pat};
use syntax::tokenstream::{TokenTree};
@ -31,11 +32,17 @@
use syntax_pos::Span;
use rustc_plugin::Registry;
use std::cell::RefCell;
fn expand_mbe_matches(cx: &mut ExtCtxt, _: Span, args: &[TokenTree])
-> Box<MacResult + 'static> {
let mbe_matcher = quote_tokens!(cx, $$matched:expr, $$($$pat:pat)|+);
let mbe_matcher = quoted::parse(mbe_matcher.into_iter().collect(), true, cx.parse_sess);
let mbe_matcher = quoted::parse(mbe_matcher.into_iter().collect(),
true,
cx.parse_sess,
&RefCell::new(Features::new()),
&[]);
let map = match TokenTree::parse(cx, &mbe_matcher, args.iter().cloned().collect()) {
Success(map) => map,
Failure(_, tok) => {

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(macro_at_most_once_rep)]
macro_rules! foo {
($(a)?) => {}
}