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

Tweak how hyphens in crate names are allowed #23533

Closed
alexcrichton opened this Issue Mar 19, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@alexcrichton
Copy link
Member

alexcrichton commented Mar 19, 2015

  • remove the quote syntax from extern crate, require an identifier to be used instead - #23546
  • Prevent duplicate uploads of foo-bar and foo_bar to crates.io change
  • Automatically translate - to _ in Cargo for passing the --extern flag - rust-lang/cargo#1443

As an interim step, the compiler should continue to accept extern crate "foo-bar" as ... both in terms of quotes and in terms of matching the identifier foo_bar as well. This should help reduce the breakage a little.

triage: P-backcompat-lang (1.0 beta)

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Mar 19, 2015

Er, tracking issue for rust-lang/rfcs#940

alexcrichton added a commit to alexcrichton/rust that referenced this issue Mar 20, 2015

rustc: Add support for `extern crate foo as bar`
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 added a commit to alexcrichton/rust that referenced this issue Mar 20, 2015

rustc: Add support for `extern crate foo as bar`
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 added a commit to alexcrichton/rust that referenced this issue Mar 20, 2015

rustc: Add support for `extern crate foo as bar`
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 added a commit to alexcrichton/rust that referenced this issue Mar 20, 2015

rustc: Add support for `extern crate foo as bar`
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 added a commit to alexcrichton/rust that referenced this issue Mar 20, 2015

rustc: Add support for `extern crate foo as bar`
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 added a commit that referenced this issue Mar 24, 2015

Auto merge of #23546 - alexcrichton:hyphens, r=brson
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 alexcrichton self-assigned this Mar 24, 2015

alexcrichton added a commit to alexcrichton/rust that referenced this issue Mar 24, 2015

rustc: Add support for `extern crate foo as bar`
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 added a commit that referenced this issue Mar 24, 2015

Auto merge of #23546 - alexcrichton:hyphens, r=brson
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 issue Mar 24, 2015

rollup merge of rust-lang#23546: alexcrichton/hyphens
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
@jnicholls

This comment has been minimized.

Copy link

jnicholls commented Mar 27, 2015

As an interim step, the compiler should continue to accept extern crate "foo-bar" as ...

Based on the latest rustc, this is not working. It is still looking for a target named "foo-bar" when it should be looking for "foo_bar". By changing that line to extern crate foo_bar as ... it works. Appropriate warnings are produced regarding this change, but it does seem to be breaking builds at the moment.

@alexcrichton

This comment has been minimized.

Copy link
Member Author

alexcrichton commented Mar 27, 2015

Yeah I think I unfortunately botched that part of this :(, sorry about that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.