Repository navigation
Description
What
docs/05-dependencies.md states that a package and a package of its namespace in one table (mcpplibs.mtest and mcpplibs.mtest.gtest) cannot both be written unquoted, and that the quoted key of one of them is their spelling. When both are written unquoted anyway:
- with string values mcpp reports the conflict (
error: mcpp.toml:7:25: error: key path conflict); - with inline-table values (
{ path = … },{ version = …, features = […] }) it does not. The manifest is not valid TOML (Python'stomllibrefuses it), mcpp accepts it and drops one of the two dependencies: with a warning that names something else in one order, and with no manifest diagnostic at all in the other.
The table form is the common one for the outer package: a dependency with features has to be a table.
Reproduce (mcpp 2026.11.27.1, Linux x86_64; the same on 2026.11.20.1)
mkdir -p repro/kit/src repro/extra/src repro/app/src && cd repro
printf '[package]\nnamespace = "acme"\nname = "kit"\nversion = "0.1.0"\n\n[targets.kit]\nkind = "lib"\n' > kit/mcpp.toml
printf 'export module acme.kit;\nexport int kit() { return 1; }\n' > kit/src/kit.cppm
printf '[package]\nnamespace = "acme.kit"\nname = "extra"\nversion = "0.1.0"\n\n[targets.extra]\nkind = "lib"\n' > extra/mcpp.toml
printf 'export module acme.kit.extra;\nexport int extra() { return 2; }\n' > extra/src/extra.cppm
printf 'import acme.kit;\nimport acme.kit.extra;\nint main() { return kit() + extra() == 3 ? 0 : 1; }\n' > app/src/main.cppA. The package first
# app/mcpp.toml
[package]
name = "app"
version = "0.1.0"
[dependencies]
acme.kit = { path = "../kit" }
acme.kit.extra = { path = "../extra" }$ python3 -c "import tomllib; tomllib.load(open('app/mcpp.toml','rb'))"
tomllib.TOMLDecodeError: Cannot mutate immutable namespace ('dependencies', 'acme', 'kit') (at line 7, column 39)
$ (cd app && mcpp build) # exit 1
warning: [dependencies."acme.kit"] has unrecognized key 'extra' (ignored). It may be a typo, or a field a newer mcpp understands.
warning: …/app/src/main.cpp: module 'acme.kit.extra' imported but not provided in this build
error: build failed in app v0.1.0 (.)
$ (cd app && mcpp build --strict) # exit 2
error: [dependencies."acme.kit"] has unrecognized key 'extra' (ignored). It may be a typo, or a field a newer mcpp understands.
acme.kit.extra is read as a field of the dependency acme.kit. The message suggests a typo or a newer mcpp; neither is the case, and it does not say that a dependency was lost.
B. The package of the namespace first
[dependencies]
acme.kit.extra = { path = "../extra" }
acme.kit = { path = "../kit" }$ python3 -c "import tomllib; tomllib.load(open('app/mcpp.toml','rb'))"
tomllib.TOMLDecodeError: Cannot overwrite a value (at line 7, column 37)
$ (cd app && mcpp build) # exit 1; the same with --strict
warning: …/app/src/main.cpp: module 'acme.kit.extra' imported but not provided in this build
Compiling acme.kit v0.1.0 (../kit)
Compiling app v0.1.0 (.)
error: build failed in app v0.1.0 (.)
acme.kit.extra: error: failed to read compiled module: No such file or directory
No diagnostic about the manifest, with or without --strict: the second line replaces the first, acme.kit.extra is gone, and the first sign is a compiler error about a module file.
The same two keys with string values (for comparison; the packages need not exist)
[dependencies]
acme.kit = "0.1.0"
acme.kit.extra = "0.1.0"$ (cd app && mcpp build) # exit 2
error: …/app/mcpp.toml:7:25: error: key path conflict
The documented spelling works, in either position, with and without --strict, and without a deprecation warning:
[dependencies]
"acme.kit" = { path = "../kit" }
acme.kit.extra = { path = "../extra" }Expected
- A and B stop with the error the string form already gets (
key path conflict, with the line and column), in both orders and regardless of--strict: an inline table is closed, so a later dotted key into it, or an inline table over a table that dotted keys defined, is the same conflict. - The error for a dependency table carries a help line with the spelling docs/05 gives: quote one of the two keys (
"acme.kit" = …), and say that this quoted key is not the deprecated one.
Where we met it
mcpplibs/mwrap: the collection package mcpplibs.mwrap (one feature per library, so its dependency line is a table) next to a wrapper of its namespace such as mcpplibs.mwrap.libc (mcpplibs/mwrap#1). The quoted key is what we use there; the report is about what a project sees before it learns that.
Activity
README: the collection and its features first, a library's own packag…
speak-agent commentedon Dec 5, 2026
Analysis, for the release after 2026.12.4.1.
Cause. The manifest's TOML reader (
modules/libs/src/toml.cppm, thekey = valuebranch) does not treat an inline table as closed, soacme.kit.extradives into the tableacme.kit = { … }and becomes a field of it (case A); and it assigns a key that is already defined without refusing, soacme.kit = { … }replaces the table thatacme.kit.extradefined (case B). With string values the dive fails, which is why that form already reportskey path conflict.Decision: no TOML extension. Accepting both keys unquoted, even in dependency tables only, would make mcpp.toml a file other TOML readers refuse (editors, formatters,
tomllib, CI scripts), a package's manifest unreadable by earlier mcpp releases, and give one dependency two spellings. The case is rare (a package and a package of its namespace in one table),mcpp addalready writes the quoted key there, and an error with its remedy teaches the rule at once.Planned change.
key path conflict.a = 1twice), which is read as the last today, is refused as Cargo refuses it, once the ecosystem's manifests are checked for it; if any use it, it is warned for one release first (docs/51).help:line with the spelling docs/05 gives ("acme.kit" = { path = "../kit" }) and says that this quoted key is not the deprecated one.The quoted-key deprecation is unchanged.
quoted-dotted-dependency-key(docs/51, removed from 2027.2) applies only where the key can be written unquoted; the quoted key of a package beside its parent or child is its spelling, is not warned, and stays valid after 2027.2.speak-agent commentedon Dec 6, 2026
Fixed in 2026.12.6.1 (#1044).
--strict(SPEC-004 §17 item 3). Case A and case B of this report both stop at the manifest now."acme.kit" = …); that quoted key is the canonical spelling, not the deprecated one.mcpp addwrites the same form (§17 item 2).config.tomlthat an earlier release wrote with a key defined twice is still read, by its later definition, with a warning naming the file and the key, so an upgrade does not stop on it.