// force-host
+#![feature(dotdot_in_tuple_patterns)]
#![feature(plugin_registrar, quote, rustc_private)]
extern crate syntax;
extern crate rustc;
extern crate rustc_plugin;
-use syntax::ast::{self, Item, MetaItem, ImplItem, TraitItem, ItemKind};
+use syntax::ast::{self, Item, MetaItem, ItemKind};
use syntax::ext::base::*;
use syntax::parse::{self, token};
use syntax::ptr::P;
}
fn expand_into_foo_multi(cx: &mut ExtCtxt,
- sp: Span,
- attr: &MetaItem,
+ _sp: Span,
+ _attr: &MetaItem,
it: Annotatable) -> Annotatable {
match it {
Annotatable::Item(it) => {
..(*quote_item!(cx, enum Foo2 { Bar2, Baz2 }).unwrap()).clone()
}))
}
- Annotatable::ImplItem(it) => {
+ Annotatable::ImplItem(_) => {
quote_item!(cx, impl X { fn foo(&self) -> i32 { 42 } }).unwrap().and_then(|i| {
match i.node {
- ItemKind::Impl(_, _, _, _, _, mut items) => {
+ ItemKind::Impl(.., mut items) => {
Annotatable::ImplItem(P(items.pop().expect("impl method not found")))
}
_ => unreachable!("impl parsed to something other than impl")
}
})
}
- Annotatable::TraitItem(it) => {
+ Annotatable::TraitItem(_) => {
quote_item!(cx, trait X { fn foo(&self) -> i32 { 0 } }).unwrap().and_then(|i| {
match i.node {
- ItemKind::Trait(_, _, _, mut items) => {
+ ItemKind::Trait(.., mut items) => {
Annotatable::TraitItem(P(items.pop().expect("trait method not found")))
}
_ => unreachable!("trait parsed to something other than trait")
// Create a duplicate of the annotatable, based on the MetaItem
fn expand_duplicate(cx: &mut ExtCtxt,
- sp: Span,
+ _sp: Span,
mi: &MetaItem,
it: &Annotatable,
push: &mut FnMut(Annotatable))
{
let copy_name = match mi.node {
ast::MetaItemKind::List(_, ref xs) => {
- if let ast::MetaItemKind::Word(ref w) = xs[0].node {
- token::str_to_ident(&w)
+ if let Some(word) = xs[0].word() {
+ token::str_to_ident(&word.name())
} else {
cx.span_err(mi.span, "Expected word");
return;