Skip to content

Commit a0339b0

Browse files
committed
Auto merge of #13155 - epage:lint, r=weihanglo
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.
2 parents 7688d89 + 48c72b9 commit a0339b0

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,6 +1122,9 @@ fn to_virtual_manifest(
11221122
if me.badges.is_some() {
11231123
bail!("this virtual manifest specifies a [badges] section, which is not allowed");
11241124
}
1125+
if me.lints.is_some() {
1126+
bail!("this virtual manifest specifies a [lints] section, which is not allowed");
1127+
}
11251128

11261129
let mut nested_paths = Vec::new();
11271130
let mut warnings = Vec::new();

src/cargo/util_schemas/manifest.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pub struct TomlManifest {
4545
pub workspace: Option<TomlWorkspace>,
4646
pub badges: Option<InheritableBtreeMap>,
4747
pub lints: Option<InheritableLints>,
48+
// when adding new fields, be sure to check whether `to_virtual_manifest` should disallow them
4849
}
4950

5051
impl TomlManifest {

tests/testsuite/workspaces.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2198,6 +2198,7 @@ fn ws_err_unused() {
21982198
"[features]",
21992199
"[target]",
22002200
"[badges]",
2201+
"[lints]",
22012202
] {
22022203
let p = project()
22032204
.file(

0 commit comments

Comments
 (0)