Skip to content

Cargo should warn if package.include doesn't contain a Cargo.toml #4660

@torkleyy

Description

@torkleyy

How to reproduce:

cargo new hello
cd hello
vi Cargo.toml

Add the following line to the package table:

include = ["hello.txt"]

And then create that file:

touch hello.txt

Finally, try to execute

cargo package

This fails for me with the following error message:

   Packaging hello v0.1.0 (file:///home/thomas/Workspace/hello)
   Verifying hello v0.1.0 (file:///home/thomas/Workspace/hello)
error: failed to verify package tarball

Caused by:
  failed to read `/home/thomas/Workspace/hello/target/package/hello-0.1.0/Cargo.toml`

Caused by:
  No such file or directory (os error 2)

Executing ls target/package/hello-0.1.0/ gives me hello.txt, so it does get included.


Tested versions (same result):

  • cargo 0.23.0-nightly (e447ac7 2017-09-27)
  • cargo 0.22.0 (3423351 2017-10-06)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Error and warning messages generated by Cargo itself.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions