From 66ce16c72b410b86d40bf9af2ef2d1c709a623cd Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 11 Dec 2023 14:10:01 -0600 Subject: [PATCH 1/2] fix(toml)!: Disallow `[lints]` in virtual workspaces This was missed with the initial `[lints]` implementation. While this is a breaking change, this is aligned with ones we've done in the past. A lot of times, we warn first. My hope is that isn't needed this time because - It only exists virtual workspaces so they aren't published - It is a nop to have this which is likely to be caught - This is so new that the number of people using it, and likely running into this case, is quite low. --- src/cargo/util/toml/mod.rs | 3 +++ tests/testsuite/workspaces.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index 6f72fbbae36..8933b814161 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -1122,6 +1122,9 @@ fn to_virtual_manifest( if me.badges.is_some() { bail!("this virtual manifest specifies a [badges] section, which is not allowed"); } + if me.lints.is_some() { + bail!("this virtual manifest specifies a [lints] section, which is not allowed"); + } let mut nested_paths = Vec::new(); let mut warnings = Vec::new(); diff --git a/tests/testsuite/workspaces.rs b/tests/testsuite/workspaces.rs index 94b5142f4c2..53ddc161606 100644 --- a/tests/testsuite/workspaces.rs +++ b/tests/testsuite/workspaces.rs @@ -2198,6 +2198,7 @@ fn ws_err_unused() { "[features]", "[target]", "[badges]", + "[lints]", ] { let p = project() .file( From 48c72b9aa7967fc635826fdc4cda2bb177a3153e Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 11 Dec 2023 14:18:10 -0600 Subject: [PATCH 2/2] docs(schema): Raise awareness of validation when updating --- src/cargo/util_schemas/manifest.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cargo/util_schemas/manifest.rs b/src/cargo/util_schemas/manifest.rs index c36cbc7e2c9..21777e60eff 100644 --- a/src/cargo/util_schemas/manifest.rs +++ b/src/cargo/util_schemas/manifest.rs @@ -45,6 +45,7 @@ pub struct TomlManifest { pub workspace: Option, pub badges: Option, pub lints: Option, + // when adding new fields, be sure to check whether `to_virtual_manifest` should disallow them } impl TomlManifest {