-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Allow to generate lockfile without registry update #3825
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
Conversation
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
09fb431
to
4970bf0
Compare
Thanks for the PR @matklad! As you could probably have predicted I have a number of thoughts about this feature :)
Overall this feels like a relatively niche use case which has a high likelihood for being misused unfortunately. To take advantage of this you'd need to:
Overall I've tended to felt that we didn't quite have a killer use case for this flag just yet (or a great name for it). I'd love to continue exploring though and seeing what we can come up with! |
Yeah, I totally understand that it's not clear at all if this is a desirable feature or not. First of all, The problem I want to solve with this feature is: "Without internet, it should be possible to start a new Rust project with dependencies, as long as you do have (accidentally) the necessary dependencies in What I like about this solution is that it is non-invasive: you don't add an
We don't have explicit tools to do that, but just generating lockfile without this flag should do this trick? Also, one can upload a binary to crates.io which depends on 500 most popular crates, and then it should be possible to
This would be nice to have, but I think not mandatory (except for the case "index is corrupted/does not exist, and I can't update it"). Because it is restricted to an explicit
About bug uncovering, this feature does not change any codepaths outside of
Agree here. The question is, how big is the niche (I remember a few annoyed people, who are unable to start a rust project offline) :) To sum up: the main improvement over previous suggestions in #1882 is that we are able to make the scope of the feature really narrow. |
☔ The latest upstream changes (presumably #3893) made this pull request unmergeable. Please resolve the merge conflicts. |
Guh sorry it took me awhile to get back to this! It's true yeah that you can just generate a I also personally feel that the error message here is critical to this feature. Whatever we name this flag the history of issues filed that think they want this flag indicates that it will be very commonly misconstrued as to its purpose. In that sense I believe errors need to be very clear about "this flag was passed, things may break". Otherwise my hunch is that we will start receiving a torrent of bug reports on Cargo (or worse, random crates throughout the ecosystem) about the "odd behavior" of this flag. The error message is in my mind an attempt to head off those reports and resolve confusion more quickly. Ah and for the bugs I meant moreso in the resolver itself. I don't think this is a buggy implementation, but historically the resolver has been buggy by asking for an index update when it didn't really need to. |
Okey! When in doubt, leave it out! Let's close this then because this flag can indeed be misused, even with error messages. Nevertheless, I like the idea of limiting the scope of this feature to |
Yeah that sounds plausible to me, having a targeted implementation! |
Attempt to fix #3479.
This particular implementation is quite probably broken, because there are no tests yet, I am planning to add them later :)
I really like how this features solves #1882 nicely: if you don't have internet connection, you can still add new dependencies, but you need to be super explicit about it.