Does `extern crate` serve any purpose in the 2021 edition?

As in the other thread, extern crate alloc; is one use, as is #![no_std] #[cfg(feature = "std")] extern crate std;.

One use that I don't see often mentioned is extern crate self as name, which allows you to use ::name in addition to ::crate to refer to your own crate. This can be useful for e.g. macros, or even just for making internal code look more like external code.

9 Likes