Skip to content

Cargo runs rustc from the workspace root #8947

Open
@jyn514

Description

@jyn514

Bug? Inconvenience? Who knows, but it confused me greatly.

Problem

I ran cargo build --lib -- -Z self-profile from src/librustdoc in a clone of https://github.com/rust-lang/rust/. I expected the output file to be in src/librustdoc/rustdoc-24097.mm_profdata, since that's where it would be if I ran rustc directly. Instead they showed up in the workspace root: rustdoc-24097.mm_profdata.

Steps

  1. git clone https://github.com/rust-lang/rust/
  2. cd rust/src/librustdoc
  3. git checkout 500b0f3c1ba651f31abc551ccbcf222f48e355a2
  4. cargo build --lib -- -Z self-profile

(but I think this is true in any workspace)

Possible Solution(s)

Run rustc from the src/librustdoc folder instead, which will put the file in the expected place.

Notes

Output of cargo version: cargo 1.50.0-nightly (bfca1cd 2020-11-24)

I don't think this is a bug per-se, but it would be nice to document, maybe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-documenting-cargo-itselfArea: Cargo's documentationC-bugCategory: bugS-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