Skip to content

Commit babc99e

Browse files
committed
Crate docs
1 parent 040be63 commit babc99e

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/lib.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
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

324
extern crate proc_macro;

0 commit comments

Comments
 (0)