1
Fork 0

Remove pretty-print/reparse hack, and add derive-specific hack

This commit is contained in:
Aaron Hill 2020-11-23 01:43:55 -05:00
parent 2987785df3
commit 530a629635
No known key found for this signature in database
GPG key ID: B4087E510E98B164
8 changed files with 186 additions and 410 deletions

View file

@ -3,7 +3,7 @@ use crate::proc_macro_server;
use rustc_ast::ptr::P;
use rustc_ast::token;
use rustc_ast::tokenstream::{TokenStream, TokenTree};
use rustc_ast::tokenstream::{CanSynthesizeMissingTokens, TokenStream, TokenTree};
use rustc_ast::{self as ast, *};
use rustc_data_structures::sync::Lrc;
use rustc_errors::{struct_span_err, Applicability, ErrorReported};
@ -94,7 +94,12 @@ impl MultiItemModifier for ProcMacroDerive {
let input = if item.pretty_printing_compatibility_hack() {
TokenTree::token(token::Interpolated(Lrc::new(item)), DUMMY_SP).into()
} else {
nt_to_tokenstream(&item, &ecx.sess.parse_sess, DUMMY_SP)
nt_to_tokenstream(
&item,
&ecx.sess.parse_sess,
DUMMY_SP,
CanSynthesizeMissingTokens::Yes,
)
};
let server = proc_macro_server::Rustc::new(ecx);