Sitelet https://github.com/taiki-e/cargo-config2/pull/68
Skip to content

Treat empty encoded flags as a zero-flag override. - #68

Merged
taiki-e merged 1 commit into
taiki-e:mainfrom
obi1kenobi:empty-encoded-flags
Jul 30, 2026
Merged

taiki-e merged 1 commit into
taiki-e:mainfrom
obi1kenobi:empty-encoded-flags

Conversation

@obi1kenobi

Copy link
Copy Markdown
Contributor

Cargo special-cases a wholly empty CARGO_ENCODED_RUSTFLAGS or CARGO_ENCODED_RUSTDOCFLAGS value as an override containing zero flags, rather than one containing a single empty flag.

Adjust cargo-config2's implementation to match.

@taiki-e taiki-e left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks! The implementation looks good to me. Could you resolve merge conflicts and CI failure?

Comment thread tests/test.rs Outdated
Comment on lines +298 to +299
("\x1fflag\x1f", ["", "flag", ""].into()),
("one\x1ftwo", ["one", "two"].into()),

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

From the failed CI log (https://github.com/taiki-e/cargo-config2/actions/runs/30216009160/job/89830232190?pr=68):

tests/test.rs:298 - Unknown word (fflag)
tests/test.rs:299 - Unknown word (ftwo)

We can use something like:

Suggested change
("\x1fflag\x1f", ["", "flag", ""].into()),
("one\x1ftwo", ["one", "two"].into()),
("\x1fa\x1f", ["", "a", ""].into()),
("a\x1fb", ["a", "b"].into()),

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

Cargo special-cases a wholly empty `CARGO_ENCODED_RUSTFLAGS` or `CARGO_ENCODED_RUSTDOCFLAGS` value as an override containing zero flags, rather than one containing a single empty flag. Adjust `cargo-config2`'s implementation to match.
@obi1kenobi
obi1kenobi force-pushed the empty-encoded-flags branch from aeb0556 to 1b3b1c6 Compare July 30, 2026 01:04
@obi1kenobi

Copy link
Copy Markdown
Contributor Author

Rebased and updated as proposed. Thanks again!

@taiki-e
taiki-e merged commit 9170005 into taiki-e:main Jul 30, 2026
21 checks passed
@taiki-e

taiki-e commented Jul 30, 2026

Copy link
Copy Markdown
Owner

Published in 0.1.45.

@obi1kenobi

Copy link
Copy Markdown
Contributor Author

Wonderful, thank you so much!

@obi1kenobi
obi1kenobi deleted the empty-encoded-flags branch July 30, 2026 22:20
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.

2 participants