Skip to content

Commit

Permalink
Auto merge of #13155 - epage:lint, r=weihanglo
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Dec 11, 2023
2 parents 7688d89 + 48c72b9 commit a0339b0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/cargo/util_schemas/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ pub struct TomlManifest {
pub workspace: Option<TomlWorkspace>,
pub badges: Option<InheritableBtreeMap>,
pub lints: Option<InheritableLints>,
// when adding new fields, be sure to check whether `to_virtual_manifest` should disallow them
}

impl TomlManifest {
Expand Down
1 change: 1 addition & 0 deletions tests/testsuite/workspaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2198,6 +2198,7 @@ fn ws_err_unused() {
"[features]",
"[target]",
"[badges]",
"[lints]",
] {
let p = project()
.file(
Expand Down

0 comments on commit a0339b0

Please sign in to comment.