Skip to content

Find a linter (or compiler mode) to catch unreferenced pub decls #87

Description

@lukashes

Background: Zig type-checks a pub declaration only when something references it, so a dead or bench-only pub fn can ship with a type error that zig build test never catches (this bit us in #58). #70 first closed the gap with a refAllDeclsRecursive helper in tests/reflect.zig, but that reimplements exactly the recursive variant std removed in 0.16 (unbounded traversal across pub re-exports, eval-quota pressure). We reverted the helper and kept only the dead-code removal, so the gap is open again — by choice, since a per-module reflection hack is the wrong home for it.

This is a static-analysis / lint concern, not something to hand-roll in test code.

Ask: evaluate what exists as of now and pick one, or decide to live with the gap:

  • a standalone Zig linter, if a maintained one exists
  • ZLS diagnostics run in CI (headless), if it can flag this
  • an upstream compiler flag / "analyze all decls" mode (check current ziglang/zig direction)

Deliverable: a short recommendation with the trade-offs, not an implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions