-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Comments
Some crates (e.g. rust-crypto) currently use hyphen in crate id: |
1.0 P-backcompat-lang |
@klutzy I might question why we allow crates to have names that are not valid idents. |
Having |
(Similarly, |
I like the idea of having the possibility to make crates (that is, filenames) which are not strict rust identifiers still usable in rust. |
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]
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
Current syntax still requires string rather than idents, e.g. |
@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. |
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. |
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.
It looks like crate ID's are unlikely to carry over into the cargo world. Right now our
extern crate
syntax supports a form likeRemove the
= "string"
syntax.Because we do still need to support renaming, add something like the following:
Nominating.
The text was updated successfully, but these errors were encountered: