Skip to content

Commit a9e1d5a

Browse files
pcwaltonhuonw
authored andcommitted
---
yaml --- r: 102521 b: refs/heads/auto c: a0646ae h: refs/heads/master i: 102519: f821ac5 v: v3
1 parent 3a18abe commit a9e1d5a

File tree

2 files changed

+43
-42
lines changed

2 files changed

+43
-42
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 8e52b85d5a6f6e3aaa2f15d7c1e907d0ce8589ee
16+
refs/heads/auto: a0646ae3a496819fe69eec3ee74f4422c0619218
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/libsyntax/ext/quote.rs

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -66,133 +66,134 @@ pub mod rt {
6666

6767
pub trait ToSource {
6868
// Takes a thing and generates a string containing rust code for it.
69-
fn to_source(&self) -> @str;
69+
fn to_source(&self) -> ~str;
7070
}
7171

7272
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()
7576
}
7677
}
7778

7879
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())
8182
}
8283
}
8384

8485
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")
8788
}
8889
}
8990

9091
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())
9394
}
9495
}
9596

9697
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(", ")
99100
}
100101
}
101102

102103
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())
105106
}
106107
}
107108

108109
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())
111112
}
112113
}
113114

114115
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())
117118
}
118119
}
119120

120121
impl<'a> ToSource for &'a str {
121-
fn to_source(&self) -> @str {
122+
fn to_source(&self) -> ~str {
122123
let lit = dummy_spanned(ast::LitStr(
123124
token::intern_and_get_ident(*self), ast::CookedStr));
124-
pprust::lit_to_str(&lit).to_managed()
125+
pprust::lit_to_str(&lit)
125126
}
126127
}
127128

128129
impl ToSource for int {
129-
fn to_source(&self) -> @str {
130+
fn to_source(&self) -> ~str {
130131
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)
132133
}
133134
}
134135

135136
impl ToSource for i8 {
136-
fn to_source(&self) -> @str {
137+
fn to_source(&self) -> ~str {
137138
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)
139140
}
140141
}
141142

142143
impl ToSource for i16 {
143-
fn to_source(&self) -> @str {
144+
fn to_source(&self) -> ~str {
144145
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)
146147
}
147148
}
148149

149150

150151
impl ToSource for i32 {
151-
fn to_source(&self) -> @str {
152+
fn to_source(&self) -> ~str {
152153
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)
154155
}
155156
}
156157

157158
impl ToSource for i64 {
158-
fn to_source(&self) -> @str {
159+
fn to_source(&self) -> ~str {
159160
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)
161162
}
162163
}
163164

164165
impl ToSource for uint {
165-
fn to_source(&self) -> @str {
166+
fn to_source(&self) -> ~str {
166167
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)
168169
}
169170
}
170171

171172
impl ToSource for u8 {
172-
fn to_source(&self) -> @str {
173+
fn to_source(&self) -> ~str {
173174
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)
175176
}
176177
}
177178

178179
impl ToSource for u16 {
179-
fn to_source(&self) -> @str {
180+
fn to_source(&self) -> ~str {
180181
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)
182183
}
183184
}
184185

185186
impl ToSource for u32 {
186-
fn to_source(&self) -> @str {
187+
fn to_source(&self) -> ~str {
187188
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)
189190
}
190191
}
191192

192193
impl ToSource for u64 {
193-
fn to_source(&self) -> @str {
194+
fn to_source(&self) -> ~str {
194195
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)
196197
}
197198
}
198199

@@ -202,7 +203,7 @@ pub mod rt {
202203
($t:ty) => (
203204
impl ToTokens for $t {
204205
fn to_tokens(&self, cx: &ExtCtxt) -> ~[TokenTree] {
205-
cx.parse_tts(self.to_source())
206+
cx.parse_tts(self.to_source().to_managed())
206207
}
207208
}
208209
)
@@ -212,7 +213,7 @@ pub mod rt {
212213
($t:ty) => (
213214
impl<'a> ToTokens for $t {
214215
fn to_tokens(&self, cx: &ExtCtxt) -> ~[TokenTree] {
215-
cx.parse_tts(self.to_source())
216+
cx.parse_tts(self.to_source().to_managed())
216217
}
217218
}
218219
)

0 commit comments

Comments
 (0)