Skip to content

6.11.1 (patch) removed public fields from spec::FlagMeta #1489

Closed

Description

@kixelated

usage-rs 6.11.1 removed public fields from usage_rs::spec::FlagMeta in a patch release. #1470 moved env_fallback, deprecated_env and 33 other fields behind the new FlagMeta::extra (FlagExtra). FlagMeta is pub, has public fields, and is neither #[doc(hidden)] nor #[non_exhaustive], so code that compiled against 6.11.0 no longer compiles against 6.11.1:

fn envs(flag: &usage_rs::spec::FlagMeta<'_>) -> usize {
    flag.env_fallback.len() // compiles on 6.11.0, E0609 on 6.11.1
}
error[E0609]: no field `env_fallback` on type `&usage_rs::spec::FlagMeta<'_>`

We hit it in moq-dev/moq when a routine cargo update pulled 6.11.1 into our release branch, and fixed it on our side in moq-dev/moq#4006.

Would you consider one of these for future changes?

  • Mark FlagMeta / FlagExtra #[non_exhaustive], or #[doc(hidden)] if they are meant to be internal to the derive.
  • Ship field moves like this in a major bump, since Cargo treats any 6.x as compatible.

Nothing to do for 6.11.1 on our end; this is only a heads-up. Thanks for the size work in #1470.

(written by Claude Opus 5.5)

Activity

  1. jdx commented on Sep 24, 2026

    @jdx
    Owner

    Sorry about this, and thanks for the clear report. I thought FlagMeta was internal to the derive, so I didn't treat moving its fields as a breaking change. It's pub with public fields, though, so it's public API whatever I intended, and a patch release shouldn't have broken your build.

    What's changing:

    • chore: run cargo-semver-checks on every published crate #1490: our semver check only covered usage-lib, which is why this got through. It now covers every published crate. Run against the 6.11.0 baseline, it flags exactly these removed fields.
    • feat(lib): add getters that read FlagMeta, CommandMeta and ArgMeta fields wherever they live #1491: FlagMeta, CommandMeta and ArgMeta get a const fn getter for every field, wherever it's stored. flag.env_fallback() works whether the field is inline or behind extra, so future size tuning won't break readers.
    • v7: these structs can't be #[non_exhaustive], because the derive builds them with struct literals in your crate. Instead, the next major will mark the fields #[doc(hidden)] and make the getters the documented read API. That's tracked in V7.md, along with any other breaking changes we hold for the major.

    This comment was generated by Claude Code.

  2. jdx commented on Sep 24, 2026

    @jdx
    Owner

    Closing as done. #1491 added const fn getters (flag.env_fallback() and so on) that keep working wherever a field is stored, and #1490 extended the semver check to every published crate, so a field move like this now fails CI. Marking the fields #[doc(hidden)] so the getters become the documented read API is tracked in V7.md for the next major.

    This comment was generated by Claude Code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions