File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,26 @@ pub mod rt {
125125 }
126126 }
127127
128+ impl ToSource for ( ) {
129+ fn to_source ( & self ) -> ~str {
130+ "()" . to_owned ( )
131+ }
132+ }
133+
134+ impl ToSource for bool {
135+ fn to_source ( & self ) -> ~str {
136+ let lit = dummy_spanned ( ast:: LitBool ( * self ) ) ;
137+ pprust:: lit_to_str ( & lit)
138+ }
139+ }
140+
141+ impl ToSource for char {
142+ fn to_source ( & self ) -> ~str {
143+ let lit = dummy_spanned ( ast:: LitChar ( * self ) ) ;
144+ pprust:: lit_to_str ( & lit)
145+ }
146+ }
147+
128148 impl ToSource for int {
129149 fn to_source ( & self ) -> ~str {
130150 let lit = dummy_spanned ( ast:: LitInt ( * self as i64 , ast:: TyI ) ) ;
@@ -227,6 +247,9 @@ pub mod rt {
227247 impl_to_tokens ! ( @ast:: Expr )
228248 impl_to_tokens ! ( ast:: Block )
229249 impl_to_tokens_self ! ( & ' a str )
250+ impl_to_tokens ! ( ( ) )
251+ impl_to_tokens ! ( char )
252+ impl_to_tokens ! ( bool )
230253 impl_to_tokens ! ( int)
231254 impl_to_tokens ! ( i8 )
232255 impl_to_tokens ! ( i16 )
Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ fn syntax_extension(cx: &ExtCtxt) {
2626 let _c: @syntax:: ast:: Pat = quote_pat ! ( cx, ( x, 1 .. 4 , * ) ) ;
2727 let _d: @syntax:: ast:: Stmt = quote_stmt ! ( cx, let x = $a; ) ;
2828 let _e: @syntax:: ast:: Expr = quote_expr ! ( cx, match foo { $p_toks => 10 } ) ;
29+
30+ let _f: @syntax:: ast:: Expr = quote_expr ! ( cx, ( ) ) ;
31+ let _g: @syntax:: ast:: Expr = quote_expr ! ( cx, true ) ;
32+ let _h: @syntax:: ast:: Expr = quote_expr ! ( cx, 'a' ) ;
2933}
3034
3135fn main ( ) {
You can’t perform that action at this time.
0 commit comments