Skip to content

Commit 5f34d4e

Browse files
committed
---
yaml --- r: 4982 b: refs/heads/master c: fcc031c h: refs/heads/master v: v3
1 parent 6aad0cf commit 5f34d4e

24 files changed

+204
-161
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 20178b9312675f4889bd656916a1f32cbacc94d6
2+
refs/heads/master: fcc031c5b4dc8f64c497b8dd1e066068e862bd72

trunk/src/comp/driver/rustc.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ fn parse_input_src(sess: session::session, cfg: &ast::crate_cfg, infile: str)
100100
-> {crate: @ast::crate, src: str} {
101101
let srcbytes =
102102
if infile != "-" {
103-
io::file_reader(infile)
103+
io::file_reader(istr::from_estr(infile))
104104
} else { io::stdin() }.read_whole_stream();
105105
let src = str::unsafe_from_bytes(srcbytes);
106106
let crate =
@@ -238,18 +238,21 @@ fn pretty_print_input(sess: session::session, cfg: ast::crate_cfg, input: str,
238238
ppm_normal. { ann = pprust::no_ann(); }
239239
}
240240
pprust::print_crate(sess.get_codemap(), crate, input,
241-
io::string_reader(src), io::stdout(), ann);
241+
io::string_reader(istr::from_estr(src)),
242+
io::stdout(), ann);
242243
}
243244
244245
fn version(argv0: str) {
245246
let vers = "unknown version";
246247
let env_vers = #env["CFG_VERSION"];
247248
if str::byte_len(env_vers) != 0u { vers = env_vers; }
248-
io::stdout().write_str(#fmt["%s %s\n", argv0, vers]);
249+
io::stdout().write_str(
250+
istr::from_estr(#fmt["%s %s\n", argv0, vers]));
249251
}
250252

251253
fn usage(argv0: str) {
252-
io::stdout().write_str(#fmt["usage: %s [options] <input>\n", argv0] +
254+
io::stdout().write_str(istr::from_estr(
255+
#fmt["usage: %s [options] <input>\n", argv0] +
253256
"
254257
options:
255258
@@ -283,7 +286,7 @@ options:
283286
--test build test harness
284287
--gc garbage collect shared data (experimental/temporary)
285288
286-
");
289+
"));
287290
}
288291

289292
fn get_os(triple: str) -> session::os {

trunk/src/comp/metadata/creader.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ fn list_file_metadata(path: str, out: io::writer) {
8686
alt get_metadata_section(path) {
8787
option::some(bytes) { decoder::list_crate_metadata(bytes, out); }
8888
option::none. {
89-
out.write_str("Could not find metadata in " + path + ".\n");
89+
out.write_str(
90+
istr::from_estr("Could not find metadata in " + path + ".\n"));
9091
}
9192
}
9293
}

trunk/src/comp/metadata/decoder.rs

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import std::ebml;
44
import std::vec;
55
import std::option;
66
import std::str;
7+
import std::istr;
78
import std::io;
89
import std::map::hashmap;
910
import syntax::ast;
@@ -346,18 +347,20 @@ fn get_attributes(md: &ebml::doc) -> [ast::attribute] {
346347

347348
fn list_meta_items(meta_items: &ebml::doc, out: io::writer) {
348349
for mi: @ast::meta_item in get_meta_items(meta_items) {
349-
out.write_str(#fmt["%s\n", pprust::meta_item_to_str(*mi)]);
350+
out.write_str(
351+
istr::from_estr(#fmt["%s\n", pprust::meta_item_to_str(*mi)]));
350352
}
351353
}
352354

353355
fn list_crate_attributes(md: &ebml::doc, out: io::writer) {
354-
out.write_str("=Crate Attributes=\n");
356+
out.write_str(~"=Crate Attributes=\n");
355357

356358
for attr: ast::attribute in get_attributes(md) {
357-
out.write_str(#fmt["%s\n", pprust::attribute_to_str(attr)]);
359+
out.write_str(
360+
istr::from_estr(#fmt["%s\n", pprust::attribute_to_str(attr)]));
358361
}
359362

360-
out.write_str("\n\n");
363+
out.write_str(~"\n\n");
361364
}
362365

363366
fn get_crate_attributes(data: @[u8]) -> [ast::attribute] {
@@ -380,17 +383,18 @@ fn get_crate_deps(data: @[u8]) -> [crate_dep] {
380383
}
381384

382385
fn list_crate_deps(data: @[u8], out: io::writer) {
383-
out.write_str("=External Dependencies=\n");
386+
out.write_str(~"=External Dependencies=\n");
384387

385388
for dep: crate_dep in get_crate_deps(data) {
386-
out.write_str(#fmt["%d %s\n", dep.cnum, dep.ident]);
389+
out.write_str(
390+
istr::from_estr(#fmt["%d %s\n", dep.cnum, dep.ident]));
387391
}
388392

389-
out.write_str("\n");
393+
out.write_str(~"\n");
390394
}
391395

392396
fn list_crate_items(bytes: &@[u8], md: &ebml::doc, out: io::writer) {
393-
out.write_str("=Items=\n");
397+
out.write_str(~"=Items=\n");
394398
let paths = ebml::get_doc(md, tag_paths);
395399
let items = ebml::get_doc(md, tag_items);
396400
let index = ebml::get_doc(paths, tag_index);
@@ -403,11 +407,12 @@ fn list_crate_items(bytes: &@[u8], md: &ebml::doc, out: io::writer) {
403407
let def = ebml::doc_at(bytes, data.pos);
404408
let did_doc = ebml::get_doc(def, tag_def_id);
405409
let did = parse_def_id(ebml::doc_data(did_doc));
406-
out.write_str(#fmt["%s (%s)\n", data.path,
407-
describe_def(items, did)]);
410+
out.write_str(
411+
istr::from_estr(#fmt["%s (%s)\n", data.path,
412+
describe_def(items, did)]));
408413
}
409414
}
410-
out.write_str("\n");
415+
out.write_str(~"\n");
411416
}
412417

413418
fn list_crate_metadata(bytes: &@[u8], out: io::writer) {

trunk/src/comp/metadata/encoder.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import std::vec;
44
import std::str;
5+
import std::istr;
56
import std::uint;
67
import std::io;
78
import std::option;
@@ -435,7 +436,9 @@ fn encode_index<T>(ebml_w: &ebml::writer, buckets: &[@[entry<T>]],
435436
ebml::end_tag(ebml_w);
436437
}
437438

438-
fn write_str(writer: &io::writer, s: &str) { writer.write_str(s); }
439+
fn write_str(writer: &io::writer, s: &str) {
440+
writer.write_str(istr::from_estr(s));
441+
}
439442

440443
fn write_int(writer: &io::writer, n: &int) {
441444
writer.write_be_uint(n as uint, 4u);
@@ -616,15 +619,15 @@ fn encode_metadata(cx: &@crate_ctxt, crate: &@crate) -> str {
616619
// remaining % 4 bytes.
617620

618621
buf_w.write([0u8, 0u8, 0u8, 0u8]);
619-
ret string_w.get_str();
622+
ret istr::to_estr(string_w.get_str());
620623
}
621624

622625
// Get the encoded string for a type
623626
fn encoded_ty(tcx: &ty::ctxt, t: ty::t) -> str {
624627
let cx = @{ds: def_to_str, tcx: tcx, abbrevs: tyencode::ac_no_abbrevs};
625628
let sw = io::string_writer();
626629
tyencode::enc_ty(sw.get_writer(), cx, t);
627-
ret sw.get_str();
630+
ret istr::to_estr(sw.get_str());
628631
}
629632

630633

trunk/src/comp/metadata/tyencode.rs

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ fn enc_ty(w: &io::writer, cx: &@ctxt, t: ty::t) {
4646
none. {
4747
let sw = io::string_writer();
4848
enc_sty(sw.get_writer(), cx, ty::struct(cx.tcx, t));
49-
result_str = sw.get_str();
49+
result_str = istr::to_estr(sw.get_str());
5050
cx.tcx.short_names_cache.insert(t, result_str);
5151
}
5252
}
53-
w.write_str(result_str);
53+
w.write_str(istr::from_estr(result_str));
5454
}
5555
ac_use_abbrevs(abbrevs) {
5656
alt abbrevs.find(t) {
57-
some(a) { w.write_str(a.s); ret; }
57+
some(a) { w.write_str(istr::from_estr(a.s)); ret; }
5858
none. {
5959
let pos = w.get_buf_writer().tell();
6060
enc_sty(w, cx, ty::struct(cx.tcx, t));
@@ -100,30 +100,30 @@ fn enc_sty(w: &io::writer, cx: &@ctxt, st: &ty::sty) {
100100
ty::ty_float. { w.write_char('l'); }
101101
ty::ty_machine(mach) {
102102
alt mach {
103-
ty_u8. { w.write_str("Mb"); }
104-
ty_u16. { w.write_str("Mw"); }
105-
ty_u32. { w.write_str("Ml"); }
106-
ty_u64. { w.write_str("Md"); }
107-
ty_i8. { w.write_str("MB"); }
108-
ty_i16. { w.write_str("MW"); }
109-
ty_i32. { w.write_str("ML"); }
110-
ty_i64. { w.write_str("MD"); }
111-
ty_f32. { w.write_str("Mf"); }
112-
ty_f64. { w.write_str("MF"); }
103+
ty_u8. { w.write_str(~"Mb"); }
104+
ty_u16. { w.write_str(~"Mw"); }
105+
ty_u32. { w.write_str(~"Ml"); }
106+
ty_u64. { w.write_str(~"Md"); }
107+
ty_i8. { w.write_str(~"MB"); }
108+
ty_i16. { w.write_str(~"MW"); }
109+
ty_i32. { w.write_str(~"ML"); }
110+
ty_i64. { w.write_str(~"MD"); }
111+
ty_f32. { w.write_str(~"Mf"); }
112+
ty_f64. { w.write_str(~"MF"); }
113113
}
114114
}
115115
ty::ty_char. { w.write_char('c'); }
116116
ty::ty_str. { w.write_char('s'); }
117117
ty::ty_istr. { w.write_char('S'); }
118118
ty::ty_tag(def, tys) {
119-
w.write_str("t[");
120-
w.write_str(cx.ds(def));
119+
w.write_str(~"t[");
120+
w.write_str(istr::from_estr(cx.ds(def)));
121121
w.write_char('|');
122122
for t: ty::t in tys { enc_ty(w, cx, t); }
123123
w.write_char(']');
124124
}
125125
ty::ty_tup(ts) {
126-
w.write_str("T[");
126+
w.write_str(~"T[");
127127
for t in ts { enc_ty(w, cx, t); }
128128
w.write_char(']');
129129
}
@@ -132,9 +132,9 @@ fn enc_sty(w: &io::writer, cx: &@ctxt, st: &ty::sty) {
132132
ty::ty_ptr(mt) { w.write_char('*'); enc_mt(w, cx, mt); }
133133
ty::ty_vec(mt) { w.write_char('I'); enc_mt(w, cx, mt); }
134134
ty::ty_rec(fields) {
135-
w.write_str("R[");
135+
w.write_str(~"R[");
136136
for field: ty::field in fields {
137-
w.write_str(field.ident);
137+
w.write_str(istr::from_estr(field.ident));
138138
w.write_char('=');
139139
enc_mt(w, cx, field.mt);
140140
}
@@ -156,42 +156,42 @@ fn enc_sty(w: &io::writer, cx: &@ctxt, st: &ty::sty) {
156156
enc_ty_fn(w, cx, args, out, return, []);
157157
}
158158
ty::ty_obj(methods) {
159-
w.write_str("O[");
159+
w.write_str(~"O[");
160160
for m: ty::method in methods {
161161
enc_proto(w, m.proto);
162-
w.write_str(m.ident);
162+
w.write_str(istr::from_estr(m.ident));
163163
enc_ty_fn(w, cx, m.inputs, m.output, m.cf, m.constrs);
164164
}
165165
w.write_char(']');
166166
}
167167
ty::ty_res(def, ty, tps) {
168-
w.write_str("r[");
169-
w.write_str(cx.ds(def));
168+
w.write_str(~"r[");
169+
w.write_str(istr::from_estr(cx.ds(def)));
170170
w.write_char('|');
171171
enc_ty(w, cx, ty);
172172
for t: ty::t in tps { enc_ty(w, cx, t); }
173173
w.write_char(']');
174174
}
175175
ty::ty_var(id) {
176176
w.write_char('X');
177-
w.write_str(istr::to_estr(int::str(id)));
177+
w.write_str(int::str(id));
178178
}
179179
ty::ty_native(def) {
180180
w.write_char('E');
181-
w.write_str(cx.ds(def));
181+
w.write_str(istr::from_estr(cx.ds(def)));
182182
w.write_char('|');
183183
}
184184
ty::ty_param(id, k) {
185185
alt k {
186-
kind_unique. { w.write_str("pu"); }
187-
kind_shared. { w.write_str("ps"); }
188-
kind_pinned. { w.write_str("pp"); }
186+
kind_unique. { w.write_str(~"pu"); }
187+
kind_shared. { w.write_str(~"ps"); }
188+
kind_pinned. { w.write_str(~"pp"); }
189189
}
190-
w.write_str(istr::to_estr(uint::str(id)));
190+
w.write_str(uint::str(id));
191191
}
192192
ty::ty_type. { w.write_char('Y'); }
193193
ty::ty_constr(ty, cs) {
194-
w.write_str("A[");
194+
w.write_str(~"A[");
195195
enc_ty(w, cx, ty);
196196
for tc: @ty::type_constr in cs { enc_ty_constr(w, cx, tc); }
197197
w.write_char(']');
@@ -235,34 +235,38 @@ fn enc_ty_fn(w: &io::writer, cx: &@ctxt, args: &[ty::arg], out: ty::t,
235235
236236
// FIXME less copy-and-paste
237237
fn enc_constr(w: &io::writer, cx: &@ctxt, c: &@ty::constr) {
238-
w.write_str(path_to_str(c.node.path));
238+
w.write_str(istr::from_estr(path_to_str(c.node.path)));
239239
w.write_char('(');
240-
w.write_str(cx.ds(c.node.id));
240+
w.write_str(istr::from_estr(cx.ds(c.node.id)));
241241
w.write_char('|');
242242
let semi = false;
243243
for a: @constr_arg in c.node.args {
244244
if semi { w.write_char(';'); } else { semi = true; }
245245
alt a.node {
246246
carg_base. { w.write_char('*'); }
247247
carg_ident(i) { w.write_uint(i); }
248-
carg_lit(l) { w.write_str(lit_to_str(l)); }
248+
carg_lit(l) {
249+
w.write_str(istr::from_estr(lit_to_str(l)));
250+
}
249251
}
250252
}
251253
w.write_char(')');
252254
}
253255
254256
fn enc_ty_constr(w: &io::writer, cx: &@ctxt, c: &@ty::type_constr) {
255-
w.write_str(path_to_str(c.node.path));
257+
w.write_str(istr::from_estr(path_to_str(c.node.path)));
256258
w.write_char('(');
257-
w.write_str(cx.ds(c.node.id));
259+
w.write_str(istr::from_estr(cx.ds(c.node.id)));
258260
w.write_char('|');
259261
let semi = false;
260262
for a: @ty::ty_constr_arg in c.node.args {
261263
if semi { w.write_char(';'); } else { semi = true; }
262264
alt a.node {
263265
carg_base. { w.write_char('*'); }
264-
carg_ident(p) { w.write_str(path_to_str(p)); }
265-
carg_lit(l) { w.write_str(lit_to_str(l)); }
266+
carg_ident(p) {
267+
w.write_str(istr::from_estr(path_to_str(p))); }
268+
carg_lit(l) {
269+
w.write_str(istr::from_estr(lit_to_str(l))); }
266270
}
267271
}
268272
w.write_char(')');

0 commit comments

Comments
 (0)