Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #5489 - allow CONST and macrro metavariable as attribute value #5518

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

davidBar-On
Copy link
Contributor

@davidBar-On davidBar-On commented Aug 26, 2022

Closes #5489

Suggested fix for #5489 - allow macro metavariable as attribute value. In addition, allow also CONST as attribute value. The suggested fix is actually a workaround to a preferred fix of Attribute:meta() that current is not supporting these types as attribute value.

The fix handles attribute values assignments of the following forms:

  • #[$name] in macro or #[CONST]
  • #[id(att1 = $name, attr2 = CONST, ...)]

It may be that not all the possible cases are covered, but hopefully at least most of the practically used cases are covered.

Note that tests/target/macro_rules.rs was modified, as #[doc=$docs] is now properly formatted to #[doc = $docs].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Formatting a macro that generates a struct with a field with a multiline attribute adds indentation forever
2 participants