rustfmt icon indicating copy to clipboard operation
rustfmt copied to clipboard

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

Open davidBar-On opened this issue 2 years ago • 0 comments

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].

davidBar-On avatar Aug 26 '22 08:08 davidBar-On