mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Only suggest changing #[derive(mymacro)] to #[mymacro] for attribute macros
This commit is contained in:
@@ -659,6 +659,7 @@ fn smart_resolve_macro_path(
|
||||
if !path.span.from_expansion()
|
||||
&& kind == MacroKind::Derive
|
||||
&& !ext.macro_kinds().contains(MacroKinds::DERIVE)
|
||||
&& ext.macro_kinds().contains(MacroKinds::ATTR)
|
||||
{
|
||||
err.remove_surrounding_derive = Some(RemoveSurroundingDerive { span: path.span });
|
||||
err.add_as_non_derive = Some(AddAsNonDerive { macro_path: &path_str });
|
||||
|
||||
@@ -95,14 +95,6 @@ error: expected derive macro, found macro `crate::my_macro`
|
||||
|
|
||||
LL | #[derive(crate::my_macro)]
|
||||
| ^^^^^^^^^^^^^^^ not a derive macro
|
||||
|
|
||||
help: remove from the surrounding `derive()`
|
||||
--> $DIR/macro-namespace-reserved-2.rs:50:10
|
||||
|
|
||||
LL | #[derive(crate::my_macro)]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= help: add as non-Derive macro
|
||||
`#[crate::my_macro]`
|
||||
|
||||
error: cannot find macro `my_macro_attr` in this scope
|
||||
--> $DIR/macro-namespace-reserved-2.rs:28:5
|
||||
|
||||
Reference in New Issue
Block a user