diff options
| author | bors <bors@rust-lang.org> | 2018-08-08 08:37:56 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-08-08 08:37:56 +0000 |
| commit | ffb09dfb3a9b252e26cd4f6570e9ff1b8a742edc (patch) | |
| tree | 493e66a5c73fd6e5d81f7afcee1186c0ed106655 /src/test | |
| parent | 52c785bfc24e43c668c9022cc1e79edcd6dcfd7c (diff) | |
| parent | 50886115d7a7eba43b025e608aa156ef0e8dd7a8 (diff) | |
| download | rust-ffb09dfb3a9b252e26cd4f6570e9ff1b8a742edc.tar.gz rust-ffb09dfb3a9b252e26cd4f6570e9ff1b8a742edc.zip | |
Auto merge of #53053 - petrochenkov:custattr, r=alexcrichton
resolve: Support custom attributes when macro modularization is enabled Basically, if resolution of a single-segment attribute is a determined error, then we interpret it as a custom attribute. Since custom attributes are integrated into general macro resolution, `feature(custom_attribute)` now requires and implicitly enables macro modularization (`feature(use_extern_macros)`). Actually, a few other "advanced" macro features now implicitly enable macro modularization too (and one bug was found and fixed in process of enabling it). The first two commits are preliminary cleanups/refactorings.
Diffstat (limited to 'src/test')
57 files changed, 111 insertions, 132 deletions
diff --git a/src/test/compile-fail-fulldeps/proc-macro/attr-invalid-exprs.rs b/src/test/compile-fail-fulldeps/proc-macro/attr-invalid-exprs.rs index 64af21dbe10..91b72510e3e 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/attr-invalid-exprs.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/attr-invalid-exprs.rs @@ -13,7 +13,7 @@ //! Attributes producing expressions in invalid locations -#![feature(use_extern_macros, stmt_expr_attributes, proc_macro_expr)] +#![feature(stmt_expr_attributes, proc_macro_expr)] extern crate attr_stmt_expr; use attr_stmt_expr::{duplicate, no_output}; diff --git a/src/test/compile-fail-fulldeps/proc-macro/attr-stmt-expr.rs b/src/test/compile-fail-fulldeps/proc-macro/attr-stmt-expr.rs index 05b5c918ef0..52b2a473ecd 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/attr-stmt-expr.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/attr-stmt-expr.rs @@ -11,7 +11,7 @@ // aux-build:attr-stmt-expr.rs // ignore-stage1 -#![feature(use_extern_macros, proc_macro_expr)] +#![feature(proc_macro_expr)] extern crate attr_stmt_expr; use attr_stmt_expr::{expect_let, expect_print_stmt, expect_expr, expect_print_expr}; diff --git a/src/test/compile-fail-fulldeps/proc-macro/issue-41211.rs b/src/test/compile-fail-fulldeps/proc-macro/issue-41211.rs index 8fced7d8c70..f71d4b86f1e 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/issue-41211.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/issue-41211.rs @@ -15,7 +15,7 @@ #![feature(use_extern_macros)] #![emit_unchanged] -//~^ ERROR: cannot find attribute macro `emit_unchanged` in this scope +//~^ ERROR attribute `emit_unchanged` is currently unknown to the compiler extern crate issue_41211; use issue_41211::emit_unchanged; diff --git a/src/test/compile-fail-fulldeps/proc-macro/issue-50493.rs b/src/test/compile-fail-fulldeps/proc-macro/issue-50493.rs index 51112f202c8..eaa64c6ba36 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/issue-50493.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/issue-50493.rs @@ -11,8 +11,6 @@ // aux-build:issue_50493.rs // ignore-stage1 -#![feature(proc_macro)] - #[macro_use] extern crate issue_50493; diff --git a/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs b/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs index 6473b69b459..6e9d231ea99 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs @@ -11,7 +11,7 @@ // aux-build:bang_proc_macro2.rs // ignore-stage1 -#![feature(use_extern_macros, proc_macro_non_items)] +#![feature(proc_macro_non_items)] #![allow(unused_macros)] extern crate bang_proc_macro2; diff --git a/src/test/compile-fail-fulldeps/proc-macro/macros-in-extern.rs b/src/test/compile-fail-fulldeps/proc-macro/macros-in-extern.rs index 9a35dc0edc4..e418ecc114c 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/macros-in-extern.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/macros-in-extern.rs @@ -26,13 +26,13 @@ fn main() { #[link(name = "rust_test_helpers", kind = "static")] extern { #[no_output] - //~^ ERROR macro and proc-macro invocations in `extern {}` blocks are experimental. + //~^ ERROR macro invocations in `extern {}` blocks are experimental fn some_definitely_unknown_symbol_which_should_be_removed(); #[nop_attr] - //~^ ERROR macro and proc-macro invocations in `extern {}` blocks are experimental. + //~^ ERROR macro invocations in `extern {}` blocks are experimental fn rust_get_test_int() -> isize; emit_input!(fn rust_dbg_extern_identity_u32(arg: u32) -> u32;); - //~^ ERROR macro and proc-macro invocations in `extern {}` blocks are experimental. + //~^ ERROR macro invocations in `extern {}` blocks are experimental } diff --git a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates.rs b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates.rs index 51b1bfca294..9a0171c2ae5 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates.rs @@ -16,7 +16,7 @@ // gate-test-proc_macro_mod // gate-test-proc_macro_gen -#![feature(use_extern_macros, stmt_expr_attributes)] +#![feature(stmt_expr_attributes)] extern crate proc_macro_gates as foo; diff --git a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates2.rs b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates2.rs index ef6d4557f4c..dc182414a1d 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates2.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates2.rs @@ -10,7 +10,7 @@ // aux-build:proc-macro-gates.rs -#![feature(use_extern_macros, stmt_expr_attributes)] +#![feature(stmt_expr_attributes)] extern crate proc_macro_gates as foo; diff --git a/src/test/compile-fail/macro-with-seps-err-msg.rs b/src/test/compile-fail/macro-with-seps-err-msg.rs index 6567a100d8c..1281adce5c5 100644 --- a/src/test/compile-fail/macro-with-seps-err-msg.rs +++ b/src/test/compile-fail/macro-with-seps-err-msg.rs @@ -10,10 +10,6 @@ // gate-test-use_extern_macros -#![feature(proc_macro_path_invoc)] - fn main() { globnar::brotz!(); //~ ERROR non-ident macro paths are experimental - #[derive(foo::Bar)] struct T; //~ ERROR non-ident macro paths are experimental - ::foo!(); //~ ERROR non-ident macro paths are experimental } diff --git a/src/test/compile-fail/macros-in-extern.rs b/src/test/compile-fail/macros-in-extern.rs index b6e273881cc..40053853b15 100644 --- a/src/test/compile-fail/macros-in-extern.rs +++ b/src/test/compile-fail/macros-in-extern.rs @@ -34,9 +34,9 @@ fn main() { #[link(name = "rust_test_helpers", kind = "static")] extern { returns_isize!(rust_get_test_int); - //~^ ERROR macro invocations in `extern {}` blocks are experimental. + //~^ ERROR macro invocations in `extern {}` blocks are experimental takes_u32_returns_u32!(rust_dbg_extern_identity_u32); - //~^ ERROR macro invocations in `extern {}` blocks are experimental. + //~^ ERROR macro invocations in `extern {}` blocks are experimental emits_nothing!(); - //~^ ERROR macro invocations in `extern {}` blocks are experimental. + //~^ ERROR macro invocations in `extern {}` blocks are experimental } diff --git a/src/test/compile-fail/stmt_expr_attrs_no_feature.rs b/src/test/compile-fail/stmt_expr_attrs_no_feature.rs index d8626dfd39e..896817bb858 100644 --- a/src/test/compile-fail/stmt_expr_attrs_no_feature.rs +++ b/src/test/compile-fail/stmt_expr_attrs_no_feature.rs @@ -20,7 +20,7 @@ fn main() { #[attr] fn a() {} - #[attr] + #[attr] //~ ERROR attributes on expressions are experimental { } diff --git a/src/test/compile-fail/unknown-tool-name.rs b/src/test/compile-fail/unknown-tool-name.rs index c4d22e6d392..99c336c28cd 100644 --- a/src/test/compile-fail/unknown-tool-name.rs +++ b/src/test/compile-fail/unknown-tool-name.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(use_extern_macros, proc_macro_path_invoc)] +#![feature(proc_macro_path_invoc)] #[foo::bar] //~ ERROR failed to resolve. Use of undeclared type or module `foo` fn main() {} diff --git a/src/test/pretty/attr-literals.rs b/src/test/pretty/attr-literals.rs index ba8c580cb0a..ce157e3632c 100644 --- a/src/test/pretty/attr-literals.rs +++ b/src/test/pretty/attr-literals.rs @@ -18,6 +18,6 @@ fn main() { #[align = 8] fn f() { } - #[vec(1, 2, 3)] + #[vector(1, 2, 3)] fn g() { } } diff --git a/src/test/run-pass-fulldeps/auxiliary/cond_plugin.rs b/src/test/run-pass-fulldeps/auxiliary/cond_plugin.rs index ec6f54fb137..94c5b208a37 100644 --- a/src/test/run-pass-fulldeps/auxiliary/cond_plugin.rs +++ b/src/test/run-pass-fulldeps/auxiliary/cond_plugin.rs @@ -11,7 +11,7 @@ // no-prefer-dynamic #![crate_type = "proc-macro"] -#![feature(proc_macro, proc_macro_non_items)] +#![feature(proc_macro_non_items)] extern crate proc_macro; diff --git a/src/test/run-pass-fulldeps/auxiliary/hello_macro.rs b/src/test/run-pass-fulldeps/auxiliary/hello_macro.rs index 545eabe00ff..b54543c73fb 100644 --- a/src/test/run-pass-fulldeps/auxiliary/hello_macro.rs +++ b/src/test/run-pass-fulldeps/auxiliary/hello_macro.rs @@ -11,7 +11,7 @@ // no-prefer-dynamic #![crate_type = "proc-macro"] -#![feature(use_extern_macros, proc_macro_non_items, proc_macro_quote)] +#![feature(proc_macro_non_items, proc_macro_quote)] extern crate proc_macro; diff --git a/src/test/run-pass-fulldeps/auxiliary/proc_macro_def.rs b/src/test/run-pass-fulldeps/auxiliary/proc_macro_def.rs index 9a5bffb92a4..9faa7366ec5 100644 --- a/src/test/run-pass-fulldeps/auxiliary/proc_macro_def.rs +++ b/src/test/run-pass-fulldeps/auxiliary/proc_macro_def.rs @@ -11,7 +11,7 @@ // no-prefer-dynamic #![crate_type = "proc-macro"] -#![feature(proc_macro, proc_macro_non_items)] +#![feature(proc_macro_non_items)] extern crate proc_macro; diff --git a/src/test/run-pass-fulldeps/macro-quote-cond.rs b/src/test/run-pass-fulldeps/macro-quote-cond.rs index f1dcec8af69..3eb7e8cc9a4 100644 --- a/src/test/run-pass-fulldeps/macro-quote-cond.rs +++ b/src/test/run-pass-fulldeps/macro-quote-cond.rs @@ -11,7 +11,7 @@ // aux-build:cond_plugin.rs // ignore-stage1 -#![feature(use_extern_macros, proc_macro_non_items)] +#![feature(proc_macro_non_items)] extern crate cond_plugin; diff --git a/src/test/run-pass-fulldeps/macro-quote-test.rs b/src/test/run-pass-fulldeps/macro-quote-test.rs index 2349fa68c65..1005a6bfc50 100644 --- a/src/test/run-pass-fulldeps/macro-quote-test.rs +++ b/src/test/run-pass-fulldeps/macro-quote-test.rs @@ -13,7 +13,7 @@ // aux-build:hello_macro.rs // ignore-stage1 -#![feature(use_extern_macros, proc_macro_non_items, proc_macro_gen)] +#![feature(proc_macro_non_items, proc_macro_gen)] extern crate hello_macro; diff --git a/src/test/run-pass-fulldeps/proc-macro/attr-stmt-expr.rs b/src/test/run-pass-fulldeps/proc-macro/attr-stmt-expr.rs index 3356828c04b..b5272e6608b 100644 --- a/src/test/run-pass-fulldeps/proc-macro/attr-stmt-expr.rs +++ b/src/test/run-pass-fulldeps/proc-macro/attr-stmt-expr.rs @@ -11,7 +11,7 @@ // aux-build:attr-stmt-expr.rs // ignore-stage1 -#![feature(use_extern_macros, stmt_expr_attributes, proc_macro_expr)] +#![feature(stmt_expr_attributes, proc_macro_expr)] extern crate attr_stmt_expr; use attr_stmt_expr::{expect_let, expect_print_stmt, expect_expr, expect_print_expr, diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/count_compound_ops.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/count_compound_ops.rs index c6bcc37ac4a..a84e029f9d8 100644 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/count_compound_ops.rs +++ b/src/test/run-pass-fulldeps/proc-macro/auxiliary/count_compound_ops.rs @@ -10,7 +10,7 @@ // no-prefer-dynamic -#![feature(proc_macro_non_items, proc_macro_quote, use_extern_macros)] +#![feature(proc_macro_non_items, proc_macro_quote)] #![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example_codegen.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example_codegen.rs index 8f95bdd9c39..43c1d5fcc8d 100644 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example_codegen.rs +++ b/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example_codegen.rs @@ -10,7 +10,7 @@ // no-prefer-dynamic -#![feature(use_extern_macros, proc_macro_quote, proc_macro_non_items)] +#![feature(proc_macro_quote, proc_macro_non_items)] #![crate_type = "proc-macro"] extern crate proc_macro as proc_macro_renamed; // This does not break `quote!` diff --git a/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs b/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs index f9d17a9decb..955b6ab986d 100644 --- a/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs +++ b/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs @@ -11,7 +11,7 @@ // aux-build:bang-macro.rs // ignore-stage1 -#![feature(use_extern_macros, proc_macro_non_items)] +#![feature(proc_macro_non_items)] extern crate bang_macro; use bang_macro::rewrite; diff --git a/src/test/run-pass-fulldeps/proc-macro/call-site.rs b/src/test/run-pass-fulldeps/proc-macro/call-site.rs index 505994f66e7..dfe97eb587c 100644 --- a/src/test/run-pass-fulldeps/proc-macro/call-site.rs +++ b/src/test/run-pass-fulldeps/proc-macro/call-site.rs @@ -11,7 +11,7 @@ // aux-build:call-site.rs // ignore-stage1 -#![feature(proc_macro_non_items, use_extern_macros)] +#![feature(proc_macro_non_items)] extern crate call_site; use call_site::*; diff --git a/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs b/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs index f4a51d0624a..6601d66e586 100644 --- a/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs +++ b/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs @@ -11,7 +11,7 @@ // aux-build:count_compound_ops.rs // ignore-stage1 -#![feature(use_extern_macros, proc_macro_non_items)] +#![feature(proc_macro_non_items)] extern crate count_compound_ops; use count_compound_ops::count_compound_ops; diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-b.rs b/src/test/run-pass-fulldeps/proc-macro/derive-b.rs index 35d5084d9f6..4a7c8f3e834 100644 --- a/src/test/run-pass-fulldeps/proc-macro/derive-b.rs +++ b/src/test/run-pass-fulldeps/proc-macro/derive-b.rs @@ -11,7 +11,7 @@ // aux-build:derive-b.rs // ignore-stage1 -#![feature(use_extern_macros, proc_macro_path_invoc)] +#![feature(proc_macro_path_invoc)] extern crate derive_b; diff --git a/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs b/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs index 5ee164415a1..579e8c33773 100644 --- a/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs +++ b/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs @@ -12,7 +12,7 @@ // aux-build:hygiene_example.rs // ignore-stage1 -#![feature(use_extern_macros, proc_macro_non_items)] +#![feature(proc_macro_non_items)] extern crate hygiene_example; use hygiene_example::hello; diff --git a/src/test/run-pass-fulldeps/proc-macro/macros-in-extern.rs b/src/test/run-pass-fulldeps/proc-macro/macros-in-extern.rs index e5f8c844b6b..bd76cc38054 100644 --- a/src/test/run-pass-fulldeps/proc-macro/macros-in-extern.rs +++ b/src/test/run-pass-fulldeps/proc-macro/macros-in-extern.rs @@ -12,7 +12,7 @@ // ignore-stage1 // ignore-wasm32 -#![feature(use_extern_macros, macros_in_extern)] +#![feature(macros_in_extern)] extern crate test_macros; diff --git a/src/test/run-pass-fulldeps/proc_macro.rs b/src/test/run-pass-fulldeps/proc_macro.rs index 46b62d7e34a..c9d7b0423ec 100644 --- a/src/test/run-pass-fulldeps/proc_macro.rs +++ b/src/test/run-pass-fulldeps/proc_macro.rs @@ -12,7 +12,7 @@ // ignore-stage1 // ignore-cross-compile -#![feature(use_extern_macros, proc_macro_non_items)] +#![feature(proc_macro_non_items)] extern crate proc_macro_def; diff --git a/src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs b/src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs index db0c19e96f8..679cb772868 100644 --- a/src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs +++ b/src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs @@ -10,7 +10,7 @@ // force-host // no-prefer-dynamic -#![feature(proc_macro)] + #![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs b/src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs index 89ac11b309d..6484725814a 100644 --- a/src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs +++ b/src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs @@ -10,7 +10,7 @@ // force-host // no-prefer-dynamic -#![feature(proc_macro)] + #![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/src/test/ui-fulldeps/auxiliary/lifetimes.rs b/src/test/ui-fulldeps/auxiliary/lifetimes.rs index ecf0a56edf7..fc59a622bfa 100644 --- a/src/test/ui-fulldeps/auxiliary/lifetimes.rs +++ b/src/test/ui-fulldeps/auxiliary/lifetimes.rs @@ -10,7 +10,6 @@ // no-prefer-dynamic -#![feature(proc_macro)] #![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/src/test/ui-fulldeps/lifetimes.rs b/src/test/ui-fulldeps/lifetimes.rs index 3200e8fb2b1..6879848d269 100644 --- a/src/test/ui-fulldeps/lifetimes.rs +++ b/src/test/ui-fulldeps/lifetimes.rs @@ -10,7 +10,7 @@ // aux-build:lifetimes.rs -#![feature(use_extern_macros, proc_macro_non_items)] +#![feature(proc_macro_non_items)] extern crate lifetimes; diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/generate-mod.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/generate-mod.rs index 632dba42ad0..1ed8ef52027 100644 --- a/src/test/ui-fulldeps/proc-macro/auxiliary/generate-mod.rs +++ b/src/test/ui-fulldeps/proc-macro/auxiliary/generate-mod.rs @@ -11,7 +11,6 @@ // run-pass // no-prefer-dynamic -#![feature(proc_macro)] #![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/src/test/ui-fulldeps/proc-macro/generate-mod.rs b/src/test/ui-fulldeps/proc-macro/generate-mod.rs index ee0077c3ed3..b0cccd8728b 100644 --- a/src/test/ui-fulldeps/proc-macro/generate-mod.rs +++ b/src/test/ui-fulldeps/proc-macro/generate-mod.rs @@ -12,7 +12,7 @@ // aux-build:generate-mod.rs -#![feature(use_extern_macros, proc_macro_gen, proc_macro_path_invoc)] +#![feature(proc_macro_gen, proc_macro_path_invoc)] extern crate generate_mod; diff --git a/src/test/ui-fulldeps/proc-macro/invalid-attributes.rs b/src/test/ui-fulldeps/proc-macro/invalid-attributes.rs index c06f98ed5ff..8b940a0f405 100644 --- a/src/test/ui-fulldeps/proc-macro/invalid-attributes.rs +++ b/src/test/ui-fulldeps/proc-macro/invalid-attributes.rs @@ -11,7 +11,6 @@ // no-prefer-dynamic #![crate_type = "proc-macro"] -#![feature(proc_macro)] extern crate proc_macro; diff --git a/src/test/ui-fulldeps/proc-macro/invalid-attributes.stderr b/src/test/ui-fulldeps/proc-macro/invalid-attributes.stderr index c480bcb5df9..5fd87362db2 100644 --- a/src/test/ui-fulldeps/proc-macro/invalid-attributes.stderr +++ b/src/test/ui-fulldeps/proc-macro/invalid-attributes.stderr @@ -1,35 +1,35 @@ error: `#[proc_macro]` attribute does not take any arguments - --> $DIR/invalid-attributes.rs:20:1 + --> $DIR/invalid-attributes.rs:19:1 | LL | #[proc_macro = "test"] //~ ERROR: does not take any arguments | ^^^^^^^^^^^^^^^^^^^^^^ error: `#[proc_macro]` attribute does not take any arguments - --> $DIR/invalid-attributes.rs:23:1 + --> $DIR/invalid-attributes.rs:22:1 | LL | #[proc_macro()] //~ ERROR: does not take any arguments | ^^^^^^^^^^^^^^^ error: `#[proc_macro]` attribute does not take any arguments - --> $DIR/invalid-attributes.rs:26:1 + --> $DIR/invalid-attributes.rs:25:1 | LL | #[proc_macro(x)] //~ ERROR: does not take any arguments | ^^^^^^^^^^^^^^^^ error: `#[proc_macro_attribute]` attribute does not take any arguments - --> $DIR/invalid-attributes.rs:29:1 + --> $DIR/invalid-attributes.rs:28:1 | LL | #[proc_macro_attribute = "test"] //~ ERROR: does not take any arguments | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[proc_macro_attribute]` attribute does not take any arguments - --> $DIR/invalid-attributes.rs:32:1 + --> $DIR/invalid-attributes.rs:31:1 | LL | #[proc_macro_attribute()] //~ ERROR: does not take any arguments | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[proc_macro_attribute]` attribute does not take any arguments - --> $DIR/invalid-attributes.rs:35:1 + --> $DIR/invalid-attributes.rs:34:1 | LL | #[proc_macro_attribute(x)] //~ ERROR: does not take any arguments | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.rs b/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.rs index 21d625ae09d..e7bb05de88c 100644 --- a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.rs +++ b/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.rs @@ -10,7 +10,7 @@ // no-prefer-dynamic -#![feature(proc_macro, decl_macro)] +#![feature(decl_macro)] #![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/src/test/ui-fulldeps/proc-macro/non-root.rs b/src/test/ui-fulldeps/proc-macro/non-root.rs index 288c63b4c77..24404885788 100644 --- a/src/test/ui-fulldeps/proc-macro/non-root.rs +++ b/src/test/ui-fulldeps/proc-macro/non-root.rs @@ -10,7 +10,6 @@ // no-prefer-dynamic -#![feature(proc_macro)] #![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/src/test/ui-fulldeps/proc-macro/non-root.stderr b/src/test/ui-fulldeps/proc-macro/non-root.stderr index 8c14f644d7a..23222a2b851 100644 --- a/src/test/ui-fulldeps/proc-macro/non-root.stderr +++ b/src/test/ui-fulldeps/proc-macro/non-root.stderr @@ -1,5 +1,5 @@ error: functions tagged with `#[proc_macro]` must currently reside in the root of the crate - --> $DIR/non-root.rs:21:5 + --> $DIR/non-root.rs:20:5 | LL | pub fn foo(arg: TokenStream) -> TokenStream { arg } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui-fulldeps/proc-macro/three-equals.rs b/src/test/ui-fulldeps/proc-macro/three-equals.rs index ee5f3b33a06..f6b0e90da00 100644 --- a/src/test/ui-fulldeps/proc-macro/three-equals.rs +++ b/src/test/ui-fulldeps/proc-macro/three-equals.rs @@ -11,7 +11,7 @@ // aux-build:three-equals.rs // ignore-stage1 -#![feature(use_extern_macros, proc_macro_non_items)] +#![feature(proc_macro_non_items)] extern crate three_equals; diff --git a/src/test/ui-fulldeps/resolve-error.rs b/src/test/ui-fulldeps/resolve-error.rs index df9b263534f..1940151357c 100644 --- a/src/test/ui-fulldeps/resolve-error.rs +++ b/src/test/ui-fulldeps/resolve-error.rs @@ -13,7 +13,7 @@ // aux-build:attr_proc_macro.rs // aux-build:bang_proc_macro.rs -#![feature(use_extern_macros)] +#![feature(custom_attribute)] #[macro_use] extern crate derive_foo; @@ -37,12 +37,10 @@ macro_rules! attr_proc_mac { //~^ ERROR cannot find struct Foo; -#[attr_proc_macra] -//~^ ERROR cannot find +#[attr_proc_macra] // OK, interpreted as a custom attribute struct Bar; -#[FooWithLongNan] -//~^ ERROR cannot find +#[FooWithLongNan] // OK, interpreted as a custom attribute struct Asdf; #[derive(Dlone)] diff --git a/src/test/ui-fulldeps/resolve-error.stderr b/src/test/ui-fulldeps/resolve-error.stderr index caa79664614..278409c688a 100644 --- a/src/test/ui-fulldeps/resolve-error.stderr +++ b/src/test/ui-fulldeps/resolve-error.stderr @@ -4,59 +4,47 @@ error: cannot find derive macro `FooWithLongNan` in this scope LL | #[derive(FooWithLongNan)] | ^^^^^^^^^^^^^^ help: try: `FooWithLongName` -error: cannot find attribute macro `attr_proc_macra` in this scope - --> $DIR/resolve-error.rs:40:3 - | -LL | #[attr_proc_macra] - | ^^^^^^^^^^^^^^^ help: try: `attr_proc_macro` - -error: cannot find attribute macro `FooWithLongNan` in this scope - --> $DIR/resolve-error.rs:44:3 - | -LL | #[FooWithLongNan] - | ^^^^^^^^^^^^^^ - error: cannot find derive macro `Dlone` in this scope - --> $DIR/resolve-error.rs:48:10 + --> $DIR/resolve-error.rs:46:10 | LL | #[derive(Dlone)] | ^^^^^ help: try: `Clone` error: cannot find derive macro `Dlona` in this scope - --> $DIR/resolve-error.rs:52:10 + --> $DIR/resolve-error.rs:50:10 | LL | #[derive(Dlona)] | ^^^^^ help: try: `Clona` error: cannot find derive macro `attr_proc_macra` in this scope - --> $DIR/resolve-error.rs:56:10 + --> $DIR/resolve-error.rs:54:10 | LL | #[derive(attr_proc_macra)] | ^^^^^^^^^^^^^^^ error: cannot find macro `FooWithLongNama!` in this scope - --> $DIR/resolve-error.rs:61:5 + --> $DIR/resolve-error.rs:59:5 | LL | FooWithLongNama!(); | ^^^^^^^^^^^^^^^ help: you could try the macro: `FooWithLongNam` error: cannot find macro `attr_proc_macra!` in this scope - --> $DIR/resolve-error.rs:64:5 + --> $DIR/resolve-error.rs:62:5 | LL | attr_proc_macra!(); | ^^^^^^^^^^^^^^^ help: you could try the macro: `attr_proc_mac` error: cannot find macro `Dlona!` in this scope - --> $DIR/resolve-error.rs:67:5 + --> $DIR/resolve-error.rs:65:5 | LL | Dlona!(); | ^^^^^ error: cannot find macro `bang_proc_macrp!` in this scope - --> $DIR/resolve-error.rs:70:5 + --> $DIR/resolve-error.rs:68:5 | LL | bang_proc_macrp!(); | ^^^^^^^^^^^^^^^ help: you could try the macro: `bang_proc_macro` -error: aborting due to 10 previous errors +error: aborting due to 8 previous errors diff --git a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-custom-attr-mutex.rs b/src/test/ui/custom-attribute-multisegment.rs index 9ed665b6e68..ad8e0e76e14 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-custom-attr-mutex.rs +++ b/src/test/ui/custom-attribute-multisegment.rs @@ -1,4 +1,4 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -8,18 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// aux-build:attr_proc_macro.rs -// ignore-tidy-linelength +// Unresolved multi-segment attributes are not treated as custom. -#![feature(use_extern_macros, custom_attribute)] -//~^ ERROR Cannot use `#![feature(use_extern_macros)]` and `#![feature(custom_attribute)] at the same time +#![feature(custom_attribute, proc_macro_path_invoc)] -extern crate attr_proc_macro; -use attr_proc_macro::attr_proc_macro; +mod existent {} -#[attr_proc_macro] -fn foo() {} - -fn main() { - foo(); -} +#[existent::nonexistent] //~ ERROR failed to resolve. Could not find `nonexistent` in `existent` +fn main() {} diff --git a/src/test/ui/custom-attribute-multisegment.stderr b/src/test/ui/custom-attribute-multisegment.stderr new file mode 100644 index 00000000000..ff72d1c36d8 --- /dev/null +++ b/src/test/ui/custom-attribute-multisegment.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve. Could not find `nonexistent` in `existent` + --> $DIR/custom-attribute-multisegment.rs:17:13 + | +LL | #[existent::nonexistent] //~ ERROR failed to resolve. Could not find `nonexistent` in `existent` + | ^^^^^^^^^^^ Could not find `nonexistent` in `existent` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/src/test/ui/feature-gate-macros_in_extern.rs b/src/test/ui/feature-gate-macros_in_extern.rs index 5271f75b632..77080e3c348 100644 --- a/src/test/ui/feature-gate-macros_in_extern.rs +++ b/src/test/ui/feature-gate-macros_in_extern.rs @@ -27,9 +27,9 @@ macro_rules! emits_nothing( #[link(name = "rust_test_helpers", kind = "static")] extern { returns_isize!(rust_get_test_int); - //~^ ERROR macro invocations in `extern {}` blocks are experimental. + //~^ ERROR macro invocations in `extern {}` blocks are experimental takes_u32_returns_u32!(rust_dbg_extern_identity_u32); - //~^ ERROR macro invocations in `extern {}` blocks are experimental. + //~^ ERROR macro invocations in `extern {}` blocks are experimental emits_nothing!(); - //~^ ERROR macro invocations in `extern {}` blocks are experimental. + //~^ ERROR macro invocations in `extern {}` blocks are experimental } diff --git a/src/test/ui/feature-gate-macros_in_extern.stderr b/src/test/ui/feature-gate-macros_in_extern.stderr index 5d7e01fbbb7..23b63078dbf 100644 --- a/src/test/ui/feature-gate-macros_in_extern.stderr +++ b/src/test/ui/feature-gate-macros_in_extern.stderr @@ -1,4 +1,4 @@ -error[E0658]: macro and proc-macro invocations in `extern {}` blocks are experimental. (see issue #49476) +error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476) --> $DIR/feature-gate-macros_in_extern.rs:29:5 | LL | returns_isize!(rust_get_test_int); @@ -6,7 +6,7 @@ LL | returns_isize!(rust_get_test_int); | = help: add #![feature(macros_in_extern)] to the crate attributes to enable -error[E0658]: macro and proc-macro invocations in `extern {}` blocks are experimental. (see issue #49476) +error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476) --> $DIR/feature-gate-macros_in_extern.rs:31:5 | LL | takes_u32_returns_u32!(rust_dbg_extern_identity_u32); @@ -14,7 +14,7 @@ LL | takes_u32_returns_u32!(rust_dbg_extern_identity_u32); | = help: add #![feature(macros_in_extern)] to the crate attributes to enable -error[E0658]: macro and proc-macro invocations in `extern {}` blocks are experimental. (see issue #49476) +error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476) --> $DIR/feature-gate-macros_in_extern.rs:33:5 | LL | emits_nothing!(); diff --git a/src/test/ui/imports/macros.rs b/src/test/ui/imports/macros.rs index 5d6a1191384..ed5907800e9 100644 --- a/src/test/ui/imports/macros.rs +++ b/src/test/ui/imports/macros.rs @@ -10,7 +10,7 @@ // aux-build:two_macros.rs -#![feature(item_like_imports, use_extern_macros)] +#![feature(use_extern_macros)] extern crate two_macros; // two identity macros `m` and `n` diff --git a/src/test/ui/issue-11692-2.rs b/src/test/ui/issue-11692-2.rs index c595b0fb2c2..50525e03acf 100644 --- a/src/test/ui/issue-11692-2.rs +++ b/src/test/ui/issue-11692-2.rs @@ -10,5 +10,5 @@ fn main() { concat!(test!()); - //~^ ERROR expected a macro, found non-macro attribute + //~^ ERROR expected a macro, found built-in attribute } diff --git a/src/test/ui/issue-11692-2.stderr b/src/test/ui/issue-11692-2.stderr index 3d080bd46dc..0c130943fd8 100644 --- a/src/test/ui/issue-11692-2.stderr +++ b/src/test/ui/issue-11692-2.stderr @@ -1,4 +1,4 @@ -error: expected a macro, found non-macro attribute +error: expected a macro, found built-in attribute --> $DIR/issue-11692-2.rs:12:13 | LL | concat!(test!()); diff --git a/src/test/ui/macro-path-prelude-fail-3.rs b/src/test/ui/macro-path-prelude-fail-3.rs index 4cf90019d40..bdbc7bd660f 100644 --- a/src/test/ui/macro-path-prelude-fail-3.rs +++ b/src/test/ui/macro-path-prelude-fail-3.rs @@ -10,9 +10,9 @@ #![feature(use_extern_macros)] -#[derive(inline)] //~ ERROR expected a macro, found non-macro attribute +#[derive(inline)] //~ ERROR expected a macro, found built-in attribute struct S; fn main() { - inline!(); //~ ERROR expected a macro, found non-macro attribute + inline!(); //~ ERROR expected a macro, found built-in attribute } diff --git a/src/test/ui/macro-path-prelude-fail-3.stderr b/src/test/ui/macro-path-prelude-fail-3.stderr index bd1015b7ee1..396bba2408f 100644 --- a/src/test/ui/macro-path-prelude-fail-3.stderr +++ b/src/test/ui/macro-path-prelude-fail-3.stderr @@ -1,13 +1,13 @@ -error: expected a macro, found non-macro attribute +error: expected a macro, found built-in attribute --> $DIR/macro-path-prelude-fail-3.rs:13:10 | -LL | #[derive(inline)] //~ ERROR expected a macro, found non-macro attribute +LL | #[derive(inline)] //~ ERROR expected a macro, found built-in attribute | ^^^^^^ -error: expected a macro, found non-macro attribute +error: expected a macro, found built-in attribute --> $DIR/macro-path-prelude-fail-3.rs:17:5 | -LL | inline!(); //~ ERROR expected a macro, found non-macro attribute +LL | inline!(); //~ ERROR expected a macro, found built-in attribute | ^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/tool-attributes-disabled-2.rs b/src/test/ui/tool-attributes-disabled-2.rs index 160dda05b1e..2d97e160f49 100644 --- a/src/test/ui/tool-attributes-disabled-2.rs +++ b/src/test/ui/tool-attributes-disabled-2.rs @@ -11,9 +11,5 @@ // If macro modularization (`use_extern_macros`) is not enabled, // then tool attributes are treated as custom attributes. -// compile-pass - -#![feature(custom_attribute)] - -#[rustfmt::bar] +#[rustfmt::bar] //~ ERROR attribute `rustfmt::bar` is currently unknown to the compiler fn main() {} diff --git a/src/test/ui/tool-attributes-disabled-2.stderr b/src/test/ui/tool-attributes-disabled-2.stderr new file mode 100644 index 00000000000..b327773dd6a --- /dev/null +++ b/src/test/ui/tool-attributes-disabled-2.stderr @@ -0,0 +1,11 @@ +error[E0658]: The attribute `rustfmt::bar` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/tool-attributes-disabled-2.rs:14:1 + | +LL | #[rustfmt::bar] //~ ERROR attribute `rustfmt::bar` is currently unknown to the compiler + | ^^^^^^^^^^^^^^^ + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/tool-attributes-misplaced-1.rs b/src/test/ui/tool-attributes-misplaced-1.rs index b3355352423..7a6b9ae9943 100644 --- a/src/test/ui/tool-attributes-misplaced-1.rs +++ b/src/test/ui/tool-attributes-misplaced-1.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(tool_attributes)] +#![feature(tool_attributes, custom_attribute)] type A = rustfmt; //~ ERROR expected type, found tool module `rustfmt` -type B = rustfmt::skip; //~ ERROR expected type, found non-macro attribute `rustfmt::skip` +type B = rustfmt::skip; //~ ERROR expected type, found tool attribute `rustfmt::skip` #[derive(rustfmt)] //~ ERROR cannot find derive macro `rustfmt` in this scope struct S; -#[rustfmt] //~ ERROR cannot find attribute macro `rustfmt` in this scope +#[rustfmt] // OK, interpreted as a custom attribute fn check() {} #[rustfmt::skip] // OK @@ -24,5 +24,5 @@ fn main() { rustfmt; //~ ERROR expected value, found tool module `rustfmt` rustfmt!(); //~ ERROR cannot find macro `rustfmt!` in this scope - rustfmt::skip; //~ ERROR expected value, found non-macro attribute `rustfmt::skip` + rustfmt::skip; //~ ERROR expected value, found tool attribute `rustfmt::skip` } diff --git a/src/test/ui/tool-attributes-misplaced-1.stderr b/src/test/ui/tool-attributes-misplaced-1.stderr index b9e61121406..60188aebce7 100644 --- a/src/test/ui/tool-attributes-misplaced-1.stderr +++ b/src/test/ui/tool-attributes-misplaced-1.stderr @@ -4,12 +4,6 @@ error: cannot find derive macro `rustfmt` in this scope LL | #[derive(rustfmt)] //~ ERROR cannot find derive macro `rustfmt` in this scope | ^^^^^^^ -error: cannot find attribute macro `rustfmt` in this scope - --> $DIR/tool-attributes-misplaced-1.rs:19:3 - | -LL | #[rustfmt] //~ ERROR cannot find attribute macro `rustfmt` in this scope - | ^^^^^^^ - error: cannot find macro `rustfmt!` in this scope --> $DIR/tool-attributes-misplaced-1.rs:25:5 | @@ -22,10 +16,10 @@ error[E0573]: expected type, found tool module `rustfmt` LL | type A = rustfmt; //~ ERROR expected type, found tool module `rustfmt` | ^^^^^^^ not a type -error[E0573]: expected type, found non-macro attribute `rustfmt::skip` +error[E0573]: expected type, found tool attribute `rustfmt::skip` --> $DIR/tool-attributes-misplaced-1.rs:14:10 | -LL | type B = rustfmt::skip; //~ ERROR expected type, found non-macro attribute `rustfmt::skip` +LL | type B = rustfmt::skip; //~ ERROR expected type, found tool attribute `rustfmt::skip` | ^^^^^^^^^^^^^ not a type error[E0423]: expected value, found tool module `rustfmt` @@ -34,13 +28,13 @@ error[E0423]: expected value, found tool module `rustfmt` LL | rustfmt; //~ ERROR expected value, found tool module `rustfmt` | ^^^^^^^ not a value -error[E0423]: expected value, found non-macro attribute `rustfmt::skip` +error[E0423]: expected value, found tool attribute `rustfmt::skip` --> $DIR/tool-attributes-misplaced-1.rs:27:5 | -LL | rustfmt::skip; //~ ERROR expected value, found non-macro attribute `rustfmt::skip` +LL | rustfmt::skip; //~ ERROR expected value, found tool attribute `rustfmt::skip` | ^^^^^^^^^^^^^ not a value -error: aborting due to 7 previous errors +error: aborting due to 6 previous errors Some errors occurred: E0423, E0573. For more information about an error, try `rustc --explain E0423`. diff --git a/src/test/ui/tool-attributes-misplaced-2.rs b/src/test/ui/tool-attributes-misplaced-2.rs index 3bb0e3dc343..102edf2813b 100644 --- a/src/test/ui/tool-attributes-misplaced-2.rs +++ b/src/test/ui/tool-attributes-misplaced-2.rs @@ -10,9 +10,9 @@ #![feature(tool_attributes)] -#[derive(rustfmt::skip)] //~ ERROR expected a macro, found non-macro attribute +#[derive(rustfmt::skip)] //~ ERROR expected a macro, found tool attribute struct S; fn main() { - rustfmt::skip!(); //~ ERROR expected a macro, found non-macro attribute + rustfmt::skip!(); //~ ERROR expected a macro, found tool attribute } diff --git a/src/test/ui/tool-attributes-misplaced-2.stderr b/src/test/ui/tool-attributes-misplaced-2.stderr index 66452267e94..5b968cd6b8e 100644 --- a/src/test/ui/tool-attributes-misplaced-2.stderr +++ b/src/test/ui/tool-attributes-misplaced-2.stderr @@ -1,13 +1,13 @@ -error: expected a macro, found non-macro attribute +error: expected a macro, found tool attribute --> $DIR/tool-attributes-misplaced-2.rs:13:10 | -LL | #[derive(rustfmt::skip)] //~ ERROR expected a macro, found non-macro attribute +LL | #[derive(rustfmt::skip)] //~ ERROR expected a macro, found tool attribute | ^^^^^^^^^^^^^ -error: expected a macro, found non-macro attribute +error: expected a macro, found tool attribute --> $DIR/tool-attributes-misplaced-2.rs:17:5 | -LL | rustfmt::skip!(); //~ ERROR expected a macro, found non-macro attribute +LL | rustfmt::skip!(); //~ ERROR expected a macro, found tool attribute | ^^^^^^^^^^^^^ error: aborting due to 2 previous errors |
