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 {
125
125
}
126
126
}
127
127
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
+
128
148
impl ToSource for int {
129
149
fn to_source ( & self ) -> ~str {
130
150
let lit = dummy_spanned ( ast:: LitInt ( * self as i64 , ast:: TyI ) ) ;
@@ -227,6 +247,9 @@ pub mod rt {
227
247
impl_to_tokens ! ( @ast:: Expr )
228
248
impl_to_tokens ! ( ast:: Block )
229
249
impl_to_tokens_self ! ( & ' a str )
250
+ impl_to_tokens ! ( ( ) )
251
+ impl_to_tokens ! ( char )
252
+ impl_to_tokens ! ( bool )
230
253
impl_to_tokens ! ( int)
231
254
impl_to_tokens ! ( i8 )
232
255
impl_to_tokens ! ( i16 )
Original file line number Diff line number Diff line change @@ -26,6 +26,10 @@ fn syntax_extension(cx: &ExtCtxt) {
26
26
let _c: @syntax:: ast:: Pat = quote_pat ! ( cx, ( x, 1 .. 4 , * ) ) ;
27
27
let _d: @syntax:: ast:: Stmt = quote_stmt ! ( cx, let x = $a; ) ;
28
28
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' ) ;
29
33
}
30
34
31
35
fn main ( ) {
You can’t perform that action at this time.
0 commit comments