-
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
metadata: Supply local path for path dependencies #8994
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
To bikeshed a bit, perhaps we could call this With a generic name like Could you also update the documentation at https://doc.rust-lang.org/cargo/commands/cargo-metadata.html to document this new field? |
@alexcrichton I've updated it to |
@rfcbot fcp merge This is adding a new |
Team member @alexcrichton has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
I'm not sure if this completely solves the When I was looking at this in the past, I was considering a few different options:
Changing the behavior of |
@ehuss My impression from @calebcartwright was that these changes would be meaningful improvement for I agree that we probably want a more complete fix to this down the line to make the recursion unnecessary. However, such a fix would also need to include the path to any such local dependencies anyway, so this change seems (at least to me) to be a subset of the ultimate fix. And given that it gives tangible benefits in its current form, I feel like it's probably worthwhile to merge this now, and then make the larger adjustment subsequently? Especially since those larger adjustments you suggest probably also carry with them more risk, since they will cause additional dependencies to be listed that weren't before. |
I'm not sure I see that. If it listed all path-packages, then |
Just want to reiterate for local context on this thread that we already do exactly this today in If there's a better holistic solution then I can understand the preference for that, though if such a solution is a long way off from being available then I do think the adage about not letting perfection be the enemy of the good (enough) is worth keeping in mind |
I don't think the alternative is necessarily a long way off. I think I personally would be fine with changing I haven't looked at implementing it, but I would not expect it to be too difficult. |
@ehuss So if I'm understanding you correctly, you'd want path dependencies to appear in the I could try to find some time to build your alternative proposal, but I don't have a good sense for how to even go about finding all the transitive path dependencies to inject into |
I have implemented the alternative proposal (which I like much better as it avoids the user needing to recursively call cargo) in #9024. |
I'm a little skeptical about a solution like #9024 myself. I realize that not having that forces a rustfmt-like-use-case to call cargo multiple times, however. With #9024, though, where we try to provide information about path dependencies I'm worried about a package showing up with That being said I don't know how to best implement the desired rustfmt behavior. Is the desired behavior to format everything on the local filesystem that you can? Or is it to only format the members in |
I think the simplest way to describe the ask is for the ability to utilize rustfmt wants this feature, because there's an assumption (IMO a reasonable one) users have that running Setting aside the explicit rustfmt use case though, as a user inspecting the |
It also sort of depends on the precise desires of rustfmt, if you're ok formatting packages not actually in the current project's compile graph, then something like #9024 would work alright. Otherwise I believe it's impossible to precisely know the set of path dependencies for a project without network access (e.g. without actually constructing the resolution graph). The resolution graph takes into account features that could be activated, and if you have Basically what I'm trying to say is that I think fundamentally |
@alexcrichton My guess is that cargo fmt wants the latter, since formatting "too much" when |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
@alexcrichton - Thank you for this! I think the way you worded it has helped me finally understand where the challenge/friction may be coming from. From a "format everything" perspective (aka What we're really looking for to support the rustfmt use case is "for this given package, i want the path value for all
Agreed (not only okay with it, but actually the desired behavior).
Also agreed. cargo fmt already runs cargo multiple times recursively as many times as needed, and no matter what does/doesn't happen we'd have to continue to support that for a long time anyway (to maintain BC with older versions of cargo) |
Ok we got a chance to talk about this today in the Cargo team meeting, and the conclusion was that we're ok going ahead and landing this PR but would prefer to hold off on #9024. Our thinking is that rustfmt will continue to call (I'm gonna hold off on approving for @ehuss's final sign-off as well) |
We talked about this in the team meeting and decided to go ahead and merge this, and maybe hold off on #9024 for now. Thanks @jonhoo for pushing this forward! @jonhoo or @calebcartwright are you interested in updating @bors r+ |
📌 Commit fd25f93 has been approved by |
Absolutely!
Updating cargo fmt to take advantage of this (once available) will be pretty high up on my rustfmt list, though if @jonhoo (or anyone else) gets around to a PR before me that'd be swell too 👍 |
☀️ Test successful - checks-actions |
@calebcartwright I will probably not beat you to it, though I did file a PR with |
Update cargo 12 commits in 75d5d8cffe3464631f82dcd3c470b78dc1dda8bb..329895f5b52a358e5d9ecb26215708b5cb31d906 2020-12-22 18:10:56 +0000 to 2021-01-06 00:01:52 +0000 - metadata: Supply local path for path dependencies (rust-lang/cargo#8994) - Add support for Rust edition 2021. (rust-lang/cargo#8922) - Stabilize -Zfeatures and -Zpackage-features. (rust-lang/cargo#8997) - Small refactor, adding a list of all kinds to BuildContext (rust-lang/cargo#9046) - Fix git http.proxy config setting. (rust-lang/cargo#8986) - Clarify the help text of `--aggressive` and `--precise` of `update` (rust-lang/cargo#9031) - Assert that tests are run in the crate directory (rust-lang/cargo#9037) - Update mdbook (rust-lang/cargo#9044) - Bump to 0.52.0, update changelog (rust-lang/cargo#9042) - Fix redundant semicolon. (rust-lang/cargo#9033) - Clarify fingerprint log messages (rust-lang/cargo#9026) - Update credential docs for gnome-secret. (rust-lang/cargo#9013)
Update cargo 12 commits in 75d5d8cffe3464631f82dcd3c470b78dc1dda8bb..329895f5b52a358e5d9ecb26215708b5cb31d906 2020-12-22 18:10:56 +0000 to 2021-01-06 00:01:52 +0000 - metadata: Supply local path for path dependencies (rust-lang/cargo#8994) - Add support for Rust edition 2021. (rust-lang/cargo#8922) - Stabilize -Zfeatures and -Zpackage-features. (rust-lang/cargo#8997) - Small refactor, adding a list of all kinds to BuildContext (rust-lang/cargo#9046) - Fix git http.proxy config setting. (rust-lang/cargo#8986) - Clarify the help text of `--aggressive` and `--precise` of `update` (rust-lang/cargo#9031) - Assert that tests are run in the crate directory (rust-lang/cargo#9037) - Update mdbook (rust-lang/cargo#9044) - Bump to 0.52.0, update changelog (rust-lang/cargo#9042) - Fix redundant semicolon. (rust-lang/cargo#9033) - Clarify fingerprint log messages (rust-lang/cargo#9026) - Update credential docs for gnome-secret. (rust-lang/cargo#9013)
This is potentially a simpler way to address #7483 than #8988.
/cc rust-lang/rustfmt#4247
Fixes #7483.