googleapis / googleapis/release-please
TOML v1.1 syntax in Cargo.toml fails to parse (@iarna/toml 3.0.0)
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 588
- Avg merge
- 12h 16m
- Merged PRs (30d)
- 7
Description
#### Environment details
- OS: GitHub Actions runner (reported via `google-github-actions/release-please-action`); local reproduction on macOS
- Node.js version: v24.18.1 (local reproduction)
- npm version: 11.16.0 (local reproduction)
- `release-please` version: 17.11.1
#### Steps to reproduce
1. Write a `Cargo.toml` that uses TOML v1.1 syntax. Cargo parses TOML v1.1 for manifests since Cargo 1.94 ([CHANGELOG](https://doc.rust-lang.org/nightly/cargo/CHANGELOG.html), [rust-lang/cargo#16415](https://github.com/rust-lang/cargo/pull/16415)), so this is a valid manifest:
```toml
[package]
name = "my-crate"
version = "0.1.0"
edition = "2021"
[dependencies]
bt-hci = { version = "0.9", default-features = false, features = ["defmt"] }
nrf-mpsl = {
git = "https://github.com/alexmoon/nrf-sdc",
features = ["defmt"],
}
```
2. Run release-please against that repository with the `rust` release type (reported through `google-github-actions/release-please-action`).
3. The job fails:
```
release-please failed: Unterminated inline array at row 20, col 13, pos 366:
19: bt-hci = { version = "0.9", default-features = false, features = ["defmt"] }
20> nrf-mpsl = {
^
21: git = "https://github.com/alexmoon/nrf-sdc",
```
The same failure is reproducible by calling the updater directly at `v17.11.1`:
```js
const {CargoToml} = require('./build/src/updaters/rust/cargo-toml');
const {Version} = require('./build/src/version');
const content = /* the manifest above */;
const updater = new CargoToml({
version: Version.parse('0.2.0'),
versionsMap: new Map(),
});
updater.updateContent(content);
```
```
TomlError: Unterminated inline array at row 8, col 13, pos 169:
7: bt-hci = { version = "0.9", default-features = false, features = ["defmt"] }
8> nrf-mpsl = {
^
9: git = "https://github.com/alexmoon/nrf-sdc",
```
`cargo read-manifest` (cargo 1.97.0-nightly) accepts the same manifest without complaint.
#### Details
release-please parses TOML with [`@iarna/toml@^3.0.0`](https://github.com/googleapis/release-please/blob/v17.11.1/package.json#L72), which implements [TOML v1.0.0-rc.1](https://github.com/iarna/iarna-toml/blob/latest/CHANGELOG.md) (published 2020-04-23; the upstream repository's last commit is 2021-07-16). Cargo, meanwhile, moved to TOML v1.1 in Cargo 1.94 (2026-03-05). Any manifest that uses a TOML v1.1 feature is therefore valid for Cargo but rejected by release-please.
Entry points affected for Rust:
- `parseCargoManifest()` in [`src/updaters/rust/common.ts`](https://github.com/googleapis/release-please/blob/v17.11.1/src/updaters/rust/common.ts#L75)
- `parseWith()` / `replaceTomlValue()` in [`src/util/toml-edit.ts`](https://github.com/googleapis/release-please/blob/v17.11.1/src/util/toml-edit.ts#L89)
All four TOML v1.1 additions supported by Cargo fail with `@iarna/toml@3.0.0`:
| TOML v1.1 feature | Cargo 1.97.0-nightly | `@iarna/toml@3.0.0` |
| --- | --- | --- |
| Multi-line inline tables | accepted | `TomlError: Unterminated inline array` |
| Trailing comma in inline tables | accepted | `TomlError: Trailing commas in inline tables are not permitted` |
| `\e` string escape | accepted | `TomlError: Unknown escape character: 101` |
| `\xHH` string escape | accepted | `TomlError: Unknown escape character: 120` |
This is the same class of problem as #1836 (`@iarna/toml@2.2.5`, TOML v0.5, vs. TOML v1.0.0), which was fixed by upgrading the parser. `@iarna/toml` has had no release since 3.0.0, so a parser upgrade is not available on that dependency.
Note that `src/util/toml-edit.ts` subclasses `@iarna/toml`'s internal `lib/toml-parser` (`parseValue`, `next`, `return`, and the `pos`/`state` fields) to record value spans for format-preserving edits, so replacing the parser is not a drop-in dependency swap.
Contributor guide
Research direction
Start by reproducing the failure with the direct CargoToml updater, then read parseCargoManifest() in src/updaters/rust/common.ts and parseWith()/replaceTomlValue() in src/util/toml-edit.ts. Trace the parser subclassing of @iarna/toml's internal lib/toml-parser and determine how the four listed TOML v1.1 features can be handled without losing format-preserving value spans; done means valid manifests parse and existing edits remain correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- release, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100