Skip to content

Commit dc2fb8b

Browse files
committed
---
yaml --- r: 5009 b: refs/heads/master c: 675073c h: refs/heads/master i: 5007: 41aa270 v: v3
1 parent a4727d3 commit dc2fb8b

File tree

9 files changed

+232
-218
lines changed

9 files changed

+232
-218
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: 427d42228f89b52c761d91834754382637d79925
2+
refs/heads/master: 675073c26615896350034c1e07fa39b6b99cf58d

trunk/src/comp/driver/rustc.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ fn input_is_stdin(filename: str) -> bool { filename == "-" }
9595
fn parse_input(sess: session::session, cfg: &ast::crate_cfg, input: str) ->
9696
@ast::crate {
9797
if !input_is_stdin(input) {
98-
parser::parse_crate_from_file(input, cfg, sess.get_parse_sess())
98+
parser::parse_crate_from_file(
99+
istr::from_estr(input), cfg, sess.get_parse_sess())
99100
} else { parse_input_src(sess, cfg, input).crate }
100101
}
101102

@@ -107,8 +108,10 @@ fn parse_input_src(sess: session::session, cfg: &ast::crate_cfg, infile: str)
107108
} else { io::stdin() }.read_whole_stream();
108109
let src = str::unsafe_from_bytes(srcbytes);
109110
let crate =
110-
parser::parse_crate_from_source_str(infile, src, cfg,
111-
sess.get_parse_sess());
111+
parser::parse_crate_from_source_str(
112+
istr::from_estr(infile),
113+
istr::from_estr(src), cfg,
114+
sess.get_parse_sess());
112115
ret {crate: crate, src: src};
113116
}
114117

trunk/src/comp/middle/trans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4649,7 +4649,7 @@ fn trans_fail_value(cx: &@block_ctxt, sp_opt: &option::t<span>,
46494649
alt sp_opt {
46504650
some(sp) {
46514651
let loc = bcx_ccx(cx).sess.lookup_pos(sp.lo);
4652-
V_filename = C_cstr(bcx_ccx(cx), istr::from_estr(loc.filename));
4652+
V_filename = C_cstr(bcx_ccx(cx), loc.filename);
46534653
V_line = loc.line as int;
46544654
}
46554655
none. { V_filename = C_cstr(bcx_ccx(cx), ~"<runtime>"); V_line = 0; }

trunk/src/comp/syntax/codemap.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import std::option;
88
import std::option::some;
99
import std::option::none;
1010

11-
type filename = str;
11+
type filename = istr;
1212

1313
type file_pos = {ch: uint, byte: uint};
1414

@@ -84,7 +84,9 @@ fn span_to_str(sp: &span, cm: &codemap) -> str {
8484
#fmt["%s:%u:%u: %u:%u",
8585
if some(lo.filename) == prev_file {
8686
"-"
87-
} else { lo.filename }, lo.line, lo.col, hi.line, hi.col];
87+
} else {
88+
istr::to_estr(lo.filename)
89+
}, lo.line, lo.col, hi.line, hi.col];
8890
alt cur.expanded_from {
8991
os_none. { break; }
9092
os_some(new_sp) {
@@ -146,14 +148,16 @@ fn maybe_highlight_lines(sp: &option::t<span>, cm: &codemap,
146148
// Print the offending lines
147149
for line: uint in display_lines {
148150
io::stdout().write_str(
149-
istr::from_estr(#fmt["%s:%u ", fm.name, line + 1u]));
151+
istr::from_estr(#fmt["%s:%u ",
152+
istr::to_estr(fm.name), line + 1u]));
150153
let s = get_line(fm, line as int, file);
151154
if !str::ends_with(s, "\n") { s += "\n"; }
152155
io::stdout().write_str(istr::from_estr(s));
153156
}
154157
if elided {
155158
let last_line = display_lines[vec::len(display_lines) - 1u];
156-
let s = #fmt["%s:%u ", fm.name, last_line + 1u];
159+
let s = #fmt["%s:%u ",
160+
istr::to_estr(fm.name), last_line + 1u];
157161
let indent = str::char_len(s);
158162
let out = ~"";
159163
while indent > 0u { out += ~" "; indent -= 1u; }
@@ -172,7 +176,7 @@ fn maybe_highlight_lines(sp: &option::t<span>, cm: &codemap,
172176
while num > 0u { num /= 10u; digits += 1u; }
173177

174178
// indent past |name:## | and the 0-offset column location
175-
let left = str::char_len(fm.name) + digits + lo.col + 3u;
179+
let left = istr::char_len(fm.name) + digits + lo.col + 3u;
176180
let s = "";
177181
while left > 0u { str::push_char(s, ' '); left -= 1u; }
178182

@@ -209,7 +213,7 @@ fn span_to_lines(sp: span, cm: codemap::codemap) -> @file_lines {
209213
for each i: uint in uint::range(lo.line - 1u, hi.line as uint) {
210214
lines += [i];
211215
}
212-
ret @{name: lo.filename, lines: lines};
216+
ret @{name: istr::to_estr(lo.filename), lines: lines};
213217
}
214218

215219
fn get_line(fm: filemap, line: int, file: &str) -> str {
@@ -230,7 +234,9 @@ fn get_line(fm: filemap, line: int, file: &str) -> str {
230234
}
231235

232236
fn get_filemap(cm: codemap, filename: str) -> filemap {
233-
for fm: filemap in cm.files { if fm.name == filename { ret fm; } }
237+
for fm: filemap in cm.files {
238+
if fm.name == istr::from_estr(filename) { ret fm; }
239+
}
234240
//XXjdm the following triggers a mismatched type bug
235241
// (or expected function, found _|_)
236242
fail; // ("asking for " + filename + " which we don't know about");

trunk/src/comp/syntax/ext/base.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ fn mk_ctxt(sess: &session) -> ext_ctxt {
9393
// super-ugly and needs a better solution.
9494
let crate_file_name_hack = sess.get_codemap().files[0].name;
9595

96-
ret ext_ctxt(@sess, crate_file_name_hack, codemap::os_none);
96+
ret ext_ctxt(@sess, istr::to_estr(crate_file_name_hack),
97+
codemap::os_none);
9798
}
9899

99100
fn expr_to_str(cx: &ext_ctxt, expr: @ast::expr, error: str) -> str {

trunk/src/comp/syntax/parse/eval.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: &istr,
5151
let file_path = id + ~".rs";
5252
alt file_opt {
5353
some(f) {
54-
file_path = istr::from_estr(f);
54+
file_path = f;
5555
}
5656
none. { }
5757
}
@@ -63,7 +63,7 @@ fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: &istr,
6363
if cx.mode == mode_depend { cx.deps += [full_path]; ret; }
6464
let p0 =
6565
new_parser_from_file(cx.sess, cx.cfg,
66-
istr::to_estr(full_path), cx.chpos,
66+
full_path, cx.chpos,
6767
cx.byte_pos, SOURCE_FILE);
6868
let inner_attrs = parse_inner_attrs_and_next(p0);
6969
let mod_attrs = attrs + inner_attrs.inner;
@@ -82,7 +82,7 @@ fn eval_crate_directive(cx: ctx, cdir: @ast::crate_directive, prefix: &istr,
8282
let path = id;
8383
alt dir_opt {
8484
some(d) {
85-
path = istr::from_estr(d);
85+
path = d;
8686
}
8787
none. { }
8888
}

trunk/src/comp/syntax/parse/lexer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ fn gather_comments_and_literals(cm: &codemap::codemap, path: &istr,
728728
let itr = @interner::mk::<istr>(istr::hash, istr::eq);
729729
let rdr = new_reader(cm, src,
730730
codemap::new_filemap(
731-
istr::to_estr(path), 0u, 0u), itr);
731+
path, 0u, 0u), itr);
732732
let comments: [cmnt] = [];
733733
let literals: [lit] = [];
734734
let first_read: bool = true;

0 commit comments

Comments
 (0)