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 rustc: "--profile" does not work with "--lib" #6640

Closed
RalfJung opened this issue Feb 7, 2019 · 2 comments
Closed

cargo rustc: "--profile" does not work with "--lib" #6640

RalfJung opened this issue Feb 7, 2019 · 2 comments
Labels
C-bug Category: bug

Comments

@RalfJung
Copy link
Member

RalfJung commented Feb 7, 2019

Problem

When I pass both --lib and --profile options to cargo rustc, compilation errors.

Steps

  1. Clone hashbrown
  2. "cargo" "rustc" "--lib" "hashbrown" "--profile" "test"

This errors saying

error: Unrecognized option: 'profile'

error: Could not compile `hashbrown`.

To learn more, run the command again with --verbose.

Seems like it passes the flag to rustc?

Changing the argument order changes the error:

  1. "cargo" "rustc" --profile test "--lib" "hashbrown"
error: multiple input filenames provided

error: Could not compile `hashbrown`.

To learn more, run the command again with --verbose.

Notes

With --bin, everything works as expected. Just --lib is affected.

Output of cargo version: cargo 1.32.0 (8610973 2019-01-02)

@ehuss
Copy link
Contributor

ehuss commented Feb 7, 2019

--lib does not take an argument. When you pass the arg hashbrown, clap decides everything after it belongs to the rustc arguments. This is a convenience which is maybe not always so convenient.

I think what you want is.

cargo rustc --lib --profile test

@RalfJung
Copy link
Member Author

RalfJung commented Feb 7, 2019

D'oh. Yes that works. Thanks!

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