diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2015-03-11 23:38:58 +0200 | 
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2015-03-11 23:39:16 +0200 | 
| commit | 9da918548d77182ca64f375fb6da24036d5ad60c (patch) | |
| tree | f04e278a2ffe86f73f9499fa6d23e4dd14faa3c6 /src/test | |
| parent | ce10fa8d12cb20d9eee59fffeeaadfcca8badf4a (diff) | |
| download | rust-9da918548d77182ca64f375fb6da24036d5ad60c.tar.gz rust-9da918548d77182ca64f375fb6da24036d5ad60c.zip | |
syntax: move MethMac to MacImplItem and combine {Provided,Required}Method into MethodTraitItem.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/auxiliary/macro_crate_test.rs | 23 | ||||
| -rw-r--r-- | src/test/compile-fail/lint-missing-doc.rs | 2 | 
2 files changed, 22 insertions, 3 deletions
| diff --git a/src/test/auxiliary/macro_crate_test.rs b/src/test/auxiliary/macro_crate_test.rs index 8218fa0c489..36a34bc6c8b 100644 --- a/src/test/auxiliary/macro_crate_test.rs +++ b/src/test/auxiliary/macro_crate_test.rs @@ -16,7 +16,7 @@ extern crate syntax; extern crate rustc; -use syntax::ast::{TokenTree, Item, MetaItem, ImplItem, TraitItem, Method}; +use syntax::ast::{self, TokenTree, Item, MetaItem}; use syntax::codemap::Span; use syntax::ext::base::*; use syntax::parse::token; @@ -81,7 +81,26 @@ fn expand_into_foo_multi(cx: &mut ExtCtxt, ..(*quote_item!(cx, enum Foo2 { Bar2, Baz2 }).unwrap()).clone() })) } - it => it + Annotatable::ImplItem(it) => { + quote_item!(cx, impl X { fn foo(&self) -> i32 { 42 } }).unwrap().and_then(|i| { + match i.node { + ast::ItemImpl(_, _, _, _, _, mut items) => { + Annotatable::ImplItem(items.pop().expect("impl method not found")) + } + _ => unreachable!("impl parsed to something other than impl") + } + }) + } + Annotatable::TraitItem(it) => { + quote_item!(cx, trait X { fn foo(&self) -> i32 { 0 } }).unwrap().and_then(|i| { + match i.node { + ast::ItemTrait(_, _, _, mut items) => { + Annotatable::TraitItem(items.pop().expect("trait method not found")) + } + _ => unreachable!("trait parsed to something other than trait") + } + }) + } } } diff --git a/src/test/compile-fail/lint-missing-doc.rs b/src/test/compile-fail/lint-missing-doc.rs index 788236a27a5..04db6c8c8f3 100644 --- a/src/test/compile-fail/lint-missing-doc.rs +++ b/src/test/compile-fail/lint-missing-doc.rs @@ -60,7 +60,7 @@ trait B { pub trait C { //~ ERROR: missing documentation for a trait fn foo(&self); //~ ERROR: missing documentation for a trait method - fn foo_with_impl(&self) {} //~ ERROR: missing documentation for a default method + fn foo_with_impl(&self) {} //~ ERROR: missing documentation for a trait method } #[allow(missing_docs)] | 
