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

Drop extern crate #1358

Closed
butlermatt opened this issue Jun 24, 2020 · 2 comments
Closed

Drop extern crate #1358

butlermatt opened this issue Jun 24, 2020 · 2 comments

Comments

@butlermatt
Copy link

Hi Folk,

I'm still new to Rust, and when looking at Rust by Example section 11.2 it indicates that:

To link a crate to this new library, the extern crate declaration must be used. This will not only link the library, but also import all its items under a module named the same as the library. The visibility rules that apply to modules also apply to libraries.

However I was under the impression that as of Rust 2018, the extern crate functionality was no longer required (eg: the "must" key word here is no longer valid, and perhaps "may" is more applicable). Since 2015 and older syntax still use the extern crate, it is probably important to mention this functionality but perhaps demonstrate how it has now been superseded by the ability to import with use statements. In fact "The Book" now specifically states that it is "unidiomatic" to use extern crate. (https://doc.rust-lang.org/reference/items/extern-crates.html in the "Edition Differences" aside).

I feel these two areas should be brought in alignment with each other.

@steveklabnik
Copy link
Member

Yes, this should be done. I'd happily accept a PR to do it.

@xiaochuanyu
Copy link
Contributor

@steveklabnik I opened a PR to address this issue. I'm somewhat new to Rust so I would really appreciate your feedback on the PR if anything is wrong.

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

No branches or pull requests

4 participants