Skip to content

Cargo confused about broken Cargo.toml in $HOMEΒ #6706

@vorner

Description

@vorner

Problem

Sometimes, I just temporarily copy or move files to my $HOME (during a rebase or something). I did that with Cargo.toml today.

If I try to run cargo build in any project, it then tries to load the Cargo.toml in the $HOME too β€’ which is likely unrelated to the current project and is likely broken (because $HOME/src does not exist, so it can't decide what to compile there). That is quite confusing behaviour.

$ cargo new stuff
     Created binary (application) `stuff` package
$ cd stuff/
$ cargo build
   Compiling stuff v0.1.0 (/home/vorner/stuff)
    Finished dev [unoptimized + debuginfo] target(s) in 0.15s
$ cp Cargo.toml ~
$ cargo build
error: failed to parse manifest at `/home/vorner/Cargo.toml`

Caused by:
  no targets specified in the manifest
  either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present

Notes

Output of cargo version:

cargo 1.34.0-nightly (5c6aa46e6 2019-02-22) (but happens with stable too, so I guess it's there for a while)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-manifestArea: Cargo.toml issuesC-bugCategory: bugS-needs-team-inputStatus: Needs input from team on whether/how to proceed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions