3. ItemsΒΆ

Syntax

Item ::=
    OuterAttributeOrDoc* (ItemWithVisibility | MacroItem)

ItemWithVisibility ::=
    VisibilityModifier? (
        ConstantDeclaration
      | EnumDeclaration
      | ExternalBlock
      | ExternalCrateImport
      | FunctionDeclaration
      | Implementation
      | ModuleDeclaration
      | StaticDeclaration
      | StructDeclaration
      | TraitDeclaration
      | TypeAliasDeclaration
      | UnionDeclaration
      | UseImport
    )

MacroItem ::=
    MacroRulesDeclaration
  | TerminatedMacroInvocation

ItemSafety ::=
    unsafe
  | safe

Legality Rules

3:1 The macro expansion of a terminated macro invocation is treated as zero or more items if the terminated macro invocation appears as an item.

Dynamic Semantics

3:2 Elaboration is the process by which a declaration achieves its runtime effects.