mirror of
https://github.com/rust-lang/rust.git
synced 2025-10-02 10:18:25 +00:00

This eliminates the case in `failed_to_match_macro` to check for a function-like invocation of a macro with no function-like rules. Instead, macro kind mismatches now result in an unresolved macro, and we detect this case in `unresolved_macro_suggestions`, which now carefully distinguishes between a kind mismatch and other errors. This also handles cases of forward-referenced attributes and cyclic attributes. Expand test coverage to include all of these cases.
64 lines
2.0 KiB
Plaintext
64 lines
2.0 KiB
Plaintext
error: local_attr: struct S;
|
|
--> $DIR/macro-rules-attr-error.rs:5:9
|
|
|
|
|
LL | compile_error!(concat!("local_attr: ", stringify!($($body)*)));
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
...
|
|
LL | #[local_attr]
|
|
| ------------- in this attribute macro expansion
|
|
|
|
|
= note: this error originates in the attribute macro `local_attr` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error: cannot find macro `local_attr` in this scope
|
|
--> $DIR/macro-rules-attr-error.rs:27:5
|
|
|
|
|
LL | local_attr!(arg);
|
|
| ^^^^^^^^^^
|
|
|
|
|
= note: `local_attr` is in scope, but it is an attribute: `#[local_attr]`
|
|
|
|
error: cannot find attribute `fn_only` in this scope
|
|
--> $DIR/macro-rules-attr-error.rs:30:7
|
|
|
|
|
LL | macro_rules! fn_only {
|
|
| ------- `fn_only` exists, but has no `attr` rules
|
|
...
|
|
LL | #[fn_only]
|
|
| ^^^^^^^
|
|
|
|
error: cannot find macro `attr_only` in this scope
|
|
--> $DIR/macro-rules-attr-error.rs:33:5
|
|
|
|
|
LL | macro_rules! attr_only {
|
|
| --------- `attr_only` exists, but has no rules for function-like invocation
|
|
...
|
|
LL | attr_only!();
|
|
| ^^^^^^^^^
|
|
|
|
error: cannot find attribute `forward_referenced_attr` in this scope
|
|
--> $DIR/macro-rules-attr-error.rs:38:3
|
|
|
|
|
LL | #[forward_referenced_attr]
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^ consider moving the definition of `forward_referenced_attr` before this call
|
|
|
|
|
note: a macro with the same name exists, but it appears later
|
|
--> $DIR/macro-rules-attr-error.rs:42:14
|
|
|
|
|
LL | macro_rules! forward_referenced_attr {
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: cannot find attribute `cyclic_attr` in this scope
|
|
--> $DIR/macro-rules-attr-error.rs:48:3
|
|
|
|
|
LL | #[cyclic_attr]
|
|
| ^^^^^^^^^^^ consider moving the definition of `cyclic_attr` before this call
|
|
|
|
|
note: a macro with the same name exists, but it appears later
|
|
--> $DIR/macro-rules-attr-error.rs:50:14
|
|
|
|
|
LL | macro_rules! cyclic_attr {
|
|
| ^^^^^^^^^^^
|
|
|
|
error: aborting due to 6 previous errors
|
|
|