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.
This commit is contained in:
bors 2018-08-08 08:37:56 +00:00
commit ffb09dfb3a
66 changed files with 295 additions and 320 deletions

View file

@ -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};

View file

@ -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};

View file

@ -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;

View file

@ -11,8 +11,6 @@
// aux-build:issue_50493.rs
// ignore-stage1
#![feature(proc_macro)]
#[macro_use]
extern crate issue_50493;

View file

@ -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;

View file

@ -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
}

View file

@ -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;

View file

@ -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;

View file

@ -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
}

View file

@ -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
}

View file

@ -20,7 +20,7 @@ fn main() {
#[attr]
fn a() {}
#[attr]
#[attr] //~ ERROR attributes on expressions are experimental
{
}

View file

@ -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() {}

View file

@ -18,6 +18,6 @@ fn main() {
#[align = 8]
fn f() { }
#[vec(1, 2, 3)]
#[vector(1, 2, 3)]
fn g() { }
}

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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,

View file

@ -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;

View file

@ -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!`

View file

@ -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;

View file

@ -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::*;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -12,7 +12,7 @@
// ignore-stage1
// ignore-wasm32
#![feature(use_extern_macros, macros_in_extern)]
#![feature(macros_in_extern)]
extern crate test_macros;

View file

@ -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;

View file

@ -10,7 +10,7 @@
// force-host
// no-prefer-dynamic
#![feature(proc_macro)]
#![crate_type = "proc-macro"]
extern crate proc_macro;

View file

@ -10,7 +10,7 @@
// force-host
// no-prefer-dynamic
#![feature(proc_macro)]
#![crate_type = "proc-macro"]
extern crate proc_macro;

View file

@ -10,7 +10,6 @@
// no-prefer-dynamic
#![feature(proc_macro)]
#![crate_type = "proc-macro"]
extern crate proc_macro;

View file

@ -10,7 +10,7 @@
// aux-build:lifetimes.rs
#![feature(use_extern_macros, proc_macro_non_items)]
#![feature(proc_macro_non_items)]
extern crate lifetimes;

View file

@ -11,7 +11,6 @@
// run-pass
// no-prefer-dynamic
#![feature(proc_macro)]
#![crate_type = "proc-macro"]
extern crate proc_macro;

View file

@ -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;

View file

@ -11,7 +11,6 @@
// no-prefer-dynamic
#![crate_type = "proc-macro"]
#![feature(proc_macro)]
extern crate proc_macro;

View file

@ -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
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -10,7 +10,7 @@
// no-prefer-dynamic
#![feature(proc_macro, decl_macro)]
#![feature(decl_macro)]
#![crate_type = "proc-macro"]
extern crate proc_macro;

View file

@ -10,7 +10,6 @@
// no-prefer-dynamic
#![feature(proc_macro)]
#![crate_type = "proc-macro"]
extern crate proc_macro;

View file

@ -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 }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -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;

View file

@ -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)]

View file

@ -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

View file

@ -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() {}

View file

@ -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`.

View file

@ -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
}

View file

@ -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!();

View file

@ -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`

View file

@ -10,5 +10,5 @@
fn main() {
concat!(test!());
//~^ ERROR expected a macro, found non-macro attribute
//~^ ERROR expected a macro, found built-in attribute
}

View file

@ -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!());

View file

@ -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
}

View file

@ -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

View file

@ -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() {}

View file

@ -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`.

View file

@ -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`
}

View file

@ -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`.

View file

@ -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
}

View file

@ -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