Since Rust 1.34, you can use extern crate self as my_crate
, and use my_crate::Foo
instead of $crate::Foo
.
https://github.com/rust-lang/rust/issues/54647
https://github.com/rust-lang/rust/pull/57407
(Credit: Neptunepink ##rust irc.freenode.net)