@@ -4,7 +4,7 @@ use syntax::source_map::{SourceMap, Spanned};
4
4
use syntax:: parse:: ParseSess ;
5
5
use syntax:: print:: pp:: { self , Breaks } ;
6
6
use syntax:: print:: pp:: Breaks :: { Consistent , Inconsistent } ;
7
- use syntax:: print:: pprust:: { Comments , PrintState } ;
7
+ use syntax:: print:: pprust:: { self , Comments , PrintState } ;
8
8
use syntax:: symbol:: kw;
9
9
use syntax:: util:: parser:: { self , AssocOp , Fixity } ;
10
10
use syntax_pos:: { self , BytePos , FileName } ;
@@ -90,6 +90,15 @@ impl<'a> PrintState<'a> for State<'a> {
90
90
fn comments ( & mut self ) -> & mut Option < Comments < ' a > > {
91
91
& mut self . comments
92
92
}
93
+
94
+ fn print_ident ( & mut self , ident : ast:: Ident ) {
95
+ self . s . word ( pprust:: ast_ident_to_string ( ident, ident. is_raw_guess ( ) ) ) ;
96
+ self . ann . post ( self , AnnNode :: Name ( & ident. name ) )
97
+ }
98
+
99
+ fn print_generic_args ( & mut self , args : & ast:: GenericArgs , _colons_before_params : bool ) {
100
+ span_bug ! ( args. span( ) , "AST generic args printed by HIR pretty-printer" ) ;
101
+ }
93
102
}
94
103
95
104
pub const INDENT_UNIT : usize = 4 ;
@@ -1442,15 +1451,6 @@ impl<'a> State<'a> {
1442
1451
self . s . word ( i. to_string ( ) )
1443
1452
}
1444
1453
1445
- pub fn print_ident ( & mut self , ident : ast:: Ident ) {
1446
- if ident. is_raw_guess ( ) {
1447
- self . s . word ( format ! ( "r#{}" , ident. name) ) ;
1448
- } else {
1449
- self . s . word ( ident. as_str ( ) . to_string ( ) ) ;
1450
- }
1451
- self . ann . post ( self , AnnNode :: Name ( & ident. name ) )
1452
- }
1453
-
1454
1454
pub fn print_name ( & mut self , name : ast:: Name ) {
1455
1455
self . print_ident ( ast:: Ident :: with_empty_ctxt ( name) )
1456
1456
}
0 commit comments