Skip to content

Commit dd542ec

Browse files
committed
---
yaml --- r: 36347 b: refs/heads/try2 c: 1a1e99c h: refs/heads/master i: 36345: 5481733 36343: 466d33a v: v3
1 parent ae76da7 commit dd542ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+984
-808
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 401093ec7d66f898338abb30b8097e06bfeb1a58
8+
refs/heads/try2: 1a1e99c27d0d701f315926f400aa325ddfc8a9e7
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try2/src/libcore/char.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,19 +126,16 @@ pub pure fn to_digit(c: char, radix: uint) -> Option<uint> {
126126
* - chars in [0x100,0xffff] get 4-digit escapes: `\\uNNNN`
127127
* - chars above 0x10000 get 8-digit escapes: `\\UNNNNNNNN`
128128
*/
129-
pub pure fn escape_unicode(c: char) -> ~str {
129+
pub fn escape_unicode(c: char) -> ~str {
130130
let s = u32::to_str(c as u32, 16u);
131131
let (c, pad) = (if c <= '\xff' { ('x', 2u) }
132132
else if c <= '\uffff' { ('u', 4u) }
133133
else { ('U', 8u) });
134134
assert str::len(s) <= pad;
135135
let mut out = ~"\\";
136-
unsafe {
137-
str::push_str(&mut out, str::from_char(c));
138-
for uint::range(str::len(s), pad) |_i|
139-
{ str::push_str(&mut out, ~"0"); }
140-
str::push_str(&mut out, s);
141-
}
136+
str::push_str(&mut out, str::from_char(c));
137+
for uint::range(str::len(s), pad) |_i| { str::push_str(&mut out, ~"0"); }
138+
str::push_str(&mut out, s);
142139
move out
143140
}
144141

@@ -154,7 +151,7 @@ pub pure fn escape_unicode(c: char) -> ~str {
154151
* - Any other chars in the range [0x20,0x7e] are not escaped.
155152
* - Any other chars are given hex unicode escapes; see `escape_unicode`.
156153
*/
157-
pub pure fn escape_default(c: char) -> ~str {
154+
pub fn escape_default(c: char) -> ~str {
158155
match c {
159156
'\t' => ~"\\t",
160157
'\r' => ~"\\r",

branches/try2/src/libcore/from_str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
use option::Option;
88

99
pub trait FromStr {
10-
static pure fn from_str(s: &str) -> Option<self>;
10+
static fn from_str(s: &str) -> Option<self>;
1111
}
1212

branches/try2/src/libcore/int-template.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl T: iter::Times {
106106
* * buf - A byte buffer
107107
* * radix - The base of the number
108108
*/
109-
pub pure fn parse_bytes(buf: &[u8], radix: uint) -> Option<T> {
109+
pub fn parse_bytes(buf: &[u8], radix: uint) -> Option<T> {
110110
if vec::len(buf) == 0u { return None; }
111111
let mut i = vec::len(buf) - 1u;
112112
let mut start = 0u;
@@ -129,13 +129,10 @@ pub pure fn parse_bytes(buf: &[u8], radix: uint) -> Option<T> {
129129
}
130130

131131
/// Parse a string to an int
132-
pub pure fn from_str(s: &str) -> Option<T>
133-
{
134-
parse_bytes(str::to_bytes(s), 10u)
135-
}
132+
pub fn from_str(s: &str) -> Option<T> { parse_bytes(str::to_bytes(s), 10u) }
136133

137134
impl T : FromStr {
138-
static pure fn from_str(s: &str) -> Option<T> { from_str(s) }
135+
static fn from_str(s: &str) -> Option<T> { from_str(s) }
139136
}
140137

141138
/// Convert to a string in a given base

branches/try2/src/libcore/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ pub pure fn with_bytes_reader<t>(bytes: &[u8], f: fn(Reader) -> t) -> t {
512512
f(BytesReader { bytes: bytes, pos: 0u } as Reader)
513513
}
514514

515-
pub pure fn with_str_reader<T>(s: &str, f: fn(Reader) -> T) -> T {
515+
pub fn with_str_reader<T>(s: &str, f: fn(Reader) -> T) -> T {
516516
str::byte_slice(s, |bytes| with_bytes_reader(bytes, f))
517517
}
518518

branches/try2/src/libcore/mutable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl<T> Data<T> {
4848
}
4949
}
5050

51-
pure fn borrow_const<R>(op: &fn(t: &const T) -> R) -> R {
51+
fn borrow_const<R>(op: &fn(t: &const T) -> R) -> R {
5252
op(&const self.value)
5353
}
5454

branches/try2/src/libcore/result.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,13 @@ pub fn map_err<T: Copy, E, F: Copy>(res: &Result<T, E>, op: fn((&E)) -> F)
204204
}
205205

206206
impl<T, E> Result<T, E> {
207-
pure fn get_ref(&self) -> &self/T { get_ref(self) }
207+
fn get_ref(&self) -> &self/T { get_ref(self) }
208208

209-
pure fn is_ok() -> bool { is_ok(&self) }
209+
fn is_ok() -> bool { is_ok(&self) }
210210

211-
pure fn is_err() -> bool { is_err(&self) }
211+
fn is_err() -> bool { is_err(&self) }
212212

213-
pure fn iter(f: fn((&T))) {
213+
fn iter(f: fn((&T))) {
214214
match self {
215215
Ok(ref t) => f(t),
216216
Err(_) => ()
@@ -226,7 +226,7 @@ impl<T, E> Result<T, E> {
226226
}
227227

228228
impl<T: Copy, E> Result<T, E> {
229-
pure fn get() -> T { get(&self) }
229+
fn get() -> T { get(&self) }
230230

231231
fn map_err<F:Copy>(op: fn((&E)) -> F) -> Result<T,F> {
232232
match self {
@@ -237,7 +237,7 @@ impl<T: Copy, E> Result<T, E> {
237237
}
238238

239239
impl<T, E: Copy> Result<T, E> {
240-
pure fn get_err() -> E { get_err(&self) }
240+
fn get_err() -> E { get_err(&self) }
241241

242242
fn map<U:Copy>(op: fn((&T)) -> U) -> Result<U,E> {
243243
match self {

branches/try2/src/libcore/uint-template.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl T: iter::Times {
100100
*
101101
* `buf` must not be empty
102102
*/
103-
pub pure fn parse_bytes(buf: &[const u8], radix: uint) -> Option<T> {
103+
pub fn parse_bytes(buf: &[const u8], radix: uint) -> Option<T> {
104104
if vec::len(buf) == 0u { return None; }
105105
let mut i = vec::len(buf) - 1u;
106106
let mut power = 1u as T;
@@ -117,13 +117,10 @@ pub pure fn parse_bytes(buf: &[const u8], radix: uint) -> Option<T> {
117117
}
118118

119119
/// Parse a string to an int
120-
pub pure fn from_str(s: &str) -> Option<T>
121-
{
122-
parse_bytes(str::to_bytes(s), 10u)
123-
}
120+
pub fn from_str(s: &str) -> Option<T> { parse_bytes(str::to_bytes(s), 10u) }
124121

125122
impl T : FromStr {
126-
static pure fn from_str(s: &str) -> Option<T> { from_str(s) }
123+
static fn from_str(s: &str) -> Option<T> { from_str(s) }
127124
}
128125

129126
/// Parse a string as an unsigned integer.

branches/try2/src/libfuzzer/fuzzer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ fn as_str(f: fn@(+x: io::Writer)) -> ~str {
225225
io::with_str_writer(f)
226226
}
227227

228-
fn check_variants_of_ast(crate: ast::crate, codemap: codemap::CodeMap,
228+
fn check_variants_of_ast(crate: ast::crate, codemap: @codemap::CodeMap,
229229
filename: &Path, cx: context) {
230230
let stolen = steal(crate, cx.mode);
231231
let extra_exprs = vec::filter(common_exprs(),
@@ -239,7 +239,7 @@ fn check_variants_of_ast(crate: ast::crate, codemap: codemap::CodeMap,
239239

240240
fn check_variants_T<T: Copy>(
241241
crate: ast::crate,
242-
codemap: codemap::CodeMap,
242+
codemap: @codemap::CodeMap,
243243
filename: &Path,
244244
thing_label: ~str,
245245
things: ~[T],

branches/try2/src/librustc/driver/driver.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ fn pretty_print_input(sess: Session, cfg: ast::crate_cfg, input: input,
366366
ppm_expanded | ppm_normal => pprust::no_ann()
367367
};
368368
let is_expanded = upto != cu_parse;
369-
let src = codemap::get_filemap(sess.codemap, source_name(input)).src;
369+
let src = sess.codemap.get_filemap(source_name(input)).src;
370370
do io::with_str_reader(*src) |rdr| {
371371
pprust::print_crate(sess.codemap, sess.parse_sess.interner,
372372
sess.span_diagnostic, crate,
@@ -586,7 +586,7 @@ fn build_session_options(binary: ~str,
586586

587587
fn build_session(sopts: @session::options,
588588
demitter: diagnostic::emitter) -> Session {
589-
let codemap = codemap::new_codemap();
589+
let codemap = @codemap::CodeMap::new();
590590
let diagnostic_handler =
591591
diagnostic::mk_handler(Some(demitter));
592592
let span_diagnostic_handler =
@@ -595,7 +595,7 @@ fn build_session(sopts: @session::options,
595595
}
596596

597597
fn build_session_(sopts: @session::options,
598-
cm: codemap::CodeMap,
598+
cm: @codemap::CodeMap,
599599
demitter: diagnostic::emitter,
600600
span_diagnostic_handler: diagnostic::span_handler)
601601
-> Session {

branches/try2/src/librustc/driver/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ type Session_ = {targ_cfg: @config,
131131
opts: @options,
132132
cstore: metadata::cstore::CStore,
133133
parse_sess: parse_sess,
134-
codemap: codemap::CodeMap,
134+
codemap: @codemap::CodeMap,
135135
// For a library crate, this is always none
136136
mut main_fn: Option<(node_id, codemap::span)>,
137137
span_diagnostic: diagnostic::span_handler,

branches/try2/src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Serializer,
557557
let add_to_index = |copy ebml_w| add_to_index_(item, ebml_w, index);
558558

559559
debug!("encoding info for item at %s",
560-
syntax::codemap::span_to_str(item.span, ecx.tcx.sess.codemap));
560+
ecx.tcx.sess.codemap.span_to_str(item.span));
561561

562562
match item.node {
563563
item_const(_, _) => {

branches/try2/src/librustc/middle/liveness.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ use std::map::HashMap;
9797
use syntax::{visit, ast_util};
9898
use syntax::print::pprust::{expr_to_str, block_to_str};
9999
use visit::vt;
100-
use syntax::codemap::{span, span_to_str};
100+
use syntax::codemap::span;
101101
use syntax::ast::*;
102102
use io::WriterUtil;
103103
use capture::{cap_move, cap_drop, cap_copy, cap_ref};
@@ -170,9 +170,9 @@ impl LiveNodeKind : cmp::Eq {
170170
fn live_node_kind_to_str(lnk: LiveNodeKind, cx: ty::ctxt) -> ~str {
171171
let cm = cx.sess.codemap;
172172
match lnk {
173-
FreeVarNode(s) => fmt!("Free var node [%s]", span_to_str(s, cm)),
174-
ExprNode(s) => fmt!("Expr node [%s]", span_to_str(s, cm)),
175-
VarDefNode(s) => fmt!("Var def node [%s]", span_to_str(s, cm)),
173+
FreeVarNode(s) => fmt!("Free var node [%s]", cm.span_to_str(s)),
174+
ExprNode(s) => fmt!("Expr node [%s]", cm.span_to_str(s)),
175+
VarDefNode(s) => fmt!("Var def node [%s]", cm.span_to_str(s)),
176176
ExitNode => ~"Exit node"
177177
}
178178
}

branches/try2/src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ fn trans_trace(bcx: block, sp_opt: Option<span>, trace_str: ~str) {
919919
let {V_filename, V_line} = match sp_opt {
920920
Some(sp) => {
921921
let sess = bcx.sess();
922-
let loc = codemap::lookup_char_pos(sess.parse_sess.cm, sp.lo);
922+
let loc = sess.parse_sess.cm.lookup_char_pos(sp.lo);
923923
{V_filename: C_cstr(bcx.ccx(), loc.file.name),
924924
V_line: loc.line as int}
925925
}

branches/try2/src/librustc/middle/trans/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ fn _UndefReturn(cx: block, Fn: ValueRef) -> ValueRef {
645645
fn add_span_comment(bcx: block, sp: span, text: ~str) {
646646
let ccx = bcx.ccx();
647647
if !ccx.sess.no_asm_comments() {
648-
let s = text + ~" (" + codemap::span_to_str(sp, ccx.sess.codemap)
648+
let s = text + ~" (" + ccx.sess.codemap.span_to_str(sp)
649649
+ ~")";
650650
log(debug, s);
651651
add_comment(bcx, s);

branches/try2/src/librustc/middle/trans/controlflow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ fn trans_fail_value(bcx: block, sp_opt: Option<span>, V_fail_str: ValueRef)
339339
let {V_filename, V_line} = match sp_opt {
340340
Some(sp) => {
341341
let sess = bcx.sess();
342-
let loc = codemap::lookup_char_pos(sess.parse_sess.cm, sp.lo);
342+
let loc = sess.parse_sess.cm.lookup_char_pos(sp.lo);
343343
{V_filename: C_cstr(bcx.ccx(), loc.file.name),
344344
V_line: loc.line as int}
345345
}
@@ -361,7 +361,7 @@ fn trans_fail_bounds_check(bcx: block, sp: span,
361361
let _icx = bcx.insn_ctxt("trans_fail_bounds_check");
362362
let ccx = bcx.ccx();
363363
364-
let loc = codemap::lookup_char_pos(bcx.sess().parse_sess.cm, sp.lo);
364+
let loc = bcx.sess().parse_sess.cm.lookup_char_pos(sp.lo);
365365
let line = C_int(ccx, loc.line as int);
366366
let filename_cstr = C_cstr(bcx.ccx(), loc.file.name);
367367
let filename = PointerCast(bcx, filename_cstr, T_ptr(T_i8()));

branches/try2/src/librustc/middle/trans/debuginfo.rs

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use trans::build::B;
88
use middle::ty;
99
use syntax::{ast, codemap, ast_util, ast_map};
1010
use syntax::parse::token::ident_interner;
11-
use codemap::span;
11+
use codemap::{span, CharPos};
1212
use ast::Ty;
1313
use pat_util::*;
1414
use util::ppaux::ty_to_str;
@@ -112,7 +112,7 @@ type compile_unit_md = {name: ~str};
112112
type subprogram_md = {id: ast::node_id};
113113
type local_var_md = {id: ast::node_id};
114114
type tydesc_md = {hash: uint};
115-
type block_md = {start: codemap::loc, end: codemap::loc};
115+
type block_md = {start: codemap::Loc, end: codemap::Loc};
116116
type argument_md = {id: ast::node_id};
117117
type retval_md = {id: ast::node_id};
118118

@@ -229,8 +229,8 @@ fn create_file(cx: @crate_ctxt, full_path: ~str) -> @metadata<file_md> {
229229
return mdval;
230230
}
231231

232-
fn line_from_span(cm: codemap::CodeMap, sp: span) -> uint {
233-
codemap::lookup_char_pos(cm, sp.lo).line
232+
fn line_from_span(cm: @codemap::CodeMap, sp: span) -> uint {
233+
cm.lookup_char_pos(sp.lo).line
234234
}
235235

236236
fn create_block(cx: block) -> @metadata<block_md> {
@@ -244,9 +244,9 @@ fn create_block(cx: block) -> @metadata<block_md> {
244244
}
245245
let sp = cx.node_info.get().span;
246246

247-
let start = codemap::lookup_char_pos(cx.sess().codemap, sp.lo);
247+
let start = cx.sess().codemap.lookup_char_pos(sp.lo);
248248
let fname = start.file.name;
249-
let end = codemap::lookup_char_pos(cx.sess().codemap, sp.hi);
249+
let end = cx.sess().codemap.lookup_char_pos(sp.hi);
250250
let tg = LexicalBlockTag;
251251
/*alt cached_metadata::<@metadata<block_md>>(
252252
cache, tg,
@@ -266,8 +266,8 @@ fn create_block(cx: block) -> @metadata<block_md> {
266266
};
267267
let lldata = ~[lltag(tg),
268268
parent,
269-
lli32(start.line as int),
270-
lli32(start.col as int),
269+
lli32(start.line.to_int()),
270+
lli32(start.col.to_int()),
271271
file_node.node,
272272
lli32(unique_id)
273273
];
@@ -597,7 +597,7 @@ fn create_ty(_cx: @crate_ctxt, _t: ty::t, _ty: @ast::Ty)
597597
}
598598

599599
fn filename_from_span(cx: @crate_ctxt, sp: codemap::span) -> ~str {
600-
codemap::lookup_char_pos(cx.sess.codemap, sp.lo).file.name
600+
cx.sess.codemap.lookup_char_pos(sp.lo).file.name
601601
}
602602

603603
fn create_var(type_tag: int, context: ValueRef, name: ~str, file: ValueRef,
@@ -629,8 +629,7 @@ fn create_local_var(bcx: block, local: @ast::local)
629629
// FIXME this should be handled (#2533)
630630
_ => fail ~"no single variable name for local"
631631
};
632-
let loc = codemap::lookup_char_pos(cx.sess.codemap,
633-
local.span.lo);
632+
let loc = cx.sess.codemap.lookup_char_pos(local.span.lo);
634633
let ty = node_id_type(bcx, local.node.id);
635634
let tymd = create_ty(cx, ty, local.node.ty);
636635
let filemd = create_file(cx, loc.file.name);
@@ -674,8 +673,7 @@ fn create_arg(bcx: block, arg: ast::arg, sp: span)
674673
option::None => ()
675674
}
676675

677-
let loc = codemap::lookup_char_pos(cx.sess.codemap,
678-
sp.lo);
676+
let loc = cx.sess.codemap.lookup_char_pos(sp.lo);
679677
let ty = node_id_type(bcx, arg.id);
680678
let tymd = create_ty(cx, ty, arg.ty);
681679
let filemd = create_file(cx, loc.file.name);
@@ -714,9 +712,9 @@ fn update_source_pos(cx: block, s: span) {
714712
}
715713
let cm = cx.sess().codemap;
716714
let blockmd = create_block(cx);
717-
let loc = codemap::lookup_char_pos(cm, s.lo);
718-
let scopedata = ~[lli32(loc.line as int),
719-
lli32(loc.col as int),
715+
let loc = cm.lookup_char_pos(s.lo);
716+
let scopedata = ~[lli32(loc.line.to_int()),
717+
lli32(loc.col.to_int()),
720718
blockmd.node,
721719
llnull()];
722720
let dbgscope = llmdnode(scopedata);
@@ -731,7 +729,7 @@ fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> {
731729
log(debug, fcx.id);
732730

733731
let sp = fcx.span.get();
734-
log(debug, codemap::span_to_str(sp, cx.sess.codemap));
732+
log(debug, cx.sess.codemap.span_to_str(sp));
735733

736734
let (ident, ret_ty, id) = match cx.tcx.items.get(fcx.id) {
737735
ast_map::node_item(item, _) => {
@@ -773,8 +771,7 @@ fn create_function(fcx: fn_ctxt) -> @metadata<subprogram_md> {
773771
option::None => ()
774772
}
775773

776-
let loc = codemap::lookup_char_pos(cx.sess.codemap,
777-
sp.lo);
774+
let loc = cx.sess.codemap.lookup_char_pos(sp.lo);
778775
let file_node = create_file(cx, loc.file.name).node;
779776
let ty_node = if cx.sess.opts.extra_debuginfo {
780777
match ret_ty.node {

branches/try2/src/librustc/middle/typeck/collect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ fn ensure_supertraits(ccx: @crate_ctxt,
264264
for trait_refs.each |trait_ref| {
265265
let (did, tpt) = instantiate_trait_ref(ccx, *trait_ref, rp);
266266
if instantiated.any(|other_trait: &InstantiatedTraitRef|
267-
{ (*other_trait).def_id == did }) {
267+
{ other_trait.def_id == did }) {
268268
// This means a trait inherited from the same supertrait more
269269
// than once.
270270
tcx.sess.span_err(sp, ~"Duplicate supertrait in trait \

0 commit comments

Comments
 (0)