-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Tracking Issue for cargo rustc --print=VAL #9357
Copy link
Copy link
Open
Labels
C-tracking-issueCategory: A tracking issue for something unstable.Category: A tracking issue for something unstable.S-waiting-on-feedbackStatus: An implemented feature is waiting on community feedback for bugs or design concerns.Status: An implemented feature is waiting on community feedback for bugs or design concerns.
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: A tracking issue for something unstable.Category: A tracking issue for something unstable.S-waiting-on-feedbackStatus: An implemented feature is waiting on community feedback for bugs or design concerns.Status: An implemented feature is waiting on community feedback for bugs or design concerns.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
Unstable, baking
Summary
Original issue: #8923
Implementation: #9002
cargo rustc --print=VALforwards the--printflag torustcin order to extract information fromrustc. This runsrustcwith the corresponding--printflag, and then immediately exits without compiling. Exposing this as a cargo flag allows cargo to inject the correct target and RUSTFLAGS based on the current configuration.The primary use case is to run
cargo rustc --print=cfgto get config values for the appropriate target and influenced by any other RUSTFLAGS.Unresolved issues
(These aren't necessarily blockers, just random thoughts about the current design.)
cfgis the only value that is worth printing. It is not clear from a UI perspective if it makes sense to expose the other values, since several will just fail or don't add anything different than runningrustcdirectly. Forwarding the print value to rustc is more flexible and probably fine, though it seems like it could cause confusion.--print=cfgmeans anyone using it needs to implement a parser for the ad-hoc format. The original implementation parsed it and returned JSON, which might be easier to consume? There was some back-and-forth discussion on the PR about this, and possibly using a more general purpose subcommand (likecargo config) for "expose internal information". It might be worth considering that more.--targetflags is a little strange.debug_assertions). However, all of cargo ignores profiles for the intended use case (--print=cfg). It's not clear what this should do.Future extensions
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.