Ferrocene logo

Language Specification

Contents:

  • 1. General
  • 2. Lexical Elements
  • 3. Items
  • 4. Types and Traits
  • 5. Patterns
  • 6. Expressions
  • 7. Values
  • 8. Statements
  • 9. Functions
  • 10. Associated Items
  • 11. Implementations
  • 12. Generics
  • 13. Attributes
  • 14. Entities and Resolution
  • 15. Ownership and Destruction
  • 16. Exceptions and Errors
  • 17. Concurrency
  • 18. Program Structure and Compilation
  • 19. Unsafety
  • 20. Macros
  • 21. FFI
  • 22. Inline Assembly

Appendices:

  • A. Licenses
  • B. Glossary
  • C. List of undefined behavior

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

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.

Copyright © The Ferrocene Developers. Contents released under the MIT or Apache 2.0 license.

Built from commit: a445f25373f73cc5eced8e155c7b6a5fb929030e

Ferrocene is a registered trademark of Critical Section GmbH.