Skip to content

Explore using include! instead of macros in internals #5596

@tcharding

Description

@tcharding

Calling macros across crate boundaries has been the source of so many bugs that I am known to write hyperbolic statements like 'death to all macros'. Instead of being so dramatic we could use include! to include a SSOT file that contains the code. Achieves the same aim which is to not have code duplication.

To close this issue please do:

  • Find a simple macro from internals
  • Deprecate it but do not remove it (either with the attribute if that works or just in the docs). (Do not remove so as to not break the API needlessly).
  • Create a file somewhere with the macro code in it (where to put it left to the implementer but please think carefully).
  • Use include! in multiple crates to prove this all works.
  • Write an issue saying 'Consider removing macro foo right before next breaking release of internals '

Additional notes

See primitives/src/hash_types/ for an example of include! usage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions