NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io, #10 most downloaded on crates.io
A substitute implementation of the compiler's `proc_macro` API to decouple token-based libraries from the procedural macro use case.
Latest stable
1.0.107
Last release 4 months ago
19 Jul 2026
Release timing varies
gaps range from 8 days to 6 months
Most releases are documented
notes for 53 of the last 60 stable releases
2 versions withdrawn
withdrawn after publishing
9 years old
163 releases · first in 2017
Drag across the ruler to compare, or tap a release to open it.
Fix integer overflow when nesting depth of nested comments exceeds 4 billion
Make proc_macro2::TokenStream's FromStr impl consistent with proc_macro::TokenStream's on strings that begin with a byte order mark \u{feff}
FromStr impl consistent with proc_macro::TokenStream's on strings that begin with a byte order mark \u{feff} (#353)Fix panic on parsing disallowed raw identifiers such as r#self
r#self (#351)Your coding agent can read these notes before it upgrades. Set up the MCP server →
Expose span.before() and span.after() to access an empty Span located immediately before or after the input span (#348, upstream tracking issue: https
span.before() and span.after() to access an empty Span located immediately before or after the input span (#348, upstream tracking issue: https://github.com/rust-lang/rust/issues/87552)Add keywords to crates.io metadata
Improve parsing performance in non-macro mode
Produce an accurate .size_hint() from TokenStream's iterator
.size_hint() from TokenStream's iterator (#334)Stabilize Ident::new_raw constructor (#331, thanks @mystor)
Ident::new_raw constructor (#331, thanks @mystor)Replace unicode-xid with unicode-ident crate: https://github.com/dtolnay/unicode-ident
Reduce allocations done by Literal::byte_string constructor
Literal::byte_string constructor (#328)Rely on unicode-xid to optimize ASCII properly
Improve performance of creating literal tokens through quote! macro
quote! macroTry to diagnose "cannot find type SourceFile" errors better
Work around doc build failure due to docs.rs flags change
Enable Group::span_open/span_close on Rust 1.55+ to reflect their stabilization in rustc (#305, https://github.com/rust-lang/rust/pull/86136)
Group::span_open/span_close on Rust 1.55+ to reflect their stabilization in rustc (#305, https://github.com/rust-lang/rust/pull/86136)Support negative int and float literals in FromStr
Update Cargo metadata to new repository location
Use proc_macro::is_available on Rust 1.57+ to support projects built with panic=abort or cg_clif (#300, thanks @bjorn3)
Pick up stable implementation of proc_macro's impl FromStr for Literal
impl FromStr for Literal (#287)Recognized Cargo's new CARGO_ENCODED_RUSTFLAGS environment variable (#294, https://github.com/rust-lang/cargo/pull/9601)
impl FromStr for Literal (#286, https://github.com/rust-lang/rust/pull/84717)
impl FromStr for Literal (#286, https://github.com/rust-lang/rust/pull/84717)Add impl LexError { pub fn span(&self) -> Span }
impl LexError { pub fn span(&self) -> Span } (#283)Documentation improvements (#278, #279)
Implement Error and Display for proc_macro2::LexError, matching the libproc_macro impls which exists in Rust 1.44+
Fix several bugs involving lexing of unicode escapes and carriage returns in string literals (#256, #257, #258, #259, #260)
Fix several bugs involving lexing of integer and float tokens with unusual suffixes (#252, #253, #254, #255)
Match libproc_macro's UnwindSafe and RefUnwindSafe impls
Match libproc_macro's rendering of whitespace in groups (#246, #247, thanks @Koxiaet)
Remove procmacro2_semver_exempt feature gate on all methods stabilized in Rust 1.45
Fix discrepancy with libproc_macro in handling of negative numbers in token streams
Allow using proc_macro2::force() from 1.0.12 at the same time as proc-macro2 = { default-features = false }
proc_macro2::fallback::force() from 1.0.12 at the same time as proc-macro2 = { default-features = false } (#233)impl Ord for proc_macro2::LineColumn (#230, https://github.com/rust-lang/rust/pull/72446)
Support parsing arbitrarily deeply nested token streams without using excessive stack space (#231, #232)
Add Span::mixed_site(), which is behind cfg(procmacro2_semver_exempt) for now but will be stabilized when Rust 1.45 is released (#228, thanks @kevinme
cfg(procmacro2_semver_exempt) for now but will be stabilized when Rust 1.45 is released (#228, thanks @kevinmehall)Parse literal suffix on byte string, byte, and char literal tokens: br#"..."#suffix, b'?'suffix, '?'suffix
br#"..."#suffix, b'?'suffix, '?'suffixAdd a way to force avoid using the compiler's libproc_macro implementation even when available
Nothing published for this version
Enable span-locations feature when building for play.rust-lang.org
Match the escaping behavior of libproc_macro when displaying non-ascii strings and characters
Work around https://github.com/rust-lang/rust/issues/58736 which caused panics in TokenStream::from_str
Return meaningful spans from Group::span_open and Group::span_close when running with span-locations feature enabled outside of a procedural macro
Just retriggering a docs.rs build because 1.0.5 failed. See https://github.com/alexcrichton/proc-macro2/issues/203 and https://github.com/rust-lang/do
Just retriggering a docs.rs build because 1.0.5 failed. See https://github.com/alexcrichton/proc-macro2/issues/203 and https://github.com/rust-lang/docs.rs/issues/440.
Improve performance of impl Extend for TokenStream
impl Extend<TokenTree> for TokenStream (#198)Add Literal::subspan method to match libproc_macro
Literal::subspan method to match libproc_macro (#195)Treat dev builds of rustc the same as a nightly, with unstable features available
Add impl From for TokenStream to match libproc_macro
impl From<TokenTree> for TokenStream to match libproc_macroFail with a better error message when being built on a compiler that is too old
Deprecated TokenStream::empty constructor has been removed in favor of TokenStream::new
TokenStream::empty constructor has been removed in favor of TokenStream::newImplement Clone for TokenStream's IntoIter (#177, thanks @ivanbakel)
Support compiling with RUSTFLAGS='-Z allow-features=' on a nightly compiler (#176, thanks @Nemo157)
RUSTFLAGS='-Z allow-features=' on a nightly compiler (#176, thanks @Nemo157)Avoid needlessly escaping ' inside a string literal or " inside a character literal
' inside a string literal or " inside a character literal (#60)Add Cargo cfg "span-locations" to expose `Span::start` and `Span::end` accessors that give the line and column location of a Span
Add Cargo cfg "span-locations" to expose Span::start and Span::end accessors that give the line and column location of a Span (#166)
Be aware that this involves storing more information than before inside of Spans which increases their size -- leading to possibly slower performance of any code involving proc-macro2 types (but only when the cfg is enabled).
Update documentation to 2018 edition
span.unstable() method to span.unwrap(); this method is usable from a stable compiler but panics if called from outside of a procedural macroDisable stable shim when building with procmacro2_semver_exempt on a nightly compiler
Remove semver exempt type proc_macro2::FileName in favor of PathBuf
proc_macro2::FileName in favor of PathBuf (https://github.com/rust-lang/rust/commit/e5e29d1a1976ff7d0b39ade8706ca0e3ddebe7a9)Send and Sync impls of semver exempt type SourceFile (#141)Work around compilation failures in docs.rs when proc-macro2 is used as a dependency
Attempt to work around documentation not appearing on docs.rs
Add support for constructing 128 bit Literal integers
Literal integers (#144)Provide unstable Group::span_open and span_close accessors to mirror the API in nightly
Group::span_open and span_close accessors to mirror the API in nightly (#134)- FromIterator\ for TokenStream
One column per quarter.