Skip to content

Commit 563dc51

Browse files
committed
Auto merge of #45791 - eddyb:quote-unquote, r=jseyfried
Prefer libproc_macro APIs to libsyntax ones in the quasi-quoter. The shift to using `proc_macro`'s own APIs in `proc_macro::quote`, both in the implementation of the quasi-quoter and the Rust code it generates to build `TokenStream`s at runtime, greatly reduces the dependency on `libsyntax`, with the generated runtime code being completely free of it. This is a prerequirement for introducing more abstraction/indirection between `proc_macro` and compiler implementation details (mainly those from `libsyntax`), which I want to attempt. cc @alexcrichton @jseyfried @nrc
2 parents 968b620 + fbcc673 commit 563dc51

File tree

2 files changed

+158
-156
lines changed

2 files changed

+158
-156
lines changed

src/libproc_macro/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ impl Default for Span {
191191
/// This is needed to implement a custom quoter.
192192
#[unstable(feature = "proc_macro", issue = "38356")]
193193
pub fn quote_span(span: Span) -> TokenStream {
194-
TokenStream(quote::Quote::quote(&span.0))
194+
quote::Quote::quote(span)
195195
}
196196

197197
macro_rules! diagnostic_method {
@@ -728,7 +728,7 @@ impl TokenTree {
728728
#[unstable(feature = "proc_macro_internals", issue = "27812")]
729729
#[doc(hidden)]
730730
pub mod __internal {
731-
pub use quote::{Quoter, __rt};
731+
pub use quote::{LiteralKind, Quoter, unquote};
732732

733733
use std::cell::Cell;
734734

0 commit comments

Comments
 (0)