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

Stabilize the rename-dependency feature #6311

Merged
merged 1 commit into from
Nov 15, 2018

Conversation

alexcrichton
Copy link
Member

This commit stabilizes Cargo's rename-dependency feature which allows
renaming packages in Cargo.toml, enabling importing multiple versions
of a single crate or simply avoiding a use foo as bar in src/lib.rs.

Closes #5653

This commit stabilizes Cargo's `rename-dependency` feature which allows
renaming packages in `Cargo.toml`, enabling importing multiple versions
of a single crate or simply avoiding a `use foo as bar` in `src/lib.rs`.

Closes rust-lang#5653
@alexcrichton alexcrichton added the T-cargo Team: Cargo label Nov 13, 2018
@alexcrichton
Copy link
Member Author

@rfcbot fcp merge

@rfcbot
Copy link
Collaborator

rfcbot commented Nov 13, 2018

Team member @alexcrichton has proposed to merge this. The next step is review by the rest of the tagged teams:

No concerns currently listed.

Once a majority of reviewers approve (and none object), 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.

@rust-lang rust-lang deleted a comment from alexcrichton Nov 13, 2018
@nrc
Copy link
Member

nrc commented Nov 13, 2018

Docs are at https://github.com/rust-lang/cargo/blob/5845464cf92a348f95dc6b43133c017c37fcb684/src/doc/src/reference/unstable.md#rename-dependency

From the issue it doesn't look like there is anything left to do except remove the feature gate and move the docs.

Summary of the feature (please correct me if I'm wrong): allows adding a package = "name" key to a dependency (foo = { package = "name" })which causes that dependency to be 'known by Cargo' (e.g., for download from crates.io and when referred to by other deps) by name, but known to rustc by the dependency name (e.g., foo).

Motivation for doing this now is that it allows users to rename crates without using extern crate and so helps with the 2018 edition. (We had wanted to uplift this to beta so it makes the edition, so consider a vote for stabilisation here to be a vote for 'stabilising and uplifting to beta').

AFAIK, there are no open questions.

(An obvious alternative would be to use the package name as the dependency name and add a rename key to the dep for use in rustc. Was this discussed?)

@alexcrichton
Copy link
Member Author

Ah yes sorry @nrc, should have included that in the OP! The docs should be moved here and updated slightly as well, but nothing major changed.

As for your summary, you're spot on!

As for rename, it was indeed discussed, but with the interaction around naming of optional features and optional dependencies it was decided that package was the best option to go with

@Eh2406
Copy link
Contributor

Eh2406 commented Nov 13, 2018

Before I check my box, can we confirm that this can be solved on the cratis.io side?

@dwijnand
Copy link
Member

(I initially thought @rfcbot unticked you @nrc by mistake, so I re-ticked you. Then I realised it might've been you logged in as @rfcbot testing or something. So I stopped trying to guess and left things alone. You're still ticked, in case that's wrong.)

@alexcrichton
Copy link
Member Author

@Eh2406 crates.io definitely has enough information to solve that eventually, although it will take some effort to do so.

@wycats
Copy link
Contributor

wycats commented Nov 13, 2018

How does this relate to public dependencies? I assume that the unification of public dependencies would be based on the un-aliased name?

@Eh2406
Copy link
Contributor

Eh2406 commented Nov 14, 2018

@wycats That was my understanding. I can try to find it in the RFC discussion if you'd like.

@alexcrichton
Copy link
Member Author

@Eh2406 is correct, this shouldn't affect public/private in the sense that this is basically just a local renaming for the crate in question, but all the same public/private rules are in effect for the actual package itself, regardless of what each crate decides to call it.

@rfcbot
Copy link
Collaborator

rfcbot commented Nov 14, 2018

🔔 This is now entering its final comment period, as per the review above. 🔔

psst @alexcrichton, I wasn't able to add the final-comment-period label, please do so.

@dwijnand dwijnand added the final-comment-period FCP — a period for last comments before action is taken label Nov 14, 2018
@alexcrichton
Copy link
Member Author

@bors: r=the-whole-team

@bors
Copy link
Contributor

bors commented Nov 15, 2018

📌 Commit 1533a04 has been approved by the-whole-team

@bors
Copy link
Contributor

bors commented Nov 15, 2018

⌛ Testing commit 1533a04 with merge af1814e77f0a1837f9ef1ab492c9b72371b30873...

@bors
Copy link
Contributor

bors commented Nov 15, 2018

💥 Test timed out

@alexcrichton
Copy link
Member Author

@bors: retry

@bors
Copy link
Contributor

bors commented Nov 15, 2018

⌛ Testing commit 1533a04 with merge bf52011a573c5ae088974d1ef61774637ea8a2b5...

@dwijnand
Copy link
Member

Huh. Is "the-whole-team" a magic string, or does bors accept anything as the value of r=?

@bors
Copy link
Contributor

bors commented Nov 15, 2018

💥 Test timed out

@SimonSapin
Copy link
Contributor

It accepts anything, and only checks who writes the command.

@Eh2406 Eh2406 closed this Nov 15, 2018
@Eh2406 Eh2406 reopened this Nov 15, 2018
@Eh2406
Copy link
Contributor

Eh2406 commented Nov 15, 2018

@bors: r=the-whole-team

@bors
Copy link
Contributor

bors commented Nov 15, 2018

💡 This pull request was already approved, no need to approve it again.

  • This pull request previously failed. You should add more commits to fix the bug, or use retry to trigger a build again.

@bors
Copy link
Contributor

bors commented Nov 15, 2018

📌 Commit 1533a04 has been approved by the-whole-team

@bors
Copy link
Contributor

bors commented Nov 15, 2018

⌛ Testing commit 1533a04 with merge b3d0b2e...

bors added a commit that referenced this pull request Nov 15, 2018
Stabilize the `rename-dependency` feature

This commit stabilizes Cargo's `rename-dependency` feature which allows
renaming packages in `Cargo.toml`, enabling importing multiple versions
of a single crate or simply avoiding a `use foo as bar` in `src/lib.rs`.

Closes #5653
@bors
Copy link
Contributor

bors commented Nov 15, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: the-whole-team
Pushing b3d0b2e to master...

@bors bors merged commit 1533a04 into rust-lang:master Nov 15, 2018
@alexcrichton alexcrichton deleted the stabilize-renames branch November 16, 2018 08:36
bors added a commit that referenced this pull request Nov 16, 2018
[beta] Stabilize the `rename-dependency` feature

This is a backport of #6311
@ehuss ehuss modified the milestones: 1.32.0, 1.31.0 Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
final-comment-period FCP — a period for last comments before action is taken T-cargo Team: Cargo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Renaming dependencies in Cargo.toml
9 participants