Macro const_extension_ids

Source
macro_rules! const_extension_ids {
    ($($(#[$attr:meta])* $v:vis const $field_name:ident : ExtensionId = $ext_name:expr;)+) => { ... };
}
Expand description

Declare ‘const’ variables holding new ExtensionIds, validating that they are well-formed as separate tests - hence, usable at the top level of a test module only. Example:

const_extension_ids! {
  pub const EXT_A: ExtensionId = "A";
  /// A doc comment
  #[cfg(foobar)] pub (super) const EXT_A_B: ExtensionId = "A.B";
  const EXT_BAD: ExtensionId = "..55"; // this will generate a failing #[test] fn ....
}