Skip to content

Using --manifest-path, the filenames in error messages are relative to the manifest, not the current working directory #11007

@RalfJung

Description

@RalfJung

Problem

When using --manifest-path, the filenames in error messages are relative to the manifest given, not the directory cargo is invoked from.

Steps

  1. For example in Miri, introduce a build failure in cargo-miri/src/main.rs.
  2. Run cargo check --manifest-path cargo-miri/Cargo.toml
  3. Notice the error refers to src/main.rs:21:17

Possible Solution(s)

Cargo could instruct rustc to print the paths relative to a given directory, or it could adjust the paths itself.

Notes

This also affects the rustc repo, where we have 3 workspaces currently (the main one, bootstrap, and codegen_cranelift). Errors in codegen_cranelift show paths that are quite hard to interpret since they are relative to src/compiler/rustc_codegen_cranelift, which is hard to users to even realize.

Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions