Skip to content

The "unused manifest key" warning doesn't print or halt the publishing with cargo publish #7380

Open

Description

@Lokathor

Normally if you have a manifest key that cargo doesn't understand many of the commands will print a warning

D:\dev\cargo-gba>cargo build
warning: unused manifest key: package.repsitory

However, if you use cargo publish not only does the accidental key not halt the publishing process without an override flag (as one might expect, similar to how you can't publish with a dirty git state without a flag), but it doesn't even directly print the warning about a bad key. Instead I got the warning about "no documentation, homepage or repository."

D:\dev\cargo-gba>cargo publish
    Updating crates.io index
warning: manifest has no documentation, homepage or repository.
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.

(Was posted as rust-lang/rust#64476 and then I was told to repost here because apparently there's a gap in the permissions among triage folks, which has already also been reported elsewhere so we can have that solved too soon enough)

Activity

  1. stefanhoelzl commented on Dec 7, 2019

    @stefanhoelzl

    I tried to reproduce your issue, but didn't get the same result with cargo build

    $ cargo --version
    cargo 1.41.0-nightly (750cb1482 2019-11-23)
    
    $ cargo new issue-7380
         Created binary (application) `issue-7380` package
    $ cd issue-7380
    
    $ cargo build
       Compiling issue-7380 v0.1.0 (/Users/stefan/Development/cargo-issues/issue-7380)
        Finished dev [unoptimized + debuginfo] target(s) in 3.28s
    
    $ cargo package --allow-dirty
    warning: manifest has no description, license, license-file, documentation, homepage or repository.
    See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
       Packaging issue-7380 v0.1.0 (/Users/stefan/Development/cargo-issues/issue-7380)
       Verifying issue-7380 v0.1.0 (/Users/stefan/Development/cargo-issues/issue-7380)
       Compiling issue-7380 v0.1.0 (/Users/stefan/Development/cargo-issues/issue-7380/target/package/issue-7380-0.1.0)
        Finished dev [unoptimized + debuginfo] target(s) in 0.53s
    
    $ cargo  publish --allow-dirty --dry-run
        Updating crates.io index
    warning: manifest has no description, license, license-file, documentation, homepage or repository.
    See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
       Packaging issue-7380 v0.1.0 (/Users/stefan/Development/cargo-issues/issue-7380)
       Verifying issue-7380 v0.1.0 (/Users/stefan/Development/cargo-issues/issue-7380)
       Compiling issue-7380 v0.1.0 (/Users/stefan/Development/cargo-issues/issue-7380/target/package/issue-7380-0.1.0)
        Finished dev [unoptimized + debuginfo] target(s) in 1.00s
       Uploading issue-7380 v0.1.0 (/Users/stefan/Development/cargo-issues/issue-7380)
    warning: aborting upload due to dry run

    cargo build doesn't raise any warnings. cargo package and cargo publish raise the same warnings.

    There is still the point to stop the publishing process on (any?) warnings. I think that could be discussed what the desired behavior is.

  2. stefanhoelzl commented on Dec 7, 2019

    @stefanhoelzl

    was trying to fix this issue and have a proposed solution here.

    It denies a incomplete manifest during publishing, but it can be overwritten with --allow-incomplete-manifest

  3. epage commented on Nov 2, 2023

    @epage
    Contributor

    We'd likely want to do this on every invocation or on every lint invocation and be subject to #12235, rather than fail during publish

    • Gives users control over the process in case its intentional
    • Lets people know earlier in the process.
  4. added
    S-triageStatus: This issue is waiting on initial triage.
    A-diagnosticsArea: Error and warning messages generated by Cargo itself.
    on Nov 2, 2023
  5. added
    S-triageStatus: This issue is waiting on initial triage.
    and removed
    S-triageStatus: This issue is waiting on initial triage.
    on Nov 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Error and warning messages generated by Cargo itself.A-new-lintArea: new lintCommand-publishS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions