Open
Description
Package
and Target
are two important internal datastructures in Cargo, and we expose them for tools via various JSON messages.
To refer to a pacakge, we use an opaque in theory PackageId
string. We don't have an obvious way to refer to a target of a package, and that I think causes problems.
Specifically, I think we have three places which would like to refer to targets, and each does it in its own way:
- In
Artifact
, we refer to target by just printing the whole target - In cargo metadata, we don't refer to targets from resolve deps at all, but we probably should
- In the build plan PR, we print
TargetKind
, which is ambiguous.
Possible solution
-
Just use the whole target as in
Artifact
, everywhere (on the one hand, this seems kind-of inelegant and duplicate, on the other hand, this is simple and straightforward) -
Use path to root file as a target_id, or (if that's ambigious), a pair of
kind, path