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

rustc: Add support for extern crate foo as bar #23546

Merged
merged 1 commit into from
Mar 25, 2015

Conversation

alexcrichton
Copy link
Member

The compiler will now issue a warning for crates that have syntax of the form
extern crate "foo" as bar, but it will still continue to accept this syntax.
Additionally, the string foo-bar will match the crate name foo_bar to assist
in the transition period as well.

This patch will land hopefully in tandem with a Cargo patch that will start
translating all crate names to have underscores instead of hyphens.

cc #23533

@rust-highfive
Copy link
Collaborator

r? @pcwalton

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

@lambda-fairy
Copy link
Contributor

Oh dear... I've already implemented this as well 😱

I think I'll support your version as it's less intrusive, but I'll keep mine around for reference.

(For the record, I took a slightly different approach. My branch pretty much enforces that crate names are identifiers right away instead of patching around it.)

@alexcrichton
Copy link
Member Author

Oh oops, sorry about that! I think that we'll definitely want to move towards your approach soon, but for now we want to try to smooth the transition. I don't expect the code to allow hyphens to stick around longer than a week!

@alexcrichton
Copy link
Member Author

I've also got crates.io support implemented, just need to deal with some straggler crates that violate the new rule. I will work on a cargo implementation for the RFC soon as well (and this should not be r+'d until that's ready).

@alexcrichton
Copy link
Member Author

I've updated with a new warning that's emitted whenever a crate name contains a hyphen. This should cover the case @lfairy did that I forgot where you pass --crate-name or it's otherwise inferred from the file name.

@alexcrichton
Copy link
Member Author

Ok, crates.io is now rejecting uploads of crates that only differ in hyphens vs underscores

@alexcrichton
Copy link
Member Author

I should also note that this adds a bunch of warnings to the build because we have some extern crate "foo" as bar, but they should all be removable after a new snapshot lands.

@alexcrichton
Copy link
Member Author

r? @brson

@lambda-fairy
Copy link
Contributor

@alexcrichton That sounds good. I'm swamped with course work right now, so I don't mind you taking it from here ;)

@alexcrichton
Copy link
Member Author

Ok, I have implemented cargo support and this should be ready to go.

@brson
Copy link
Contributor

brson commented Mar 24, 2015

@bors r+ p=1

@bors
Copy link
Contributor

bors commented Mar 24, 2015

📌 Commit 19742ea has been approved by brson

@bors
Copy link
Contributor

bors commented Mar 24, 2015

⌛ Testing commit 19742ea with merge 694183f...

@bors
Copy link
Contributor

bors commented Mar 24, 2015

⛄ The build was interrupted to prioritize another pull request.

@bors
Copy link
Contributor

bors commented Mar 24, 2015

🔒 Merge conflict

@bors
Copy link
Contributor

bors commented Mar 24, 2015

☔ The latest upstream changes (presumably #23654) made this pull request unmergeable. Please resolve the merge conflicts.

The compiler will now issue a warning for crates that have syntax of the form
`extern crate "foo" as bar`, but it will still continue to accept this syntax.
Additionally, the string `foo-bar` will match the crate name `foo_bar` to assist
in the transition period as well.

This patch will land hopefully in tandem with a Cargo patch that will start
translating all crate names to have underscores instead of hyphens.

cc rust-lang#23533
@alexcrichton
Copy link
Member Author

@bors: r=brson eb2f1d9

@bors
Copy link
Contributor

bors commented Mar 24, 2015

⌛ Testing commit eb2f1d9 with merge 123a754...

bors added a commit that referenced this pull request Mar 24, 2015
The compiler will now issue a warning for crates that have syntax of the form
`extern crate "foo" as bar`, but it will still continue to accept this syntax.
Additionally, the string `foo-bar` will match the crate name `foo_bar` to assist
in the transition period as well.

This patch will land hopefully in tandem with a Cargo patch that will start
translating all crate names to have underscores instead of hyphens.

cc #23533
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Mar 24, 2015
The compiler will now issue a warning for crates that have syntax of the form
`extern crate "foo" as bar`, but it will still continue to accept this syntax.
Additionally, the string `foo-bar` will match the crate name `foo_bar` to assist
in the transition period as well.

This patch will land hopefully in tandem with a Cargo patch that will start
translating all crate names to have underscores instead of hyphens.

cc rust-lang#23533
@bors
Copy link
Contributor

bors commented Mar 25, 2015

💔 Test failed - auto-win-32-nopt-t

@alexcrichton
Copy link
Member Author

@bors: retry

On Tue, Mar 24, 2015 at 6:21 PM, bors notifications@github.com wrote:

[image: 💔] Test failed - auto-win-32-nopt-t
http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/3889


Reply to this email directly or view it on GitHub
#23546 (comment).

@bors
Copy link
Contributor

bors commented Mar 25, 2015

@bors
Copy link
Contributor

bors commented Mar 25, 2015

⛄ The build was interrupted to prioritize another pull request.

@alexcrichton
Copy link
Member Author

@bors: force

@alexcrichton
Copy link
Member Author

This PR actually passed except for a known spurious failure, so I'm going to merge manually.

@alexcrichton alexcrichton merged commit eb2f1d9 into rust-lang:master Mar 25, 2015
@alexcrichton alexcrichton deleted the hyphens branch March 25, 2015 01:33
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.

None yet

6 participants