From 20df4ccafe4d3eb588fa309f06d41aa6b5b1d526 Mon Sep 17 00:00:00 2001 From: Piotr Jawniak Date: Sat, 19 Jul 2014 11:59:44 +0200 Subject: Correctly stringify! types and paths inside macros Closes #8709 --- src/libsyntax/parse/token.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/libsyntax/parse') diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 5839df67022..f1ef7980151 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -249,6 +249,8 @@ pub fn to_string(t: &Token) -> String { match nt { &NtExpr(ref e) => ::print::pprust::expr_to_string(&**e), &NtMeta(ref e) => ::print::pprust::meta_item_to_string(&**e), + &NtTy(ref e) => ::print::pprust::ty_to_string(&**e), + &NtPath(ref e) => ::print::pprust::path_to_string(&**e), _ => { let mut s = "an interpolated ".to_string(); match *nt { @@ -257,10 +259,10 @@ pub fn to_string(t: &Token) -> String { NtStmt(..) => s.push_str("statement"), NtPat(..) => s.push_str("pattern"), NtMeta(..) => fail!("should have been handled"), - NtExpr(..) => fail!("should have been handled above"), - NtTy(..) => s.push_str("type"), + NtExpr(..) => fail!("should have been handled"), + NtTy(..) => fail!("should have been handled"), NtIdent(..) => s.push_str("identifier"), - NtPath(..) => s.push_str("path"), + NtPath(..) => fail!("should have been handled"), NtTT(..) => s.push_str("tt"), NtMatchers(..) => s.push_str("matcher sequence") }; -- cgit 1.4.1-3-g733a5