Skip to content

fix: contract macro inside struct body causes parse error #26

@noahgift

Description

@noahgift

Error

error: unexpected token: !
   |            ---------- while parsing this struct
54 |     contract_pre_patch_apply!(basis);
   |                             ^ unexpected token after this

contract_pre_patch_apply!() expands to debug_assert!() which is a statement, not a struct field. The macro call needs to be moved from the struct body to a function/method where it can execute as a runtime check.

Five-Whys

  1. CI fails → compilation error in struct body
  2. Macro call in struct → macros expand to statements, not fields
  3. Likely copy-paste error placing contract assertion in wrong location

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