Skip to content

Commit c99fd5c

Browse files
committed
Re-enable usage of saved tokens
1 parent 542e2f5 commit c99fd5c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/librustc_ast/token.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ impl PartialEq<TokenKind> for Token {
728728
}
729729
}
730730

731-
#[derive(Clone, RustcEncodable, RustcDecodable)]
731+
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
732732
/// For interpolation during macro expansion.
733733
pub enum Nonterminal {
734734
NtItem(P<ast::Item>),
@@ -786,7 +786,7 @@ impl PartialEq for Nonterminal {
786786
}
787787
}
788788

789-
impl fmt::Debug for Nonterminal {
789+
/*impl fmt::Debug for Nonterminal {
790790
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
791791
match *self {
792792
NtItem(..) => f.pad("NtItem(..)"),
@@ -804,7 +804,7 @@ impl fmt::Debug for Nonterminal {
804804
NtLifetime(..) => f.pad("NtLifetime(..)"),
805805
}
806806
}
807-
}
807+
}*/
808808

809809
impl<CTX> HashStable<CTX> for Nonterminal
810810
where

src/librustc_parse/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,12 @@ pub fn nt_to_tokenstream(nt: &Nonterminal, sess: &ParseSess, span: Span) -> Toke
321321
Some(tokenstream::TokenTree::token(token::Lifetime(ident.name), ident.span).into())
322322
}
323323
Nonterminal::NtTT(ref tt) => Some(tt.clone().into()),
324-
_ => None
325-
/*Nonterminal::NtLiteral(ref expr) | Nonterminal::NtExpr(ref expr) => expr.tokens.clone(),
324+
Nonterminal::NtLiteral(ref expr) | Nonterminal::NtExpr(ref expr) => expr.tokens.clone(),
326325
Nonterminal::NtTy(ref ty) => ty.tokens.clone(),
327326
Nonterminal::NtBlock(ref block) => block.tokens.clone(),
328327
Nonterminal::NtPat(ref pat) => pat.tokens.clone(),
329328
Nonterminal::NtStmt(ref stmt) => stmt.tokens.clone(),
330-
Nonterminal::NtMeta(_) | Nonterminal::NtPath(_) | Nonterminal::NtVis(_) => None,*/
329+
Nonterminal::NtMeta(_) | Nonterminal::NtPath(_) | Nonterminal::NtVis(_) => None,
331330
};
332331

333332
// FIXME(#43081): Avoid this pretty-print + reparse hack
@@ -367,6 +366,7 @@ pub fn nt_to_tokenstream(nt: &Nonterminal, sess: &ParseSess, span: Span) -> Toke
367366
going with stringified version"
368367
);
369368
}
369+
info!("nt_to_tokenstream: no tokens found at {:?} for {:?}", span, nt);
370370
return tokens_for_real;
371371
}
372372

0 commit comments

Comments
 (0)