File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1+ //! A "shim crate" intended to multiplex the `proc_macro` API on to stable Rust.
2+ //!
3+ //! Procedural macros in Rust operate over the upstream
4+ //! `proc_macro::TokenStream` type. This type currently is quite conservative
5+ //! and exposed no internal implementation details. Nightly compilers, however,
6+ //! contain a much richer interface. This richer interface allows fine-grained
7+ //! inspection of the token stream which avoids stringification/re-lexing and
8+ //! also preserves span information.
9+ //!
10+ //! The upcoming APIs added to `proc_macro` upstream are the foundation for
11+ //! productive procedural macros in the ecosystem. To help prepare the ecosystem
12+ //! for using them this crate serves to both compile on stable and nightly and
13+ //! mirrors the API-to-be. The intention is that procedural macros which switch
14+ //! to use this crate will be trivially able to switch to the upstream
15+ //! `proc_macro` crate once its API stabilizes.
16+ //!
17+ //! In the meantime this crate also has an `unstable` Cargo feature which
18+ //! enables it to reimplement itself with the unstable API of `proc_macro`.
19+ //! This'll allow immediate usage of the beneficial upstream API, particularly
20+ //! around preserving span information.
21+
122#![ cfg_attr( feature = "unstable" , feature( proc_macro) ) ]
223
324extern crate proc_macro;
You can’t perform that action at this time.
0 commit comments