Support custom attributes when macro modularization is enabled
This commit is contained in:
parent
c84562e019
commit
f60d96a477
11 changed files with 108 additions and 105 deletions
|
|
@ -20,7 +20,7 @@ fn main() {
|
|||
#[attr]
|
||||
fn a() {}
|
||||
|
||||
#[attr]
|
||||
#[attr] //~ ERROR attributes on expressions are experimental
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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() {}
|
||||
|
|
|
|||
11
src/test/ui/tool-attributes-disabled-2.stderr
Normal file
11
src/test/ui/tool-attributes-disabled-2.stderr
Normal 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`.
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
// 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 tool attribute `rustfmt::skip`
|
||||
|
|
@ -16,7 +16,7 @@ type B = rustfmt::skip; //~ ERROR expected type, found tool attribute `rustfmt::
|
|||
#[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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
||||
|
|
@ -40,7 +34,7 @@ error[E0423]: expected value, found tool 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`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue