Skip to content

Drop extern crate #1358

Closed
Closed
@butlermatt

Description

@butlermatt

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions