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

Remove crate_id support from extern crate #14468

Closed
brson opened this issue May 27, 2014 · 9 comments · Fixed by #15319
Closed

Remove crate_id support from extern crate #14468

brson opened this issue May 27, 2014 · 9 comments · Fixed by #15319
Assignees
Milestone

Comments

@brson
Copy link
Contributor

brson commented May 27, 2014

It looks like crate ID's are unlikely to carry over into the cargo world. Right now our extern crate syntax supports a form like

extern crate foo = "foo:1.0#path"; // or something similar

Remove the = "string" syntax.

Because we do still need to support renaming, add something like the following:

extern crate foo = bar;

Nominating.

@klutzy
Copy link
Contributor

klutzy commented May 28, 2014

Some crates (e.g. rust-crypto) currently use hyphen in crate id: extern crate crypto = "rust-crypto";. This change does not permit such ids. (It may be a non-issue if we also accept #14470.)

@brson brson added this to the 1.0 milestone May 29, 2014
@brson
Copy link
Contributor Author

brson commented May 29, 2014

1.0 P-backcompat-lang

@brson
Copy link
Contributor Author

brson commented May 30, 2014

@klutzy I might question why we allow crates to have names that are not valid idents.

@emberian
Copy link
Member

emberian commented Jun 1, 2014

Having rust- in a crate name seems extremely redundant and pointless.

@emberian
Copy link
Member

emberian commented Jun 1, 2014

(Similarly, -rs)

@tbu-
Copy link
Contributor

tbu- commented Jun 9, 2014

I like the idea of having the possibility to make crates (that is, filenames) which are not strict rust identifiers still usable in rust.

pcwalton added a commit to pcwalton/rust that referenced this issue Jun 14, 2014
Issue rust-lang#14468.

After a snapshot, it will be possible to remove the `extern crate foo =
STRING` syntax in favor of the new `extern crate foo = IDENT`.

This will break crates that have names that are not valid Rust
identifiers (in particular, those that contain hyphens). Change such
crates to have names that correspond to valid Rust identifiers. (Most
commonly, this will involve changing hyphens to underscores.)

[breaking-change]
bors added a commit that referenced this issue Jul 5, 2014
This is an implementation of [RFC 35](https://github.com/rust-lang/rfcs/blob/master/active/0035-remove-crate-id.md).

The summary for this PR is the same as that of the RFC, with one addendum:


* Removes the `#[crate_id]` attribute and knowledge of versions from rustc.
* Added a `#[crate_name]` attribute similar to the old `#[crate_id]` attribute
* Output filenames no longer have versions or hashes
* Symbols no longer have versions (they still have hashes)
* A new flag, `--extern`, is used to override searching for external crates
* A new flag, `-C metadata=foo`, used when hashing symbols
* [added] An old flag, `--crate-name`, was re purposed to specify the crate name from the command line.

I tried to maintain backwards compatibility wherever possible (with warnings being printed). If I missed anywhere, however, please let me know!

[breaking-change]

Closes #14468
Closes #14469
Closes #14470
Closes #14471
@klutzy
Copy link
Contributor

klutzy commented Oct 16, 2014

Current syntax still requires string rather than idents, e.g. extern crate "rust-crypto" as crypto;.
@brson Is current status ok? I thought we wanted to remove support of non-ident crate_name at all.

@brson
Copy link
Contributor Author

brson commented Oct 17, 2014

@klutzy I believe the current approach is to leave it as a string so that people can continue using the dash. @alexcrichton may have more up to date info.

@alexcrichton
Copy link
Member

Yeah, those are my thoughts as well. We've considered in the past of allowing to drop the quotes if the name of the crate is an identifier, but that's also a backwards-compatible change.

bors added a commit to rust-lang-ci/rust that referenced this issue Jun 5, 2023
Expand Macro Recursively: don't append "!" to non-bang macro name

When we run `Expand Macro Recursively`, we prepend a comment "Recursive expansion of foo! macro" to the expansion result. I've noticed we unconditionally render the macro name with "!" and, while super subtle, I feel a bit awkward when the macro is either a derive or attribute macro.
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 a pull request may close this issue.

5 participants