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

Improve error message when attempting to change features when replacing a dependency (may apply to [patch] too) #3740

Closed
debris opened this issue Feb 21, 2017 · 3 comments
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. A-patch Area: [patch] table override C-bug Category: bug

Comments

@debris
Copy link
Contributor

debris commented Feb 21, 2017

My project's Cargo.toml file

[package]
name = "sample"
version = "0.1.1"

[dependencies]
regex = "0.2.1"

[target.'cfg(target_os="android")'.dependencies]
jni = "0.3.1"

[replace]
"error-chain:0.5.0" = { default-features = false }

[lib]
name = "sample"
crate-type = ["staticlib", "cdylib"]

When I try to compile it, I get the following warnings:

warning: dependency (error-chain) specified without providing a local path, Git repository, or version to use. This will be considered an error in future versions

So, as suggested, I added version field to my replace.

[replace]
"error-chain:0.5.0" = { version = "0.5", default-features = false }

Now, I get an error

error: failed to parse manifest at `/Users/marek/projects/sample/cargo/Cargo.toml`

Caused by:
  replacements cannot specify a version requirement, but found one for `https://github.com/rust-lang/crates.io-index#error-chain:0.5.0`

So, either the first warning that I got was misleading, cause it suggested to use version property (via "or version to use"), or replacing version is broken

@alexcrichton
Copy link
Member

Ah yes the intention of [replace] is to switch sources of a crate, not for overriding turning off default features. In that sense I believe what you're trying to do here is unsupported.

In any case though the error message definitely could be better!

@carols10cents carols10cents changed the title replacements cannot specify a version requirement Improve error message when attempting to change features when replacing a dependency (may apply to [patch] too) Oct 2, 2017
@carols10cents carols10cents added A-diagnostics Area: Error and warning messages generated by Cargo itself. A-patch Area: [patch] table override A-replace C-bug Category: bug labels Oct 2, 2017
@stale
Copy link

stale bot commented Sep 20, 2018

As there hasn't been any activity here in over 6 months I've marked this as stale and if no further activity happens for 7 days I will close it.

I'm a bot so this may be in error! If this issue should remain open, could someone (the author, a team member, or any interested party) please comment to that effect?

The team would be especially grateful if such a comment included details such as:

  • Is this still relevant?
  • If so, what is blocking it?
  • Is it known what could be done to help move this forward?

Thank you for contributing!

(The cargo team is currently evaluating the use of Stale bot, and using #6035 as the tracking issue to gather feedback.)

If you're reading this comment from the distant future, fear not if this was closed automatically. If you believe it's still an issue please leave a comment and a team member can reopen this issue. Opening a new issue is also acceptable!

@stale stale bot added the stale label Sep 20, 2018
@stale
Copy link

stale bot commented Oct 20, 2018

As I didn't see any updates in 30 days I'm going to close this. Please see the previous comment for more information!

@stale stale bot closed this as completed Oct 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. A-patch Area: [patch] table override C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

3 participants