@@ -66,133 +66,134 @@ pub mod rt {
66
66
67
67
pub trait ToSource {
68
68
// Takes a thing and generates a string containing rust code for it.
69
- fn to_source ( & self ) -> @ str ;
69
+ fn to_source ( & self ) -> ~ str ;
70
70
}
71
71
72
72
impl ToSource for ast:: Ident {
73
- fn to_source ( & self ) -> @str {
74
- ident_to_str ( self )
73
+ fn to_source ( & self ) -> ~str {
74
+ let this = get_ident ( self . name ) ;
75
+ this. get ( ) . to_owned ( )
75
76
}
76
77
}
77
78
78
79
impl ToSource for @ast:: Item {
79
- fn to_source ( & self ) -> @ str {
80
- pprust:: item_to_str ( * self , get_ident_interner ( ) ) . to_managed ( )
80
+ fn to_source ( & self ) -> ~ str {
81
+ pprust:: item_to_str ( * self , get_ident_interner ( ) )
81
82
}
82
83
}
83
84
84
85
impl < ' a > ToSource for & ' a [ @ast:: Item ] {
85
- fn to_source ( & self ) -> @ str {
86
- self . map ( |i| i. to_source ( ) ) . connect ( "\n \n " ) . to_managed ( )
86
+ fn to_source ( & self ) -> ~ str {
87
+ self . map ( |i| i. to_source ( ) ) . connect ( "\n \n " )
87
88
}
88
89
}
89
90
90
91
impl ToSource for ast:: Ty {
91
- fn to_source ( & self ) -> @ str {
92
- pprust:: ty_to_str ( self , get_ident_interner ( ) ) . to_managed ( )
92
+ fn to_source ( & self ) -> ~ str {
93
+ pprust:: ty_to_str ( self , get_ident_interner ( ) )
93
94
}
94
95
}
95
96
96
97
impl < ' a > ToSource for & ' a [ ast:: Ty ] {
97
- fn to_source ( & self ) -> @ str {
98
- self . map ( |i| i. to_source ( ) ) . connect ( ", " ) . to_managed ( )
98
+ fn to_source ( & self ) -> ~ str {
99
+ self . map ( |i| i. to_source ( ) ) . connect ( ", " )
99
100
}
100
101
}
101
102
102
103
impl ToSource for Generics {
103
- fn to_source ( & self ) -> @ str {
104
- pprust:: generics_to_str ( self , get_ident_interner ( ) ) . to_managed ( )
104
+ fn to_source ( & self ) -> ~ str {
105
+ pprust:: generics_to_str ( self , get_ident_interner ( ) )
105
106
}
106
107
}
107
108
108
109
impl ToSource for @ast:: Expr {
109
- fn to_source ( & self ) -> @ str {
110
- pprust:: expr_to_str ( * self , get_ident_interner ( ) ) . to_managed ( )
110
+ fn to_source ( & self ) -> ~ str {
111
+ pprust:: expr_to_str ( * self , get_ident_interner ( ) )
111
112
}
112
113
}
113
114
114
115
impl ToSource for ast:: Block {
115
- fn to_source ( & self ) -> @ str {
116
- pprust:: block_to_str ( self , get_ident_interner ( ) ) . to_managed ( )
116
+ fn to_source ( & self ) -> ~ str {
117
+ pprust:: block_to_str ( self , get_ident_interner ( ) )
117
118
}
118
119
}
119
120
120
121
impl < ' a > ToSource for & ' a str {
121
- fn to_source ( & self ) -> @ str {
122
+ fn to_source ( & self ) -> ~ str {
122
123
let lit = dummy_spanned ( ast:: LitStr (
123
124
token:: intern_and_get_ident ( * self ) , ast:: CookedStr ) ) ;
124
- pprust:: lit_to_str ( & lit) . to_managed ( )
125
+ pprust:: lit_to_str ( & lit)
125
126
}
126
127
}
127
128
128
129
impl ToSource for int {
129
- fn to_source ( & self ) -> @ str {
130
+ fn to_source ( & self ) -> ~ str {
130
131
let lit = dummy_spanned ( ast:: LitInt ( * self as i64 , ast:: TyI ) ) ;
131
- pprust:: lit_to_str ( & lit) . to_managed ( )
132
+ pprust:: lit_to_str ( & lit)
132
133
}
133
134
}
134
135
135
136
impl ToSource for i8 {
136
- fn to_source ( & self ) -> @ str {
137
+ fn to_source ( & self ) -> ~ str {
137
138
let lit = dummy_spanned ( ast:: LitInt ( * self as i64 , ast:: TyI8 ) ) ;
138
- pprust:: lit_to_str ( & lit) . to_managed ( )
139
+ pprust:: lit_to_str ( & lit)
139
140
}
140
141
}
141
142
142
143
impl ToSource for i16 {
143
- fn to_source ( & self ) -> @ str {
144
+ fn to_source ( & self ) -> ~ str {
144
145
let lit = dummy_spanned ( ast:: LitInt ( * self as i64 , ast:: TyI16 ) ) ;
145
- pprust:: lit_to_str ( & lit) . to_managed ( )
146
+ pprust:: lit_to_str ( & lit)
146
147
}
147
148
}
148
149
149
150
150
151
impl ToSource for i32 {
151
- fn to_source ( & self ) -> @ str {
152
+ fn to_source ( & self ) -> ~ str {
152
153
let lit = dummy_spanned ( ast:: LitInt ( * self as i64 , ast:: TyI32 ) ) ;
153
- pprust:: lit_to_str ( & lit) . to_managed ( )
154
+ pprust:: lit_to_str ( & lit)
154
155
}
155
156
}
156
157
157
158
impl ToSource for i64 {
158
- fn to_source ( & self ) -> @ str {
159
+ fn to_source ( & self ) -> ~ str {
159
160
let lit = dummy_spanned ( ast:: LitInt ( * self as i64 , ast:: TyI64 ) ) ;
160
- pprust:: lit_to_str ( & lit) . to_managed ( )
161
+ pprust:: lit_to_str ( & lit)
161
162
}
162
163
}
163
164
164
165
impl ToSource for uint {
165
- fn to_source ( & self ) -> @ str {
166
+ fn to_source ( & self ) -> ~ str {
166
167
let lit = dummy_spanned ( ast:: LitUint ( * self as u64 , ast:: TyU ) ) ;
167
- pprust:: lit_to_str ( & lit) . to_managed ( )
168
+ pprust:: lit_to_str ( & lit)
168
169
}
169
170
}
170
171
171
172
impl ToSource for u8 {
172
- fn to_source ( & self ) -> @ str {
173
+ fn to_source ( & self ) -> ~ str {
173
174
let lit = dummy_spanned ( ast:: LitUint ( * self as u64 , ast:: TyU8 ) ) ;
174
- pprust:: lit_to_str ( & lit) . to_managed ( )
175
+ pprust:: lit_to_str ( & lit)
175
176
}
176
177
}
177
178
178
179
impl ToSource for u16 {
179
- fn to_source ( & self ) -> @ str {
180
+ fn to_source ( & self ) -> ~ str {
180
181
let lit = dummy_spanned ( ast:: LitUint ( * self as u64 , ast:: TyU16 ) ) ;
181
- pprust:: lit_to_str ( & lit) . to_managed ( )
182
+ pprust:: lit_to_str ( & lit)
182
183
}
183
184
}
184
185
185
186
impl ToSource for u32 {
186
- fn to_source ( & self ) -> @ str {
187
+ fn to_source ( & self ) -> ~ str {
187
188
let lit = dummy_spanned ( ast:: LitUint ( * self as u64 , ast:: TyU32 ) ) ;
188
- pprust:: lit_to_str ( & lit) . to_managed ( )
189
+ pprust:: lit_to_str ( & lit)
189
190
}
190
191
}
191
192
192
193
impl ToSource for u64 {
193
- fn to_source ( & self ) -> @ str {
194
+ fn to_source ( & self ) -> ~ str {
194
195
let lit = dummy_spanned ( ast:: LitUint ( * self as u64 , ast:: TyU64 ) ) ;
195
- pprust:: lit_to_str ( & lit) . to_managed ( )
196
+ pprust:: lit_to_str ( & lit)
196
197
}
197
198
}
198
199
@@ -202,7 +203,7 @@ pub mod rt {
202
203
( $t: ty) => (
203
204
impl ToTokens for $t {
204
205
fn to_tokens( & self , cx: & ExtCtxt ) -> ~[ TokenTree ] {
205
- cx. parse_tts( self . to_source( ) )
206
+ cx. parse_tts( self . to_source( ) . to_managed ( ) )
206
207
}
207
208
}
208
209
)
@@ -212,7 +213,7 @@ pub mod rt {
212
213
( $t: ty) => (
213
214
impl <' a> ToTokens for $t {
214
215
fn to_tokens( & self , cx: & ExtCtxt ) -> ~[ TokenTree ] {
215
- cx. parse_tts( self . to_source( ) )
216
+ cx. parse_tts( self . to_source( ) . to_managed ( ) )
216
217
}
217
218
}
218
219
)
0 commit comments