Skip to content

Migrate local const and static parser failures to structured diagnostics #394

Closed

Description

@LunaStev

Tracked by #346.

Why

Local const and static declarations are intentionally rejected, but front/parser/src/parser/stmt.rs and the for-loop initializer path still print ad-hoc text and return None. That loses the stable diagnostic contract used by the rest of the compiler.

Scope

  • Replace only the local const and static failure paths with ParseError/structured diagnostic data.
  • Cover ordinary blocks and for initializers.
  • Point at the qualifier token.
  • Explain that both forms are top-level only and suggest var for local storage where appropriate.
  • Do not change storage-class semantics.

Completion criteria

  • No direct println! is used for these failures.
  • Human diagnostics include context and a useful help message.
  • JSON error output remains valid.
  • Positive top-level const and static cases remain accepted.
  • Parser or CLI regression tests cover all changed paths.

Activity

  1. added
    enhancement
    good first issue
    needs testing
    on Aug 28, 2026
  2. self-assigned this
    on Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementgood first issueneeds testing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions