Seal FtlOutputOptions against additive breakage#26
Merged
Conversation
Mark FtlOutputOptions and both its variants `#[non_exhaustive]` so the
enum can only be built through the `single_file`, `single_compressed_file`
and `multi_file` constructors, never the `SingleFile { .. }` / `MultiFile
{ .. }` struct-literal syntax. New output modes (variants) and new fields
on existing variants are then non-breaking minor releases.
Enum variant fields can't carry their own visibility, so `#[non_exhaustive]`
(not `pub(crate)`) is the mechanism here; in-crate construction — the
constructors, `Default`, and the tests — is unaffected.
Migrate the playground build script off the `MultiFile { .. }` literal to
`FtlOutputOptions::multi_file(..)`, and document the constructors (the
variant-field docs are no longer reachable from outside the crate).
Second of the batched 0.7 breaking changes; version already at 0.7.0.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second of the batched 0.7 breaking changes on the road to 1.0 (continues road-to-1.0 item #1, version already at 0.7.0 from #25).
What & why
FtlOutputOptionsand both its variants are now#[non_exhaustive], so downstream build scripts must use thesingle_file(),single_compressed_file()ormulti_file()constructors rather than theSingleFile { .. }/MultiFile { .. }struct-literal syntax. This makes new output modes (variants) and new fields on existing variants non-breaking minor releases.Unlike
BuildOptions(a struct, sealed withpub(crate)fields in #25), enum variant fields can't carry their own visibility —#[non_exhaustive]is the correct mechanism for an enum. In-crate construction (the three constructors,Default, and all tests) is unaffected.Changes
src/build/options/ftl_output_options.rs:#[non_exhaustive]on the enum and onMultiFile/SingleFile; documented the three constructors (the variant-field docs are no longer reachable externally).playground/example1/build.rs: migrated the oneMultiFile { .. }literal toFtlOutputOptions::multi_file("gen/multi/")— this is the external consumer the sealing breaks, and the proof the new API covers the use case.CHANGELOG.md: added to the0.7.0entry.Verification (local, all green)
cargo test --features build,langneg— 100 unit + 1 playground integration testcargo fmt --all --check,cargo clippy --all-targets --features build,langneg -- -D warningsRUSTDOCFLAGS="-D warnings" cargo doc --no-deps --features build,langnegcargo build --benches --features bench-internalsRemaining 0.7 work
Result<_, String>inL10nBundle/L10nLanguageVec/L10nLanguage) — the largest, next as its own PR.L10nLanguageVec::get, generatedload()/load_all()).🤖 Generated with Claude Code