Skip to content

Fix manifest schema generation: TomlOptLevel and StringOrVec - #17660

Merged
weihanglo merged 2 commits into
rust-lang:masterfrom
boozook:manifest-schema-17643
Oct 30, 2026
Merged

weihanglo merged 2 commits into
rust-lang:masterfrom
boozook:manifest-schema-17643

Conversation

@boozook

@boozook boozook commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

View all comments

Partially fixes #17643, follow-up after #17202.

Has no breaking changes.

How to test

Compare before vs. after this patch.

Following steps assumes you have taplo and cargo-repo-working-dir.

Without this patch:

  1. create new cargo package
  2. add opt-level:
[profile.dev]
opt-level = 2

[profile.dev.package."*"]
opt-level = 3
  1. add metabuild = "foobar"
  2. add rust-version.workspace = true
  3. run: taplo check ./Cargo.toml --verbose --log-spans --schema="file:///abs-path-to/cargo-repo-working-dir/manifest.schema.json"

You will get errors about "value for opt-level is invalid, not any of" and "metabuild can be array of strings only".

With this patch:

  • Repeat same steps. Now schema assepts same values as cargo.

Also fixed repository.workspace = false that previously was allowed in the schema.


Also there is a little refactoring that makes future fixes like this a little bit simplier and consistent.


LLM/ML/AI usage disclosure: I'm a retrograde, Luddite kind of person who loves to write code by hand and using my brain; I don't use models, I make decisions and make mistakes on my own, I've been writing code for over twenty years, and I respect myself and other engineers, so AI was not used.

🤖 LLM involvement: nope.

@rustbot rustbot added the A-manifest Area: Cargo.toml issues label Oct 29, 2026
@boozook
boozook marked this pull request as ready for review October 29, 2026 10:53
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 29, 2026
@rustbot

rustbot commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

r? @weihanglo

rustbot has assigned @weihanglo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @Muscraft, @epage, @weihanglo
  • @Muscraft, @epage, @weihanglo expanded to Muscraft, epage, weihanglo
  • Random selection from Muscraft, epage, weihanglo

@boozook
boozook force-pushed the manifest-schema-17643 branch from db3874e to a3be698 Compare October 29, 2026 11:17
@boozook

boozook commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor Author

I also fixed schema for

If it's acceptable, I can merge it into this PR.

Upd: added into this PR.

@boozook
boozook force-pushed the manifest-schema-17643 branch 2 times, most recently from 79188e8 to da22e6f Compare October 30, 2026 13:12
@boozook
boozook requested a review from weihanglo October 30, 2026 14:13
@weihanglo

Copy link
Copy Markdown
Member

Sorry I kinda started detouring the implementation direction 😓.

@boozook
boozook force-pushed the manifest-schema-17643 branch from da22e6f to df74433 Compare October 30, 2026 16:14

@weihanglo weihanglo 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. Looks awesome!

View changes since this review

@weihanglo
weihanglo enabled auto-merge October 30, 2026 16:20
…heritableRustVersion` and `WorkspaceValue`
auto-merge was automatically disabled October 30, 2026 16:22

Head branch was pushed to by a user without write access

@boozook
boozook force-pushed the manifest-schema-17643 branch from df74433 to f4c01d8 Compare October 30, 2026 16:22
@boozook

boozook commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor Author

@weihanglo I'm sorry, just added missed things. Now it's ready, I'm sure.

  • your suggestion to remove missed schemars(with = "Option<String>") for RustVersion;
  • your transform for TomlDebugInfo is better 🤏

@weihanglo
weihanglo enabled auto-merge October 30, 2026 16:31
@weihanglo
weihanglo added this pull request to the merge queue Oct 30, 2026
Merged via the queue into rust-lang:master with commit 809bcc5 Oct 30, 2026
30 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 30, 2026
@boozook
boozook deleted the manifest-schema-17643 branch October 30, 2026 18:25
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Nov 4, 2026
Update cargo submodule

13 commits in 31d3246e0e8d3a80d4a90b54aa48ff180adb408b..3c747ea3ead23951c1b43a5edfcbdb449135ddeb
2026-10-27 13:54:39 +0000 to 2026-11-03 21:25:31 +0000
- Link to `cargo search` result's crates.io pages (rust-lang/cargo#17668)
- Clean `/out` dir before compilation  (rust-lang/cargo#17675)
- Allow `uncommon_codepoints` in confusable test (rust-lang/cargo#17676)
- test: Update https certificate failed messages (rust-lang/cargo#17679)
- chore(deps): update rust-lang/crates-io-auth-action action to v1.0.6 (rust-lang/cargo#17670)
- chore(deps): update actions/deploy-pages action to v5.0.1 (rust-lang/cargo#17669)
- Fix manifest schema generation: `TomlOptLevel` and `StringOrVec` (rust-lang/cargo#17660)
- remove deprecated tempdir (rust-lang/cargo#17663)
- chore(ci): remove Windows rustup PATH workaround (rust-lang/cargo#17667)
- test: probe stable cargo through rustup (rust-lang/cargo#17666)
- Update outdated registry function comments (rust-lang/cargo#17664)
- perf(windows): Delay-load system DLLs that most commands don't use (rust-lang/cargo#17623)
- Suppress `dead_code_pub_in_binary` for library test units (rust-lang/cargo#17608)
@rustbot rustbot added this to the 1.101.0 milestone Nov 4, 2026
RalfJung pushed a commit to JoJoDeveloping/miri that referenced this pull request Nov 8, 2026
Update cargo submodule

13 commits in 31d3246e0e8d3a80d4a90b54aa48ff180adb408b..3c747ea3ead23951c1b43a5edfcbdb449135ddeb
2026-10-27 13:54:39 +0000 to 2026-11-03 21:25:31 +0000
- Link to `cargo search` result's crates.io pages (rust-lang/cargo#17668)
- Clean `/out` dir before compilation  (rust-lang/cargo#17675)
- Allow `uncommon_codepoints` in confusable test (rust-lang/cargo#17676)
- test: Update https certificate failed messages (rust-lang/cargo#17679)
- chore(deps): update rust-lang/crates-io-auth-action action to v1.0.6 (rust-lang/cargo#17670)
- chore(deps): update actions/deploy-pages action to v5.0.1 (rust-lang/cargo#17669)
- Fix manifest schema generation: `TomlOptLevel` and `StringOrVec` (rust-lang/cargo#17660)
- remove deprecated tempdir (rust-lang/cargo#17663)
- chore(ci): remove Windows rustup PATH workaround (rust-lang/cargo#17667)
- test: probe stable cargo through rustup (rust-lang/cargo#17666)
- Update outdated registry function comments (rust-lang/cargo#17664)
- perf(windows): Delay-load system DLLs that most commands don't use (rust-lang/cargo#17623)
- Suppress `dead_code_pub_in_binary` for library test units (rust-lang/cargo#17608)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-manifest Area: Cargo.toml issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants