Skip to content

Broken Cargo Manifest #15030

@JP-Ellis

Description

@JP-Ellis

Problem

A recent update has resulted in the Cargo manifest incorrectly flagging the [lints.*] sections as invalid.

Steps

Run taplo lint against the following Cargo manifest

#:schema https://github.com/rust-lang/cargo/blob/b696870dd8cd5009a16339817cec11a882f68083/crates/cargo-util-schemas/manifest.schema.json
[package]
name = "example"

[lints.rust]
missing_docs = "warn"

[lints.clippy]
pedantic = { level = "warn", priority = -1 }

alloc_instead_of_core = "warn"

[lints.rustdoc]
missing-crate-level-docs = "warn"

generates the following:

taplo lint Cargo.toml
 INFO taplo:lint_files:collect_files: found files total=1 excluded=0 cwd="/private/tmp/cargo"
error: {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword
   ┌─ /private/tmp/cargo/Cargo.toml:5:1
   │  
 5 │ ╭ [lints.rust]
 6 │ │ missing_docs = "warn"
 7 │ │ 
 8 │ │ [lints.clippy]
   · │
13 │ │ [lints.rustdoc]
14 │ │ missing-crate-level-docs = "warn"
   │ ╰─────────────────────────────────^ {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword

error: {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword
  ┌─ /private/tmp/cargo/Cargo.toml:5:8
  │
5 │ [lints.rust]
  │        ^^^^ {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword

error: {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword
  ┌─ /private/tmp/cargo/Cargo.toml:5:1
  │  
5 │ ╭ [lints.rust]
6 │ │ missing_docs = "warn"
  │ ╰─────────────────────^ {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword

error: {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword
  ┌─ /private/tmp/cargo/Cargo.toml:6:1
  │
6 │ missing_docs = "warn"
  │ ^^^^^^^^^^^^ {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword

error: {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword
  ┌─ /private/tmp/cargo/Cargo.toml:6:16
  │
6 │ missing_docs = "warn"
  │                ^^^^^^ {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword

error: {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword
  ┌─ /private/tmp/cargo/Cargo.toml:8:8
  │
8 │ [lints.clippy]
  │        ^^^^^^ {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword

error: {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword
   ┌─ /private/tmp/cargo/Cargo.toml:8:1
   │  
 8 │ ╭ [lints.clippy]
 9 │ │ pedantic = { level = "warn", priority = -1 }
10 │ │ 
11 │ │ alloc_instead_of_core = "warn"
   │ ╰──────────────────────────────^ {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword

error: {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword
  ┌─ /private/tmp/cargo/Cargo.toml:9:1
  │
9 │ pedantic = { level = "warn", priority = -1 }
  │ ^^^^^^^^ {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword

error: {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword
  ┌─ /private/tmp/cargo/Cargo.toml:9:12
  │
9 │ pedantic = { level = "warn", priority = -1 }
  │            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword

error: {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword
  ┌─ /private/tmp/cargo/Cargo.toml:9:14
  │
9 │ pedantic = { level = "warn", priority = -1 }
  │              ^^^^^ {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword

error: {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword
  ┌─ /private/tmp/cargo/Cargo.toml:9:22
  │
9 │ pedantic = { level = "warn", priority = -1 }
  │                      ^^^^^^ {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword

error: {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword
  ┌─ /private/tmp/cargo/Cargo.toml:9:30
  │
9 │ pedantic = { level = "warn", priority = -1 }
  │                              ^^^^^^^^ {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword

error: {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword
  ┌─ /private/tmp/cargo/Cargo.toml:9:41
  │
9 │ pedantic = { level = "warn", priority = -1 }
  │                                         ^^ {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword

error: {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword
   ┌─ /private/tmp/cargo/Cargo.toml:11:1
   │
11 │ alloc_instead_of_core = "warn"
   │ ^^^^^^^^^^^^^^^^^^^^^ {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword

error: {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword
   ┌─ /private/tmp/cargo/Cargo.toml:11:25
   │
11 │ alloc_instead_of_core = "warn"
   │                         ^^^^^^ {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword

error: {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword
   ┌─ /private/tmp/cargo/Cargo.toml:13:8
   │
13 │ [lints.rustdoc]
   │        ^^^^^^^ {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword

error: {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword
   ┌─ /private/tmp/cargo/Cargo.toml:13:1
   │  
13 │ ╭ [lints.rustdoc]
14 │ │ missing-crate-level-docs = "warn"
   │ ╰─────────────────────────────────^ {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword

error: {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword
   ┌─ /private/tmp/cargo/Cargo.toml:14:1
   │
14 │ missing-crate-level-docs = "warn"
   │ ^^^^^^^^^^^^^^^^^^^^^^^^ {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword

error: {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword
   ┌─ /private/tmp/cargo/Cargo.toml:14:28
   │
14 │ missing-crate-level-docs = "warn"
   │                            ^^^^^^ {"rust":{"missing_docs":"warn"},"clippy":{"pedantic":{"level":"warn","priority":-1},"alloc_instead_of_core":"warn"},"rustdoc":{"missing-crate-level-docs":"warn"}} is not valid under any of the schemas listed in the 'anyOf' keyword

ERROR taplo:lint_files: invalid file error=schema validation failed path="/private/tmp/cargo/Cargo.toml"

Possible Solution(s)

It seems to me like the issue is with the main "lints" definition which makes reference to InheritableLints but never refers to any of the other lint-related definitions.

If I replace it with the definition from later in the file, the linting issue goes away.

Notes

No response

Version

https://github.com/rust-lang/cargo/blob/b696870dd8cd5009a16339817cec11a882f68083/crates/cargo-util-schemas/manifest.schema.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions