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

Use listed dependency name for feature names #5811

Merged
merged 1 commit into from
Jul 31, 2018

Conversation

alexcrichton
Copy link
Member

This commit updates the implementation of renamed dependencies to use the listed
name of a dependency in Cargo.toml for the name of the associated feature,
rather than using the package name. This'll allow disambiguating between
different packages of the same name and was the intention all along!

Closes #5753

@rust-highfive
Copy link

r? @matklad

(rust_highfive has picked a reviewer for you, use r? to override)

@alexcrichton
Copy link
Member Author

r? @ehuss

@@ -209,7 +209,11 @@ impl Dependency {
&self.inner.req
}

pub fn name(&self) -> InternedString {
pub fn name_in_toml(&self) -> InternedString {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind adding a short docstring to name_in_toml, package_name, and rename? Perhaps with a little hint on when to use which? I suspect future me is going to forget and be confused.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing!

@alexcrichton alexcrichton force-pushed the rename-crate-feature-names branch 2 times, most recently from 9f3910c to a8f3bf8 Compare July 31, 2018 14:07
@alexcrichton
Copy link
Member Author

@bors: r=ehuss

@bors
Copy link
Contributor

bors commented Jul 31, 2018

📌 Commit a8f3bf8aab2d1c90442d4c0ac5894e3a27503bc4 has been approved by ehuss

/// Usually this is what's written on the left hand side of a dependencies
/// section, but it can also be renamed via the `package` key.
///
/// Both of the dependencies below return `foo` for `name_in_toml`:
Copy link
Member

@dwijnand dwijnand Jul 31, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"for package_name", surely?

@alexcrichton
Copy link
Member Author

@bors: r-

Oops, yes @dwijnand!

This commit updates the implementation of renamed dependencies to use the listed
name of a dependency in Cargo.toml for the name of the associated feature,
rather than using the package name. This'll allow disambiguating between
different packages of the same name and was the intention all along!

Closes rust-lang#5753
@alexcrichton
Copy link
Member Author

@bors: r=ehuss

@bors
Copy link
Contributor

bors commented Jul 31, 2018

📌 Commit 5295cad has been approved by ehuss

/// The renamed name of this dependency, if any.
///
/// If the `package` key is used in `Cargo.toml` then this returns the same
/// value as `name_in_toml`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to stall this PR, but after several attempts I still can't wrap my head around this explanation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah sorry about that! I'll try to get around to cleaning this up soon.

@bors
Copy link
Contributor

bors commented Jul 31, 2018

⌛ Testing commit 5295cad with merge ac037ab4e8d7bef2735d0d3795a5e9bb2cb4860a...

@bors
Copy link
Contributor

bors commented Jul 31, 2018

💥 Test timed out

@alexcrichton
Copy link
Member Author

@bors: retry

@bors
Copy link
Contributor

bors commented Jul 31, 2018

⌛ Testing commit 5295cad with merge d9feff2...

bors added a commit that referenced this pull request Jul 31, 2018
Use listed dependency name for feature names

This commit updates the implementation of renamed dependencies to use the listed
name of a dependency in Cargo.toml for the name of the associated feature,
rather than using the package name. This'll allow disambiguating between
different packages of the same name and was the intention all along!

Closes #5753
@bors
Copy link
Contributor

bors commented Jul 31, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: ehuss
Pushing d9feff2 to master...

@bors bors merged commit 5295cad into rust-lang:master Jul 31, 2018
@alexcrichton alexcrichton deleted the rename-crate-feature-names branch July 31, 2018 21:14
@ehuss ehuss added this to the 1.29.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Renamed optional dependency should use the renamed name
6 participants