-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 fails to add dependency if it is renamed, gated, and in private registry #14365
Comments
Could you give full reproduction steps? This leaves out any of how kellnr needs to be setup. Have you verified if any of that combination of situations can be removed and still reproduce?
|
I haven't set up kellnr, but will try to do so and add. All of the other combinations are presented to demonstrate correct behaviour, both renaming and feature gate must be done I am hesitant to publish a crate to crates.io just to try to reproduce a bug. I can add that to my existing crate and then yank a version, though Update: I've added minimal config file and steps to run kellnr, wasn't as hard as I thought |
Thank you for setting up the reproduction. It's quote smooth to follow it step-by-step! This is a duplicate of #14321, and is fixed via #14325. The current nightly and beta channel should contain that fix. This is the diff of old/new crate index file. {
"name": "example-dependency",
"vers": "0.1.0",
"deps": [
// omit...
],
"cksum": "6a57a2a0b45843db52c2aef915f659de5d50a1e4ae1b3b15372d95308e434d39",
"features": {
"compat-http": [
+ "dep:http_0_2",
"dep:http"
],
"default": []
},
"yanked": false,
"v": 1
} Close as the fix is already in beta and will be stable in 1.81.0 |
For some extra context from the other issue: 1.78, 1.79. and 1.80 were affected. 1.81 is 4 weeks from release. |
Thank you! Appreciate your answer and the details I've tried to find an issue before opening one, but unfortunately was not fruitful in that 😅 |
Problem
When a dependency is renamed (e.g.
http@0.2
is referred ashttp_0_2
to be able to add compatibility features), gated behind a feature (e.g.compat-http
), and published to a private registry, this dependency does not make it intoCargo.lock
, output ofcargo tree
, and fails to compile with a message about undeclared module, e.g.:Steps
docker run --rm -it \ -p 8000:8000 \ -e "KELLNR_ORIGIN__HOSTNAME=localhost" ghcr.io/kellnr/kellnr:5.0.0
example-dependency
:Example repository: https://github.com/sukhmel/renamed-dependency-missing-for-feature
Possible Solution(s)
I think, this may be mitigated by adding a crate that reimports the crate that was supposed to be renamed (or several crates at once)
Notes
both feature gate and rename are required to produce a failure:
Possibly a bug in https://github.com/kellnr/kellnr but
Cargo.toml
for the package seems correct: example-dependency-0.1.1-Cargo.tomlVersion
The text was updated successfully, but these errors were encountered: