feat(manifest): bare OS-alias sugar for [target.*] conditional tables (v0.0.80)#192
Merged
Conversation
… (v0.0.80) [target.linux.dependencies] / [target.windows.build] now work as concise sugar for [target.'cfg(linux)'...] — dropping the cfg() wrapper and its mandatory TOML quotes for the common single-OS case. The bare aliases windows/linux/macos/unix are never valid triples, so there's no ambiguity with the exact-triple namespace. One evaluator branch in cfgpred::matches() (the parser already routes deps/build for any [target.<key>] into conditionalConfigs); evaluation stays target-resolved, identical to cfg(). Backward-compatible: cfg(...) and exact triples unchanged. toolchain/linkage remain exact-triple only (documented). - src/build/prepare.cppm: cfgpred::matches() bare-alias branch - tests/e2e/91_target_bare_alias.sh: bare alias works + parity with cfg(), host-aware - docs/05-mcpp-toml.md (+zh): new §2.7.1 documenting all three [target.*] forms (the L1 conditional config was previously undocumented in the user guide) - design doc; version -> 0.0.80
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.
What
Makes the common platform-conditional case concise.
[target.linux.dependencies]/[target.windows.build]now work as sugar for[target.'cfg(linux)'...]— dropping thecfg(...)wrapper and its TOML-mandated quotes.Why it's unambiguous
A mcpp triple is always
<arch>-<os>[-<env>]; the bare aliaseswindows/linux/macos/unixare never valid triples, so[target.linux]can only meancfg(linux)— no collision with the exact-triple namespace ([target.x86_64-linux-musl]). A small, deliberate divergence from Cargo (which always requirescfg()/triple), justified by removing quote-noise from the 90% case.Implementation
The parser already routes
build/dependenciesfor every[target.<key>]into aConditionalConfig{predicate=<key>}, so the only gap was evaluation. One branch incfgpred::matches()evaluates a bare alias as the cfg bareword. Evaluation stays target-resolved (identical tocfg());cfg(...)and exact triples unchanged → backward-compatible.toolchain/linkageremain exact-triple only (documented boundary).Files
src/build/prepare.cppm—cfgpred::matches()bare-alias branch.tests/e2e/91_target_bare_alias.sh— bare alias works and equalscfg()per-OS (parity), host-aware (validates on linux/macOS/windows).docs/05-mcpp-toml.md(+zh) — new §2.7.1 documenting all three[target.*]forms (the L1 conditional config was previously undocumented in the user guide)..agents/docs/2026-06-30-target-bare-alias-sugar-design.md; version → 0.0.80.Verified locally (0.0.80)
91_target_bare_aliaspasses;85(cfg flags) +86(cfg deps) regress clean; a macOS-gated bogus dep is correctly skipped on a Linux host via the bare alias.🤖 Generated with Claude Code