Cargo should print appropriate relative paths when being run from a non-root folder · Issue #9887 · rust-lang/cargo (original) (raw)
Currently, if you run cargo
commands from a place that is not the root (workspace root for workspace projects), it does (almost1) the same thing as if you had run cargo <foo> -p packagename
from the workspace root.
This means that the diagnostics also assume you are at the workspace root:
[10:17:15] मanishearth@manishearth-glaptop ~/dev/icu4x/components/calendar ^_^
$ carg<sup>1</sup>o check
Compiling icu_calendar v0.3.0 (/home/manishearth/dev/icu4x/components/calendar)
warning: missing documentation for the crate
--> components/calendar/src/lib.rs:5:1
|
5 | / #![cfg_attr(not(any(test, feature = "std")), no_std)]
6 | |
It would be nice if cargo could tell rustc where it is being invoked from, so that rustc may print appropriate paths. A lot of IDEs and terminals have the ability to click on paths in compiler output to open files; and it's frustrating that this only works if you cargo build -p package
from the workspace root.
1 I believe there are some slight differences as to which dependencies get built when you call cargo build -p foo
from the root vs a folder that depends on foo
See also