Skip to content

Fix subslice offsets when synthesizing the license field - #320

Merged
Jake-Shadle merged 1 commit into
EmbarkStudios:mainfrom
devtechedge:fix/314-subslice-offset
Sep 18, 2026
Merged

Jake-Shadle merged 1 commit into
EmbarkStudios:mainfrom
devtechedge:fix/314-subslice-offset

Conversation

@devtechedge

Copy link
Copy Markdown
Contributor

Fixes #314.

The insert position was computed relative to the subslice after the package marker but used to index the full manifest, so it landed five bytes early.

That either panics on a split UTF-8 character or silently corrupts an unrelated value, depending on the manifest.

The fix adds the subslice base back before indexing, and the returned offset still points at the start of the expression.

Two regression tests cover the panic case (multibyte description with CRLF endings) and the silent corruption case, plus a TOML round-trip check.

Note: clippy on a current toolchain reports a pre-existing collapsible_if at src/lib.rs:399, untouched by this change.

@Jake-Shadle
Jake-Shadle force-pushed the fix/314-subslice-offset branch from 7fe3cbd to ab61ce4 Compare September 18, 2026 07:25

@Jake-Shadle Jake-Shadle left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@Jake-Shadle
Jake-Shadle merged commit e80bf03 into EmbarkStudios:main Sep 18, 2026
14 checks passed
@devtechedge

Copy link
Copy Markdown
Contributor Author

Thanks for merging this, @Jake-Shadle.

Rebasing that subslice-relative insert position was a good reminder of how carefully cargo-about tracks byte offsets so diagnostics keep pointing at the right span.

Glad the multibyte CRLF regression test earned its place.

Thanks for maintaining such a useful tool for the Rust packaging ecosystem.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

synthesize_manifest uses subslice offsets to index the full manifest

2 participants