Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cargo_metadata requires rustc to be on the $PATH #9295

Closed
illicitonion opened this issue Mar 23, 2021 · 1 comment
Closed

cargo_metadata requires rustc to be on the $PATH #9295

illicitonion opened this issue Mar 23, 2021 · 1 comment
Labels
C-bug Category: bug

Comments

@illicitonion
Copy link
Contributor

Problem

I tried to run cargo metadata with only a cargo binary on my $PATH, and no rustc.

I got an error that rustc could not be found.

Steps

  1. Remove rustc from your $PATH
  2. Run cargo metadata in some directory containing a Cargo.toml file

Notes

It appears to be because of this line of code:

let target_data = RustcTargetData::new(ws, &requested_kinds)?;

Which calls RustcTargetData::new.

This value doesn't appear to actually be used by any of the following code-paths, it's only used if some conditionals are hit which aren't triggered in the cargo metadata path (or at least, aren't without additional flags).

It would be useful to not need a rustc binary present in order to run cargo metadata.

Possible Solution(s)

I can imagine either making the rustc -vV invocation lazy, or a refactoring to not need to pass that arg around (or accept an Option)?

@ehuss
Copy link
Contributor

ehuss commented Mar 23, 2021

Hi! rustc is needed for computing target-specific features. Closing as a duplicate of #8219.

@ehuss ehuss closed this as completed Mar 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants