diff options
| author | Mark Simulacrum <mark.simulacrum@gmail.com> | 2018-06-01 16:40:33 -0600 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2019-01-24 07:37:34 -0700 |
| commit | db97c48ad6e7f36468b152e9b08efc6f2f7da691 (patch) | |
| tree | 54ba10e3c9a82e3c57929586c30ab328687afd22 /src/test | |
| parent | 6bba352cad2117f56353d400f71e96eafa2e6bd7 (diff) | |
| download | rust-db97c48ad6e7f36468b152e9b08efc6f2f7da691.tar.gz rust-db97c48ad6e7f36468b152e9b08efc6f2f7da691.zip | |
Remove quote_*! macros and associated APIs
Diffstat (limited to 'src/test')
39 files changed, 34 insertions, 1242 deletions
diff --git a/src/test/run-fail-fulldeps/qquote.rs b/src/test/run-fail-fulldeps/qquote.rs deleted file mode 100644 index d0e05216728..00000000000 --- a/src/test/run-fail-fulldeps/qquote.rs +++ /dev/null @@ -1,35 +0,0 @@ -// ignore-cross-compile - -// error-pattern:expected expression, found statement (`let`) - -#![feature(quote, rustc_private)] - -extern crate syntax; -extern crate syntax_pos; - -use syntax::ast; -use syntax::source_map; -use syntax::print::pprust; -use syntax::symbol::Symbol; -use syntax_pos::DUMMY_SP; - -fn main() { - syntax::with_globals(|| run()); -} - -fn run() { - let ps = syntax::parse::ParseSess::new(source_map::FilePathMapping::empty()); - let mut resolver = syntax::ext::base::DummyResolver; - let mut cx = syntax::ext::base::ExtCtxt::new( - &ps, - syntax::ext::expand::ExpansionConfig::default("qquote".to_string()), - &mut resolver); - let cx = &mut cx; - - println!("{}", pprust::expr_to_string(&*quote_expr!(&cx, 23))); - assert_eq!(pprust::expr_to_string(&*quote_expr!(&cx, 23)), "23"); - - let expr = quote_expr!(&cx, let x isize = 20;); - println!("{}", pprust::expr_to_string(&*expr)); - assert_eq!(pprust::expr_to_string(&*expr), "let x isize = 20;"); -} diff --git a/src/test/run-pass-fulldeps/auxiliary/issue-16723.rs b/src/test/run-pass-fulldeps/auxiliary/issue-16723.rs deleted file mode 100644 index 76680f5dda2..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/issue-16723.rs +++ /dev/null @@ -1,29 +0,0 @@ -// force-host - -#![feature(plugin_registrar, quote, rustc_private)] -#![crate_type = "dylib"] - -extern crate syntax; -extern crate rustc; -extern crate rustc_data_structures; -extern crate rustc_plugin; -#[macro_use] extern crate smallvec; -extern crate syntax_pos; - -use smallvec::SmallVec; -use syntax::ext::base::{ExtCtxt, MacResult, MacEager}; -use syntax::tokenstream; -use rustc_plugin::Registry; - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_macro("multiple_items", expand) -} - -fn expand(cx: &mut ExtCtxt, _: syntax_pos::Span, _: &[tokenstream::TokenTree]) - -> Box<MacResult+'static> { - MacEager::items(smallvec![ - quote_item!(cx, struct Struct1;).unwrap(), - quote_item!(cx, struct Struct2;).unwrap() - ]) -} diff --git a/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs b/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs index e31628782dc..a2b1d6976d0 100644 --- a/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs +++ b/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs @@ -1,209 +1,34 @@ // force-host +// no-prefer-dynamic -#![feature(plugin_registrar, quote, rustc_private)] +#![crate_type = "proc-macro"] +#![feature(rustc_private)] extern crate syntax; extern crate rustc; extern crate rustc_plugin; extern crate syntax_pos; - -use syntax::ast::{self, Item, MetaItem, ItemKind}; -use syntax::source_map::DUMMY_SP; -use syntax::ext::base::*; -use syntax::ext::quote::rt::ToTokens; -use syntax::parse::{self, token}; -use syntax::ptr::P; -use syntax::symbol::Symbol; -use syntax::tokenstream::TokenTree; -use syntax_pos::Span; -use rustc_plugin::Registry; - -#[macro_export] -macro_rules! exported_macro { () => (2) } -macro_rules! unexported_macro { () => (3) } - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_macro("make_a_1", expand_make_a_1); - reg.register_macro("identity", expand_identity); - reg.register_syntax_extension( - Symbol::intern("rustc_into_multi_foo"), - MultiModifier(Box::new(expand_into_foo_multi))); - reg.register_syntax_extension( - Symbol::intern("rustc_duplicate"), - MultiDecorator(Box::new(expand_duplicate))); - reg.register_syntax_extension( - Symbol::intern("rustc_caller"), - MultiDecorator(Box::new(expand_caller))); -} - -fn expand_make_a_1(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) -> Box<MacResult + 'static> { - if !tts.is_empty() { - cx.span_fatal(sp, "make_a_1 takes no arguments"); - } - MacEager::expr(quote_expr!(cx, 1)) -} - -// See Issue #15750 -fn expand_identity(cx: &mut ExtCtxt, _span: Span, tts: &[TokenTree]) -> Box<MacResult + 'static> { - // Parse an expression and emit it unchanged. - let mut parser = parse::new_parser_from_tts(cx.parse_sess(), tts.to_vec()); - let expr = parser.parse_expr().unwrap(); - MacEager::expr(quote_expr!(&mut *cx, $expr)) -} - -fn expand_into_foo_multi(cx: &mut ExtCtxt, - _sp: Span, - _attr: &MetaItem, - it: Annotatable) - -> Vec<Annotatable> { - match it { - Annotatable::Item(it) => vec![ - Annotatable::Item(P(Item { - attrs: it.attrs.clone(), - ..(*quote_item!(cx, enum Foo2 { Bar2, Baz2 }).unwrap()).clone() - })), - Annotatable::Item(quote_item!(cx, enum Foo3 { Bar }).unwrap()), - Annotatable::Item(quote_item!(cx, #[cfg(any())] fn foo2() {}).unwrap()), - ], - Annotatable::ImplItem(_it) => vec![ - quote_item!(cx, impl X { fn foo(&self) -> i32 { 42 } }).unwrap().and_then(|i| { - match i.node { - 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) => vec![ - quote_item!(cx, trait X { fn foo(&self) -> i32 { 0 } }).unwrap().and_then(|i| { - match i.node { - ItemKind::Trait(.., mut items) => { - Annotatable::TraitItem(P(items.pop().expect("trait method not found"))) - } - _ => unreachable!("trait parsed to something other than trait") - } - }) - ], - // covered in proc_macro/macros-in-extern.rs - Annotatable::ForeignItem(..) => unimplemented!(), - // covered in proc_macro/attr-stmt-expr.rs - Annotatable::Stmt(_) | Annotatable::Expr(_) => panic!("expected item"), - } +extern crate proc_macro; + +use proc_macro::{TokenTree, TokenStream}; + +#[proc_macro_attribute] +pub fn rustc_duplicate(attr: TokenStream, item: TokenStream) -> TokenStream { + let mut new_name = Some(attr.into_iter().nth(0).unwrap()); + let mut encountered_idents = 0; + let input = item.to_string(); + let ret = item.into_iter().map(move |token| match token { + TokenTree::Ident(_) if encountered_idents == 1 => { + encountered_idents += 1; + new_name.take().unwrap() + } + TokenTree::Ident(_) => { + encountered_idents += 1; + token + } + _ => token + }).collect::<TokenStream>(); + let mut input_again = input.parse::<TokenStream>().unwrap(); + input_again.extend(ret); + input_again } - -// Create a duplicate of the annotatable, based on the MetaItem -fn expand_duplicate(cx: &mut ExtCtxt, - _sp: Span, - mi: &MetaItem, - it: &Annotatable, - push: &mut FnMut(Annotatable)) { - let copy_name = match mi.node { - ast::MetaItemKind::List(ref xs) => { - if let Some(word) = xs[0].word() { - word.ident.segments.last().unwrap().ident - } else { - cx.span_err(mi.span, "Expected word"); - return; - } - } - _ => { - cx.span_err(mi.span, "Expected list"); - return; - } - }; - - // Duplicate the item but replace its ident by the MetaItem - match it.clone() { - Annotatable::Item(it) => { - let mut new_it = (*it).clone(); - new_it.attrs.clear(); - new_it.ident = copy_name; - push(Annotatable::Item(P(new_it))); - } - Annotatable::ImplItem(it) => { - let mut new_it = (*it).clone(); - new_it.attrs.clear(); - new_it.ident = copy_name; - push(Annotatable::ImplItem(P(new_it))); - } - Annotatable::TraitItem(tt) => { - let mut new_it = (*tt).clone(); - new_it.attrs.clear(); - new_it.ident = copy_name; - push(Annotatable::TraitItem(P(new_it))); - } - // covered in proc_macro/macros-in-extern.rs - Annotatable::ForeignItem(..) => unimplemented!(), - // covered in proc_macro/attr-stmt-expr.rs - Annotatable::Stmt(_) | Annotatable::Expr(_) => panic!("expected item") - } -} - -pub fn token_separate<T: ToTokens>(ecx: &ExtCtxt, things: &[T], - token: token::Token) -> Vec<TokenTree> { - let mut output: Vec<TokenTree> = vec![]; - for (i, thing) in things.iter().enumerate() { - output.extend(thing.to_tokens(ecx)); - if i < things.len() - 1 { - output.push(TokenTree::Token(DUMMY_SP, token.clone())); - } - } - - output -} - -fn expand_caller(cx: &mut ExtCtxt, - sp: Span, - mi: &MetaItem, - it: &Annotatable, - push: &mut FnMut(Annotatable)) { - let (orig_fn_name, ret_type) = match *it { - Annotatable::Item(ref item) => match item.node { - ItemKind::Fn(ref decl, ..) => { - (item.ident, &decl.output) - } - _ => cx.span_fatal(item.span, "Only functions with return types can be annotated.") - }, - _ => cx.span_fatal(sp, "Only functions can be annotated.") - }; - - let (caller_name, arguments) = if let Some(list) = mi.meta_item_list() { - if list.len() < 2 { - cx.span_fatal(mi.span(), "Need a function name and at least one parameter."); - } - - let fn_name = match list[0].name() { - Some(name) => ast::Ident::with_empty_ctxt(name), - None => cx.span_fatal(list[0].span(), "First parameter must be an ident.") - }; - - (fn_name, &list[1..]) - } else { - cx.span_fatal(mi.span, "Expected list."); - }; - - let literals: Vec<ast::Lit> = arguments.iter().map(|arg| { - if let Some(lit) = arg.literal() { - lit.clone() - } else { - cx.span_fatal(arg.span(), "Expected literal."); - } - }).collect(); - - let arguments = token_separate(cx, literals.as_slice(), token::Comma); - if let ast::FunctionRetTy::Ty(ref rt) = *ret_type { - push(Annotatable::Item(quote_item!(cx, - fn $caller_name() -> $rt { - $orig_fn_name($arguments) - }).unwrap())) - } else { - push(Annotatable::Item(quote_item!(cx, - fn $caller_name() { - $orig_fn_name($arguments) - }).unwrap())) - } -} - -pub fn foo() {} diff --git a/src/test/run-pass-fulldeps/auxiliary/plugin_with_plugin_lib.rs b/src/test/run-pass-fulldeps/auxiliary/plugin_with_plugin_lib.rs deleted file mode 100644 index 320b77e8ea8..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/plugin_with_plugin_lib.rs +++ /dev/null @@ -1,13 +0,0 @@ -// force-host - -#![feature(plugin_registrar, rustc_private)] -#![deny(plugin_as_library)] // should have no effect in a plugin crate - -extern crate macro_crate_test; -extern crate rustc; -extern crate rustc_plugin; - -use rustc_plugin::Registry; - -#[plugin_registrar] -pub fn plugin_registrar(_: &mut Registry) { } diff --git a/src/test/run-pass-fulldeps/auxiliary/procedural_mbe_matching.rs b/src/test/run-pass-fulldeps/auxiliary/procedural_mbe_matching.rs deleted file mode 100644 index e2fa3744ad8..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/procedural_mbe_matching.rs +++ /dev/null @@ -1,82 +0,0 @@ -// force-host - -#![crate_type="dylib"] -#![feature(plugin_registrar, quote, rustc_private)] - -extern crate syntax; -extern crate syntax_pos; -extern crate rustc; -extern crate rustc_plugin; - -use syntax::feature_gate::Features; -use syntax::parse::token::{NtExpr, NtPat}; -use syntax::ast::{Ident, Pat, NodeId}; -use syntax::tokenstream::{TokenTree}; -use syntax::ext::base::{ExtCtxt, MacResult, MacEager}; -use syntax::ext::build::AstBuilder; -use syntax::ext::tt::quoted; -use syntax::ext::tt::macro_parser::{MatchedSeq, MatchedNonterminal}; -use syntax::ext::tt::macro_parser::{Success, Failure, Error}; -use syntax::ext::tt::macro_parser::parse_failure_msg; -use syntax::ptr::P; -use syntax_pos::{Span, edition::Edition}; -use rustc_plugin::Registry; - -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, - &Features::new(), - &[], - Edition::Edition2015, - // not used... - NodeId::from_u32(0)); - let map = match TokenTree::parse(cx, &mbe_matcher, args.iter().cloned().collect()) { - Success(map) => map, - Failure(_, tok, msg) => { - panic!("expected Success, but got Failure: {} - {}", parse_failure_msg(tok), msg); - } - Error(_, s) => { - panic!("expected Success, but got Error: {}", s); - } - }; - - let matched_nt = match *map[&Ident::from_str("matched")] { - MatchedNonterminal(ref nt) => nt.clone(), - _ => unreachable!(), - }; - - let mac_expr = match (&*matched_nt, &*map[&Ident::from_str("pat")]) { - (&NtExpr(ref matched_expr), &MatchedSeq(ref pats, seq_sp)) => { - let pats: Vec<P<Pat>> = pats.iter().map(|pat_nt| { - match *pat_nt { - MatchedNonterminal(ref nt) => match **nt { - NtPat(ref pat) => pat.clone(), - _ => unreachable!(), - }, - _ => unreachable!(), - } - }).collect(); - let span = seq_sp.entire(); - let arm = cx.arm(span, pats, cx.expr_bool(span, true)); - - quote_expr!(cx, - match $matched_expr { - $arm - _ => false - } - ) - } - _ => unreachable!() - }; - - MacEager::expr(mac_expr) -} - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_macro("matches", expand_mbe_matches); -} diff --git a/src/test/run-pass-fulldeps/auxiliary/syntax_extension_with_dll_deps_2.rs b/src/test/run-pass-fulldeps/auxiliary/syntax_extension_with_dll_deps_2.rs deleted file mode 100644 index a356df55b35..00000000000 --- a/src/test/run-pass-fulldeps/auxiliary/syntax_extension_with_dll_deps_2.rs +++ /dev/null @@ -1,27 +0,0 @@ -// force-host - -#![crate_type = "dylib"] -#![feature(plugin_registrar, quote, rustc_private)] - -extern crate syntax_extension_with_dll_deps_1 as other; -extern crate syntax; -extern crate syntax_pos; -extern crate rustc; -extern crate rustc_plugin; - -use syntax::ast::{Item, MetaItem}; -use syntax::ext::base::*; -use syntax::tokenstream::TokenTree; -use syntax_pos::Span; -use rustc_plugin::Registry; - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_macro("foo", expand_foo); -} - -fn expand_foo(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) - -> Box<MacResult+'static> { - let answer = other::the_answer(); - MacEager::expr(quote_expr!(cx, $answer)) -} diff --git a/src/test/run-pass-fulldeps/issue-16723.rs b/src/test/run-pass-fulldeps/issue-16723.rs deleted file mode 100644 index a3965f98927..00000000000 --- a/src/test/run-pass-fulldeps/issue-16723.rs +++ /dev/null @@ -1,19 +0,0 @@ -// ignore-stage1 -// aux-build:issue-16723.rs -#![feature(plugin)] -#![plugin(issue_16723)] - -multiple_items!(); - -impl Struct1 { - fn foo() {} -} -impl Struct2 { - fn foo() {} -} - -fn main() { - Struct1::foo(); - Struct2::foo(); - println!("hallo"); -} diff --git a/src/test/run-pass-fulldeps/issue-16992.rs b/src/test/run-pass-fulldeps/issue-16992.rs deleted file mode 100644 index e5945b679f3..00000000000 --- a/src/test/run-pass-fulldeps/issue-16992.rs +++ /dev/null @@ -1,15 +0,0 @@ -// ignore-cross-compile - -#![feature(quote, rustc_private)] - -extern crate syntax; - -use syntax::ext::base::ExtCtxt; - -#[allow(dead_code)] -fn foobar(cx: &mut ExtCtxt) { - quote_expr!(cx, 1); - quote_expr!(cx, 2); -} - -fn main() { } diff --git a/src/test/run-pass-fulldeps/issue-18763-quote-token-tree.rs b/src/test/run-pass-fulldeps/issue-18763-quote-token-tree.rs deleted file mode 100644 index 9fa3d3de8f2..00000000000 --- a/src/test/run-pass-fulldeps/issue-18763-quote-token-tree.rs +++ /dev/null @@ -1,22 +0,0 @@ -#![allow(dead_code)] -#![allow(unused_imports)] -// ignore-cross-compile -#![feature(quote, rustc_private)] - -extern crate syntax; - -use syntax::ext::base::ExtCtxt; - -fn syntax_extension(cx: &ExtCtxt) { - let _toks_1 = vec![quote_tokens!(cx, /** comment */ fn foo() {})]; - let name = quote_tokens!(cx, bar); - let _toks_2 = vec![quote_item!(cx, static $name:isize = 2;)]; - let _toks_4 = quote_tokens!(cx, $name:static $name:sizeof); - let _toks_3 = vec![quote_item!(cx, - /// comment - fn foo() { let $name:isize = 3; } - )]; -} - -fn main() { -} diff --git a/src/test/run-pass-fulldeps/macro-crate-does-hygiene-work.rs b/src/test/run-pass-fulldeps/macro-crate-does-hygiene-work.rs deleted file mode 100644 index 3c251cc0f55..00000000000 --- a/src/test/run-pass-fulldeps/macro-crate-does-hygiene-work.rs +++ /dev/null @@ -1,16 +0,0 @@ -// aux-build:macro_crate_test.rs -// ignore-stage1 - -// Issue #15750: a macro that internally parses its input and then -// uses `quote_expr!` to rearrange it should be hygiene-preserving. - -#![feature(plugin)] -#![plugin(macro_crate_test)] - -fn main() { - let x = 3; - assert_eq!(3, identity!(x)); - assert_eq!(6, identity!(x+x)); - let x = 4; - assert_eq!(4, identity!(x)); -} diff --git a/src/test/run-pass-fulldeps/macro-crate-multi-decorator-literals.rs b/src/test/run-pass-fulldeps/macro-crate-multi-decorator-literals.rs deleted file mode 100644 index eb7ab139d64..00000000000 --- a/src/test/run-pass-fulldeps/macro-crate-multi-decorator-literals.rs +++ /dev/null @@ -1,50 +0,0 @@ -#![allow(plugin_as_library)] -#![allow(unused_imports)] -// aux-build:macro_crate_test.rs -// ignore-stage1 - -#![feature(plugin, rustc_attrs)] -#![plugin(macro_crate_test)] - -#[macro_use] -#[no_link] -extern crate macro_crate_test; - -// The `caller(name, args...)` attribute emits a new nullary function named -// `name` that calls the annotated function with `args`. As an example, consider -// the following: -// -// #[caller(simple, 1, "hello", 3.14)] -// fn f(num: isize, string: &'static str, float: f32) -> (isize, &'static str, float) { -// (num, string, float) -// } -// -// This results in a function named `simple` that calls `f(1, "hello", 3.14)`. -// As a result, the expression `simple()` evaluates to `(1, "helllo", 3.14)`. - -#[rustc_caller(simple, 1, "hello", 3.14)] -#[rustc_caller(simple1, 2, "bye", 6.28)] -#[rustc_caller(simple2, 3, "hi", 1.01)] -fn f(num: isize, string: &'static str, float: f32) -> (isize, &'static str, f32) { - (num, string, float) -} - -#[rustc_caller(complex, true, 10)] -#[rustc_caller(complex1, false, 15)] -#[rustc_caller(complex2, true, 20)] -fn g(emit: bool, num: i32) -> Option<i32> { - match emit { - true => Some(num), - false => None - } -} - -fn main() { - assert_eq!(simple(), (1, "hello", 3.14)); - assert_eq!(simple1(), (2, "bye", 6.28)); - assert_eq!(simple2(), (3, "hi", 1.01)); - - assert_eq!(complex(), Some(10)); - assert_eq!(complex1(), None); - assert_eq!(complex2(), Some(20)); -} diff --git a/src/test/run-pass-fulldeps/macro-crate-multi-decorator.rs b/src/test/run-pass-fulldeps/macro-crate-multi-decorator.rs index ef28f233fea..dcac160c4c9 100644 --- a/src/test/run-pass-fulldeps/macro-crate-multi-decorator.rs +++ b/src/test/run-pass-fulldeps/macro-crate-multi-decorator.rs @@ -5,11 +5,9 @@ // aux-build:macro_crate_test.rs // ignore-stage1 -#![feature(plugin, rustc_attrs)] -#![plugin(macro_crate_test)] +#![feature(rustc_attrs)] #[macro_use] -#[no_link] extern crate macro_crate_test; // The duplicate macro will create a copy of the item with the given identifier. diff --git a/src/test/run-pass-fulldeps/macro-crate.rs b/src/test/run-pass-fulldeps/macro-crate.rs deleted file mode 100644 index 62838c2c083..00000000000 --- a/src/test/run-pass-fulldeps/macro-crate.rs +++ /dev/null @@ -1,46 +0,0 @@ -#![allow(plugin_as_library)] -#![allow(dead_code)] -// aux-build:macro_crate_test.rs -// ignore-stage1 - -#![feature(plugin, rustc_attrs)] -#![plugin(macro_crate_test)] - -#[macro_use] #[no_link] -extern crate macro_crate_test; - -#[rustc_into_multi_foo] -#[derive(PartialEq, Clone, Debug)] -fn foo() -> AnotherFakeTypeThatHadBetterGoAway {} - -// Check that the `#[into_multi_foo]`-generated `foo2` is configured away -fn foo2() {} - -trait Qux { - #[rustc_into_multi_foo] - fn bar(); -} - -impl Qux for i32 { - #[rustc_into_multi_foo] - fn bar() {} -} - -impl Qux for u8 {} - -pub fn main() { - assert_eq!(1, make_a_1!()); - assert_eq!(2, exported_macro!()); - - assert_eq!(Foo2::Bar2, Foo2::Bar2); - test(None::<Foo2>); - - let _ = Foo3::Bar; - - let x = 10i32; - assert_eq!(x.foo(), 42); - let x = 10u8; - assert_eq!(x.foo(), 0); -} - -fn test<T: PartialEq+Clone>(_: Option<T>) {} diff --git a/src/test/run-pass-fulldeps/mbe_matching_test_macro.rs b/src/test/run-pass-fulldeps/mbe_matching_test_macro.rs deleted file mode 100644 index c672081edf4..00000000000 --- a/src/test/run-pass-fulldeps/mbe_matching_test_macro.rs +++ /dev/null @@ -1,11 +0,0 @@ -// aux-build:procedural_mbe_matching.rs -// ignore-stage1 - -#![feature(plugin)] -#![plugin(procedural_mbe_matching)] - -pub fn main() { - assert_eq!(matches!(Some(123), None | Some(0)), false); - assert_eq!(matches!(Some(123), None | Some(123)), true); - assert_eq!(matches!(true, true), true); -} diff --git a/src/test/run-pass-fulldeps/plugin-lib-ok-in-plugin.rs b/src/test/run-pass-fulldeps/plugin-lib-ok-in-plugin.rs deleted file mode 100644 index e9f234f7f54..00000000000 --- a/src/test/run-pass-fulldeps/plugin-lib-ok-in-plugin.rs +++ /dev/null @@ -1,16 +0,0 @@ -// aux-build:macro_crate_test.rs -// aux-build:plugin_with_plugin_lib.rs -// ignore-stage1 -// ignore-cross-compile -// -// macro_crate_test will not compile on a cross-compiled target because -// libsyntax is not compiled for it. - -#![deny(plugin_as_library)] -#![feature(plugin)] -#![plugin(macro_crate_test)] -#![plugin(plugin_with_plugin_lib)] - -fn main() { - assert_eq!(1, make_a_1!()); -} diff --git a/src/test/run-pass-fulldeps/plugin-plus-extern-crate.rs b/src/test/run-pass-fulldeps/plugin-plus-extern-crate.rs deleted file mode 100644 index e45a7f59c1b..00000000000 --- a/src/test/run-pass-fulldeps/plugin-plus-extern-crate.rs +++ /dev/null @@ -1,17 +0,0 @@ -// aux-build:macro_crate_test.rs -// ignore-stage1 -// ignore-cross-compile -// -// macro_crate_test will not compile on a cross-compiled target because -// libsyntax is not compiled for it. - -#![allow(plugin_as_library)] -#![feature(plugin)] -#![plugin(macro_crate_test)] - -extern crate macro_crate_test; - -fn main() { - assert_eq!(1, make_a_1!()); - macro_crate_test::foo(); -} diff --git a/src/test/run-pass-fulldeps/qquote.rs b/src/test/run-pass-fulldeps/qquote.rs deleted file mode 100644 index 33063fc74bf..00000000000 --- a/src/test/run-pass-fulldeps/qquote.rs +++ /dev/null @@ -1,92 +0,0 @@ -#![allow(unused_imports)] -// ignore-cross-compile - -#![feature(quote, rustc_private)] - -extern crate syntax; -extern crate syntax_pos; - -use syntax::source_map::FilePathMapping; -use syntax::print::pprust::*; -use syntax::symbol::Symbol; -use syntax_pos::DUMMY_SP; - -fn main() { - syntax::with_globals(|| run()); -} - -fn run() { - let ps = syntax::parse::ParseSess::new(FilePathMapping::empty()); - let mut resolver = syntax::ext::base::DummyResolver; - let mut cx = syntax::ext::base::ExtCtxt::new( - &ps, - syntax::ext::expand::ExpansionConfig::default("qquote".to_string()), - &mut resolver); - let cx = &mut cx; - - macro_rules! check { - ($f: ident, $($e: expr),+; $expect: expr) => ({ - $(assert_eq!($f(&$e), $expect);)+ - }); - } - - let abc = quote_expr!(cx, 23); - check!(expr_to_string, abc, *quote_expr!(cx, $abc); "23"); - - let ty = quote_ty!(cx, isize); - check!(ty_to_string, ty, *quote_ty!(cx, $ty); "isize"); - - let item = quote_item!(cx, static x: $ty = 10;).unwrap(); - check!(item_to_string, item, quote_item!(cx, $item).unwrap(); "static x: isize = 10;"); - - let twenty: u16 = 20; - let stmt = quote_stmt!(cx, let x = $twenty;).unwrap(); - check!(stmt_to_string, stmt, quote_stmt!(cx, $stmt).unwrap(); "let x = 20u16;"); - - let pat = quote_pat!(cx, Some(_)); - check!(pat_to_string, pat, *quote_pat!(cx, $pat); "Some(_)"); - - let expr = quote_expr!(cx, (x, y)); - let arm = quote_arm!(cx, (ref x, ref y) => $expr,); - check!(arm_to_string, arm, quote_arm!(cx, $arm); " (ref x, ref y) => (x, y),"); - - let attr = quote_attr!(cx, #![cfg(foo = "bar")]); - check!(attribute_to_string, attr, quote_attr!(cx, $attr); r#"#![cfg(foo = "bar")]"#); - - // quote_arg! - - let arg = quote_arg!(cx, foo: i32); - check!(arg_to_string, arg, quote_arg!(cx, $arg); "foo: i32"); - - let function = quote_item!(cx, fn f($arg) { }).unwrap(); - check!(item_to_string, function; "fn f(foo: i32) { }"); - - let args = vec![arg, quote_arg!(cx, bar: u32)]; - let args = &args[..]; - let function = quote_item!(cx, fn f($args) { }).unwrap(); - check!(item_to_string, function; "fn f(foo: i32, bar: u32) { }"); - - // quote_block! - - let block = quote_block!(cx, { $stmt let y = 40u32; }); - check!(block_to_string, block, *quote_block!(cx, $block); "{ let x = 20u16; let y = 40u32; }"); - - let function = quote_item!(cx, fn f() $block).unwrap(); - check!(item_to_string, function; "fn f() { let x = 20u16; let y = 40u32; }"); - - // quote_path! - - let path = quote_path!(cx, ::syntax::ptr::P<MetaItem>); - check!(path_to_string, path, quote_path!(cx, $path); "::syntax::ptr::P<MetaItem>"); - - let ty = quote_ty!(cx, $path); - check!(ty_to_string, ty; "::syntax::ptr::P<MetaItem>"); - - // quote_meta_item! - - let meta = quote_meta_item!(cx, cfg(foo = "bar")); - check!(meta_item_to_string, meta, quote_meta_item!(cx, $meta); r#"cfg(foo = "bar")"#); - - let attr = quote_attr!(cx, #![$meta]); - check!(attribute_to_string, attr; r#"#![cfg(foo = "bar")]"#); -} diff --git a/src/test/run-pass-fulldeps/quote-tokens.rs b/src/test/run-pass-fulldeps/quote-tokens.rs deleted file mode 100644 index 04a4c442e00..00000000000 --- a/src/test/run-pass-fulldeps/quote-tokens.rs +++ /dev/null @@ -1,45 +0,0 @@ -#![allow(dead_code)] -#![allow(unused_variables)] -#![allow(unused_imports)] -// ignore-cross-compile -#![feature(quote, rustc_private)] - -extern crate syntax; - -use syntax::ext::base::ExtCtxt; -use syntax::ptr::P; -use syntax::parse::PResult; - -fn syntax_extension(cx: &ExtCtxt) { - let e_toks : Vec<syntax::tokenstream::TokenTree> = quote_tokens!(cx, 1 + 2); - let p_toks : Vec<syntax::tokenstream::TokenTree> = quote_tokens!(cx, (x, 1 .. 4, *)); - - let a: P<syntax::ast::Expr> = quote_expr!(cx, 1 + 2); - let _b: Option<P<syntax::ast::Item>> = quote_item!(cx, static foo : isize = $e_toks; ); - let _c: P<syntax::ast::Pat> = quote_pat!(cx, (x, 1 .. 4, *) ); - let _d: Option<syntax::ast::Stmt> = quote_stmt!(cx, let x = $a; ); - let _d: syntax::ast::Arm = quote_arm!(cx, (ref x, ref y) = (x, y) ); - let _e: P<syntax::ast::Expr> = quote_expr!(cx, match foo { $p_toks => 10 } ); - - let _f: P<syntax::ast::Expr> = quote_expr!(cx, ()); - let _g: P<syntax::ast::Expr> = quote_expr!(cx, true); - let _h: P<syntax::ast::Expr> = quote_expr!(cx, 'a'); - - let i: Option<P<syntax::ast::Item>> = quote_item!(cx, #[derive(Eq)] struct Foo; ); - assert!(i.is_some()); - - let _l: P<syntax::ast::Ty> = quote_ty!(cx, &isize); - - let _n: syntax::ast::Attribute = quote_attr!(cx, #![cfg(foo, bar = "baz")]); - - let _o: Option<P<syntax::ast::Item>> = quote_item!(cx, fn foo<T: ?Sized>() {}); - - let stmts = vec![ - quote_stmt!(cx, let x = 1;).unwrap(), - quote_stmt!(cx, let y = 2;).unwrap(), - ]; - let expr: P<syntax::ast::Expr> = quote_expr!(cx, x + y); -} - -fn main() { -} diff --git a/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs b/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs deleted file mode 100644 index 1568bf26039..00000000000 --- a/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![allow(dead_code)] -// ignore-cross-compile -#![feature(quote, rustc_private)] -#![deny(unused_variables)] - -extern crate syntax; - -use syntax::ext::base::ExtCtxt; - -fn test(cx: &mut ExtCtxt) { - let foo = 10; - let _e = quote_expr!(cx, $foo); -} - -pub fn main() { } diff --git a/src/test/run-pass-fulldeps/syntax-extension-with-dll-deps.rs b/src/test/run-pass-fulldeps/syntax-extension-with-dll-deps.rs deleted file mode 100644 index 7c236fd69ea..00000000000 --- a/src/test/run-pass-fulldeps/syntax-extension-with-dll-deps.rs +++ /dev/null @@ -1,10 +0,0 @@ -// aux-build:syntax_extension_with_dll_deps_1.rs -// aux-build:syntax_extension_with_dll_deps_2.rs -// ignore-stage1 - -#![feature(plugin, rustc_private)] -#![plugin(syntax_extension_with_dll_deps_2)] - -fn main() { - foo!(); -} diff --git a/src/test/ui-fulldeps/auxiliary/macro_crate_test.rs b/src/test/ui-fulldeps/auxiliary/macro_crate_test.rs deleted file mode 100644 index a364aa0422d..00000000000 --- a/src/test/ui-fulldeps/auxiliary/macro_crate_test.rs +++ /dev/null @@ -1,149 +0,0 @@ -// force-host - -#![feature(plugin_registrar, quote, rustc_private)] - -extern crate syntax; -extern crate syntax_pos; -extern crate rustc; -extern crate rustc_plugin; - -use syntax::ast::{self, Item, MetaItem, ItemKind}; -use syntax::ext::base::*; -use syntax::parse; -use syntax::ptr::P; -use syntax::symbol::Symbol; -use syntax::tokenstream::TokenTree; -use syntax_pos::Span; -use rustc_plugin::Registry; - -#[macro_export] -macro_rules! exported_macro { () => (2) } -macro_rules! unexported_macro { () => (3) } - -#[plugin_registrar] -pub fn plugin_registrar(reg: &mut Registry) { - reg.register_macro("make_a_1", expand_make_a_1); - reg.register_macro("identity", expand_identity); - reg.register_syntax_extension( - Symbol::intern("into_multi_foo"), - MultiModifier(Box::new(expand_into_foo_multi))); - reg.register_syntax_extension( - Symbol::intern("noop_attribute"), - MultiModifier(Box::new(expand_noop_attribute))); - reg.register_syntax_extension( - Symbol::intern("duplicate"), - MultiDecorator(Box::new(expand_duplicate))); -} - -fn expand_make_a_1(cx: &mut ExtCtxt, sp: Span, tts: &[TokenTree]) - -> Box<MacResult+'static> { - if !tts.is_empty() { - cx.span_fatal(sp, "make_a_1 takes no arguments"); - } - MacEager::expr(quote_expr!(cx, 1)) -} - -// See Issue #15750 -fn expand_identity(cx: &mut ExtCtxt, _span: Span, tts: &[TokenTree]) - -> Box<MacResult+'static> { - // Parse an expression and emit it unchanged. - let mut parser = parse::new_parser_from_tts(cx.parse_sess(), tts.to_vec()); - let expr = parser.parse_expr().unwrap(); - MacEager::expr(quote_expr!(&mut *cx, $expr)) -} - -fn expand_into_foo_multi(cx: &mut ExtCtxt, - _sp: Span, - _attr: &MetaItem, - it: Annotatable) -> Annotatable { - match it { - Annotatable::Item(it) => { - Annotatable::Item(P(Item { - attrs: it.attrs.clone(), - ..(*quote_item!(cx, enum Foo2 { Bar2, Baz2 }).unwrap()).clone() - })) - } - Annotatable::ImplItem(_) => { - quote_item!(cx, impl X { fn foo(&self) -> i32 { 42 } }).unwrap().and_then(|i| { - match i.node { - ItemKind::Impl(.., mut items) => { - Annotatable::ImplItem(P(items.pop().expect("impl method not found"))) - } - _ => unreachable!("impl parsed to something other than impl") - } - }) - } - Annotatable::TraitItem(_) => { - quote_item!(cx, trait X { fn foo(&self) -> i32 { 0 } }).unwrap().and_then(|i| { - match i.node { - ItemKind::Trait(.., mut items) => { - Annotatable::TraitItem(P(items.pop().expect("trait method not found"))) - } - _ => unreachable!("trait parsed to something other than trait") - } - }) - } - // covered in proc_macro/macros-in-extern.rs - Annotatable::ForeignItem(_) => unimplemented!(), - // covered in proc_macro/attr-stmt-expr.rs - Annotatable::Stmt(_) | Annotatable::Expr(_) => panic!("expected item") - } -} - -fn expand_noop_attribute(_cx: &mut ExtCtxt, - _sp: Span, - _attr: &MetaItem, - it: Annotatable) -> Annotatable { - it -} - -// Create a duplicate of the annotatable, based on the MetaItem -fn expand_duplicate(cx: &mut ExtCtxt, - _sp: Span, - mi: &MetaItem, - it: &Annotatable, - push: &mut FnMut(Annotatable)) -{ - let copy_name = match mi.node { - ast::MetaItemKind::List(ref xs) => { - if let Some(word) = xs[0].word() { - word.ident.segments.last().unwrap().ident - } else { - cx.span_err(mi.span, "Expected word"); - return; - } - } - _ => { - cx.span_err(mi.span, "Expected list"); - return; - } - }; - - // Duplicate the item but replace its ident by the MetaItem - match it.clone() { - Annotatable::Item(it) => { - let mut new_it = (*it).clone(); - new_it.attrs.clear(); - new_it.ident = copy_name; - push(Annotatable::Item(P(new_it))); - } - Annotatable::ImplItem(it) => { - let mut new_it = (*it).clone(); - new_it.attrs.clear(); - new_it.ident = copy_name; - push(Annotatable::ImplItem(P(new_it))); - } - Annotatable::TraitItem(tt) => { - let mut new_it = (*tt).clone(); - new_it.attrs.clear(); - new_it.ident = copy_name; - push(Annotatable::TraitItem(P(new_it))); - } - // covered in proc_macro/macros-in-extern.rs - Annotatable::ForeignItem(_) => unimplemented!(), - // covered in proc_macro/attr-stmt-expr.rs - Annotatable::Stmt(_) | Annotatable::Expr(_) => panic!("expected item") - } -} - -pub fn foo() {} diff --git a/src/test/ui-fulldeps/gated-plugin.rs b/src/test/ui-fulldeps/gated-plugin.rs index 3a138d9af03..a647585e621 100644 --- a/src/test/ui-fulldeps/gated-plugin.rs +++ b/src/test/ui-fulldeps/gated-plugin.rs @@ -1,6 +1,6 @@ -// aux-build:macro_crate_test.rs +// aux-build:attr_plugin_test.rs -#![plugin(macro_crate_test)] +#![plugin(attr_plugin_test)] //~^ ERROR compiler plugins are experimental and possibly buggy fn main() {} diff --git a/src/test/ui-fulldeps/gated-plugin.stderr b/src/test/ui-fulldeps/gated-plugin.stderr index a72a45833d0..37c2b443247 100644 --- a/src/test/ui-fulldeps/gated-plugin.stderr +++ b/src/test/ui-fulldeps/gated-plugin.stderr @@ -1,7 +1,7 @@ error[E0658]: compiler plugins are experimental and possibly buggy (see issue #29597) --> $DIR/gated-plugin.rs:3:1 | -LL | #![plugin(macro_crate_test)] +LL | #![plugin(attr_plugin_test)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add #![feature(plugin)] to the crate attributes to enable diff --git a/src/test/ui-fulldeps/gated-quote.rs b/src/test/ui-fulldeps/gated-quote.rs deleted file mode 100644 index 86848e3156f..00000000000 --- a/src/test/ui-fulldeps/gated-quote.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Test that `quote`-related macro are gated by `quote` feature gate. - -// (To sanity-check the code, uncomment this.) -// #![feature(quote)] - -// FIXME the error message that is current emitted seems pretty bad. - -// gate-test-quote - -#![feature(rustc_private)] -#![allow(dead_code, unused_imports, unused_variables)] - -#[macro_use] -extern crate syntax; - -use syntax::ast; -use syntax::parse; - -struct ParseSess; - -impl ParseSess { - fn cfg(&self) -> ast::CrateConfig { loop { } } - fn parse_sess<'a>(&'a self) -> &'a parse::ParseSess { loop { } } - fn call_site(&self) -> () { loop { } } - fn ident_of(&self, st: &str) -> ast::Ident { loop { } } - fn name_of(&self, st: &str) -> ast::Name { loop { } } -} - -pub fn main() { - let ecx = &ParseSess; - let x = quote_tokens!(ecx, 3); - //~^ ERROR cannot find macro `quote_tokens!` in this scope - let x = quote_expr!(ecx, 3); - //~^ ERROR cannot find macro `quote_expr!` in this scope - let x = quote_ty!(ecx, 3); - //~^ ERROR cannot find macro `quote_ty!` in this scope - let x = quote_method!(ecx, 3); - //~^ ERROR cannot find macro `quote_method!` in this scope - let x = quote_item!(ecx, 3); - //~^ ERROR cannot find macro `quote_item!` in this scope - let x = quote_pat!(ecx, 3); - //~^ ERROR cannot find macro `quote_pat!` in this scope - let x = quote_arm!(ecx, 3); - //~^ ERROR cannot find macro `quote_arm!` in this scope - let x = quote_stmt!(ecx, 3); - //~^ ERROR cannot find macro `quote_stmt!` in this scope - let x = quote_attr!(ecx, 3); - //~^ ERROR cannot find macro `quote_attr!` in this scope - let x = quote_arg!(ecx, 3); - //~^ ERROR cannot find macro `quote_arg!` in this scope - let x = quote_block!(ecx, 3); - //~^ ERROR cannot find macro `quote_block!` in this scope - let x = quote_meta_item!(ecx, 3); - //~^ ERROR cannot find macro `quote_meta_item!` in this scope - let x = quote_path!(ecx, 3); - //~^ ERROR cannot find macro `quote_path!` in this scope -} diff --git a/src/test/ui-fulldeps/gated-quote.stderr b/src/test/ui-fulldeps/gated-quote.stderr deleted file mode 100644 index 897e97b7eb1..00000000000 --- a/src/test/ui-fulldeps/gated-quote.stderr +++ /dev/null @@ -1,80 +0,0 @@ -error: cannot find macro `quote_path!` in this scope - --> $DIR/gated-quote.rs:55:13 - | -LL | let x = quote_path!(ecx, 3); - | ^^^^^^^^^^ - -error: cannot find macro `quote_meta_item!` in this scope - --> $DIR/gated-quote.rs:53:13 - | -LL | let x = quote_meta_item!(ecx, 3); - | ^^^^^^^^^^^^^^^ - -error: cannot find macro `quote_block!` in this scope - --> $DIR/gated-quote.rs:51:13 - | -LL | let x = quote_block!(ecx, 3); - | ^^^^^^^^^^^ - -error: cannot find macro `quote_arg!` in this scope - --> $DIR/gated-quote.rs:49:13 - | -LL | let x = quote_arg!(ecx, 3); - | ^^^^^^^^^ - -error: cannot find macro `quote_attr!` in this scope - --> $DIR/gated-quote.rs:47:13 - | -LL | let x = quote_attr!(ecx, 3); - | ^^^^^^^^^^ - -error: cannot find macro `quote_stmt!` in this scope - --> $DIR/gated-quote.rs:45:13 - | -LL | let x = quote_stmt!(ecx, 3); - | ^^^^^^^^^^ - -error: cannot find macro `quote_arm!` in this scope - --> $DIR/gated-quote.rs:43:13 - | -LL | let x = quote_arm!(ecx, 3); - | ^^^^^^^^^ - -error: cannot find macro `quote_pat!` in this scope - --> $DIR/gated-quote.rs:41:13 - | -LL | let x = quote_pat!(ecx, 3); - | ^^^^^^^^^ - -error: cannot find macro `quote_item!` in this scope - --> $DIR/gated-quote.rs:39:13 - | -LL | let x = quote_item!(ecx, 3); - | ^^^^^^^^^^ - -error: cannot find macro `quote_method!` in this scope - --> $DIR/gated-quote.rs:37:13 - | -LL | let x = quote_method!(ecx, 3); - | ^^^^^^^^^^^^ - -error: cannot find macro `quote_ty!` in this scope - --> $DIR/gated-quote.rs:35:13 - | -LL | let x = quote_ty!(ecx, 3); - | ^^^^^^^^ - -error: cannot find macro `quote_expr!` in this scope - --> $DIR/gated-quote.rs:33:13 - | -LL | let x = quote_expr!(ecx, 3); - | ^^^^^^^^^^ - -error: cannot find macro `quote_tokens!` in this scope - --> $DIR/gated-quote.rs:31:13 - | -LL | let x = quote_tokens!(ecx, 3); - | ^^^^^^^^^^^^ - -error: aborting due to 13 previous errors - diff --git a/src/test/ui-fulldeps/issue-48941.rs b/src/test/ui-fulldeps/issue-48941.rs deleted file mode 100644 index 8c4c2445670..00000000000 --- a/src/test/ui-fulldeps/issue-48941.rs +++ /dev/null @@ -1,16 +0,0 @@ -// This is a regression test against an ICE that used to occur -// on malformed attributes for a custom MultiModifier. - -// aux-build:macro_crate_test.rs -// ignore-stage1 - -#![feature(plugin)] -#![plugin(macro_crate_test)] - -#[noop_attribute("hi", rank = a)] //~ ERROR expected unsuffixed literal or identifier, found a -fn knight() { } - -#[noop_attribute("/user", data= = "<user")] //~ ERROR literal or identifier -fn nite() { } - -fn main() {} diff --git a/src/test/ui-fulldeps/issue-48941.stderr b/src/test/ui-fulldeps/issue-48941.stderr deleted file mode 100644 index 6ccea433049..00000000000 --- a/src/test/ui-fulldeps/issue-48941.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: expected unsuffixed literal or identifier, found a - --> $DIR/issue-48941.rs:10:24 - | -LL | #[noop_attribute("hi", rank = a)] //~ ERROR expected unsuffixed literal or identifier, found a - | ^^^^ - -error: expected unsuffixed literal or identifier, found = - --> $DIR/issue-48941.rs:13:27 - | -LL | #[noop_attribute("/user", data= = "<user")] //~ ERROR literal or identifier - | ^^^^ - -error: aborting due to 2 previous errors - diff --git a/src/test/ui-fulldeps/macro-crate-doesnt-resolve.rs b/src/test/ui-fulldeps/macro-crate-doesnt-resolve.rs deleted file mode 100644 index 1e8de1282a0..00000000000 --- a/src/test/ui-fulldeps/macro-crate-doesnt-resolve.rs +++ /dev/null @@ -1,8 +0,0 @@ -// aux-build:macro_crate_test.rs - -#[macro_use] #[no_link] -extern crate macro_crate_test; - -fn main() { - macro_crate_test::foo(); //~ ERROR cannot find function `foo` in module `macro_crate_test` -} diff --git a/src/test/ui-fulldeps/macro-crate-doesnt-resolve.stderr b/src/test/ui-fulldeps/macro-crate-doesnt-resolve.stderr deleted file mode 100644 index 510cedb0c20..00000000000 --- a/src/test/ui-fulldeps/macro-crate-doesnt-resolve.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0425]: cannot find function `foo` in module `macro_crate_test` - --> $DIR/macro-crate-doesnt-resolve.rs:7:23 - | -LL | macro_crate_test::foo(); //~ ERROR cannot find function `foo` in module `macro_crate_test` - | ^^^ not found in `macro_crate_test` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui-fulldeps/macro-crate-unexported-macro.rs b/src/test/ui-fulldeps/macro-crate-unexported-macro.rs deleted file mode 100644 index 8cf0cc4e4f3..00000000000 --- a/src/test/ui-fulldeps/macro-crate-unexported-macro.rs +++ /dev/null @@ -1,9 +0,0 @@ -// aux-build:macro_crate_test.rs - -#[macro_use] #[no_link] -extern crate macro_crate_test; - -fn main() { - unexported_macro!(); - //~^ ERROR cannot find macro `unexported_macro!` in this scope -} diff --git a/src/test/ui-fulldeps/macro-crate-unexported-macro.stderr b/src/test/ui-fulldeps/macro-crate-unexported-macro.stderr deleted file mode 100644 index 0d1b4b64fc5..00000000000 --- a/src/test/ui-fulldeps/macro-crate-unexported-macro.stderr +++ /dev/null @@ -1,8 +0,0 @@ -error: cannot find macro `unexported_macro!` in this scope - --> $DIR/macro-crate-unexported-macro.rs:7:5 - | -LL | unexported_macro!(); - | ^^^^^^^^^^^^^^^^ help: you could try the macro: `exported_macro` - -error: aborting due to previous error - diff --git a/src/test/ui-fulldeps/plugin-as-extern-crate.rs b/src/test/ui-fulldeps/plugin-as-extern-crate.rs index f192694dc73..37ac8dfa391 100644 --- a/src/test/ui-fulldeps/plugin-as-extern-crate.rs +++ b/src/test/ui-fulldeps/plugin-as-extern-crate.rs @@ -1,12 +1,12 @@ -// aux-build:macro_crate_test.rs +// aux-build:attr_plugin_test.rs // ignore-cross-compile // -// macro_crate_test will not compile on a cross-compiled target because +// attr_plugin_test will not compile on a cross-compiled target because // libsyntax is not compiled for it. #![deny(plugin_as_library)] #![allow(unused_extern_crates)] -extern crate macro_crate_test; //~ ERROR compiler plugin used as an ordinary library +extern crate attr_plugin_test; //~ ERROR compiler plugin used as an ordinary library fn main() { } diff --git a/src/test/ui-fulldeps/plugin-as-extern-crate.stderr b/src/test/ui-fulldeps/plugin-as-extern-crate.stderr index f0406d5181a..4a5a53980eb 100644 --- a/src/test/ui-fulldeps/plugin-as-extern-crate.stderr +++ b/src/test/ui-fulldeps/plugin-as-extern-crate.stderr @@ -1,7 +1,7 @@ error: compiler plugin used as an ordinary library --> $DIR/plugin-as-extern-crate.rs:10:1 | -LL | extern crate macro_crate_test; //~ ERROR compiler plugin used as an ordinary library +LL | extern crate attr_plugin_test; //~ ERROR compiler plugin used as an ordinary library | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: lint level defined here diff --git a/src/test/ui-fulldeps/plugin-plus-extern-crate.rs b/src/test/ui-fulldeps/plugin-plus-extern-crate.rs deleted file mode 100644 index db13954f8ed..00000000000 --- a/src/test/ui-fulldeps/plugin-plus-extern-crate.rs +++ /dev/null @@ -1,17 +0,0 @@ -// aux-build:macro_crate_test.rs -// ignore-stage1 -// ignore-cross-compile -// -// macro_crate_test will not compile on a cross-compiled target because -// libsyntax is not compiled for it. - -#![deny(plugin_as_library)] -#![feature(plugin)] -#![plugin(macro_crate_test)] - -extern crate macro_crate_test; //~ ERROR compiler plugin used as an ordinary library - -fn main() { - assert_eq!(1, make_a_1!()); - macro_crate_test::foo(); -} diff --git a/src/test/ui-fulldeps/plugin-plus-extern-crate.stderr b/src/test/ui-fulldeps/plugin-plus-extern-crate.stderr deleted file mode 100644 index 284d76b6132..00000000000 --- a/src/test/ui-fulldeps/plugin-plus-extern-crate.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error: compiler plugin used as an ordinary library - --> $DIR/plugin-plus-extern-crate.rs:12:1 - | -LL | extern crate macro_crate_test; //~ ERROR compiler plugin used as an ordinary library - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/plugin-plus-extern-crate.rs:8:9 - | -LL | #![deny(plugin_as_library)] - | ^^^^^^^^^^^^^^^^^ - -error: aborting due to previous error - diff --git a/src/test/ui-fulldeps/qquote.rs b/src/test/ui-fulldeps/qquote.rs deleted file mode 100644 index 99e365d21ff..00000000000 --- a/src/test/ui-fulldeps/qquote.rs +++ /dev/null @@ -1,27 +0,0 @@ -// ignore-cross-compile - -#![feature(quote, rustc_private)] - -extern crate syntax; -extern crate syntax_pos; - -use syntax::ast; -use syntax::source_map::FilePathMapping; -use syntax::print::pprust; -use syntax::symbol::Symbol; -use syntax_pos::DUMMY_SP; - -fn main() { - let ps = syntax::parse::ParseSess::new(FilePathMapping::empty()); - let mut resolver = syntax::ext::base::DummyResolver; - let mut cx = syntax::ext::base::ExtCtxt::new( - &ps, - syntax::ext::expand::ExpansionConfig::default("qquote".to_string()), - &mut resolver); - let cx = &mut cx; - - assert_eq!(pprust::expr_to_string(&*quote_expr!(&cx, 23)), "23"); - - let expr = quote_expr!(&cx, 2 - $abcd + 7); //~ ERROR cannot find value `abcd` in this scope - assert_eq!(pprust::expr_to_string(&*expr), "2 - $abcd + 7"); -} diff --git a/src/test/ui-fulldeps/qquote.stderr b/src/test/ui-fulldeps/qquote.stderr deleted file mode 100644 index a51318b0edc..00000000000 --- a/src/test/ui-fulldeps/qquote.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0425]: cannot find value `abcd` in this scope - --> $DIR/qquote.rs:25:38 - | -LL | let expr = quote_expr!(&cx, 2 - $abcd + 7); //~ ERROR cannot find value `abcd` in this scope - | ^^^^ not found in this scope - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/quote-with-interpolated.rs b/src/test/ui/quote-with-interpolated.rs deleted file mode 100644 index b948226652b..00000000000 --- a/src/test/ui/quote-with-interpolated.rs +++ /dev/null @@ -1,14 +0,0 @@ -#![feature(quote)] -fn main() { - macro_rules! foo { - ($bar:expr) => { - quote_expr!(cx, $bar) - //~^ ERROR quote! with interpolated token - //~| ERROR failed to resolve: maybe a missing `extern crate syntax;`? - //~| ERROR failed to resolve: maybe a missing `extern crate syntax;`? - //~| ERROR cannot find value `cx` in this scope - //~| ERROR cannot find function `new_parser_from_tts` in this scope - } - } - foo!(bar); -} diff --git a/src/test/ui/quote-with-interpolated.stderr b/src/test/ui/quote-with-interpolated.stderr deleted file mode 100644 index 96feff949bf..00000000000 --- a/src/test/ui/quote-with-interpolated.stderr +++ /dev/null @@ -1,40 +0,0 @@ -error: quote! with interpolated token - --> $DIR/quote-with-interpolated.rs:5:29 - | -LL | quote_expr!(cx, $bar) - | ^^^^ -... -LL | foo!(bar); - | ---------- in this macro invocation - -error[E0433]: failed to resolve: maybe a missing `extern crate syntax;`? - --> $DIR/quote-with-interpolated.rs:5:13 - | -LL | quote_expr!(cx, $bar) - | ^^^^^^^^^^^^^^^^^^^^^ maybe a missing `extern crate syntax;`? - -error[E0433]: failed to resolve: maybe a missing `extern crate syntax;`? - --> $DIR/quote-with-interpolated.rs:5:29 - | -LL | quote_expr!(cx, $bar) - | ^^^^ maybe a missing `extern crate syntax;`? - -error[E0425]: cannot find value `cx` in this scope - --> $DIR/quote-with-interpolated.rs:5:25 - | -LL | quote_expr!(cx, $bar) - | ^^ not found in this scope -... -LL | foo!(bar); - | ---------- in this macro invocation - -error[E0425]: cannot find function `new_parser_from_tts` in this scope - --> $DIR/quote-with-interpolated.rs:5:13 - | -LL | quote_expr!(cx, $bar) - | ^^^^^^^^^^^^^^^^^^^^^ not found in this scope - -error: aborting due to 5 previous errors - -Some errors occurred: E0425, E0433. -For more information about an error, try `rustc --explain E0425`. |
