Skip to content

Commit 545306f

Browse files
committed
---
yaml --- r: 44285 b: refs/heads/snap-stage3 c: abc4ea2 h: refs/heads/master i: 44283: 2c25a8d v: v3
1 parent d9f7b52 commit 545306f

35 files changed

+477
-280
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 19dfec2aaf746535de1521f68421f9980dbf25de
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 6e5705a87743503232ec927efebd00861f1ce717
4+
refs/heads/snap-stage3: abc4ea2001c24f3a1e3d9edf3bebb1b2bb8629ec
55
refs/heads/try: ef355f6332f83371e4acf04fc4eb940ab41d78d3
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/middle/astencode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ fn encode_side_tables_for_id(ecx: @e::EncodeContext,
860860
}
861861
}
862862
}
863-
do option::iter(&tcx.node_types.find(&(id as uint))) |&ty| {
863+
do option::iter(&(*tcx.node_types).find(id as uint)) |ty| {
864864
do ebml_w.tag(c::tag_table_node_type) {
865865
ebml_w.id(id);
866866
do ebml_w.tag(c::tag_table_val) {
@@ -1135,7 +1135,7 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext,
11351135
let ty = val_dsr.read_ty(xcx);
11361136
debug!("inserting ty for node %?: %s",
11371137
id, ty_to_str(dcx.tcx, ty));
1138-
dcx.tcx.node_types.insert(id as uint, ty);
1138+
(*dcx.tcx.node_types).insert(id as uint, ty);
11391139
} else if tag == (c::tag_table_node_type_subst as uint) {
11401140
let tys = val_dsr.read_tys(xcx);
11411141
dcx.tcx.node_type_substs.insert(id, tys);

branches/snap-stage3/src/librustc/middle/lint.rs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ use core::uint;
3434
use core::vec;
3535
use std::oldmap::{Map, HashMap};
3636
use std::oldmap;
37-
use std::smallintmap::SmallIntMap;
37+
use std::oldsmallintmap::{Map, SmallIntMap};
38+
use std::oldsmallintmap;
3839
use syntax::ast_util::{path_to_ident};
3940
use syntax::attr;
4041
use syntax::codemap::span;
@@ -274,7 +275,7 @@ pub fn get_lint_dict() -> LintDict {
274275
}
275276

276277
// This is a highly not-optimal set of data structure decisions.
277-
type LintModes = @mut SmallIntMap<level>;
278+
type LintModes = SmallIntMap<level>;
278279
type LintModeMap = HashMap<ast::node_id, LintModes>;
279280

280281
// settings_map maps node ids of items with non-default lint settings
@@ -287,14 +288,14 @@ pub struct LintSettings {
287288

288289
pub fn mk_lint_settings() -> LintSettings {
289290
LintSettings {
290-
default_settings: @mut SmallIntMap::new(),
291+
default_settings: oldsmallintmap::mk(),
291292
settings_map: HashMap()
292293
}
293294
}
294295

295296
pub fn get_lint_level(modes: LintModes, lint: lint) -> level {
296-
match modes.find(&(lint as uint)) {
297-
Some(&c) => c,
297+
match modes.find(lint as uint) {
298+
Some(c) => c,
298299
None => allow
299300
}
300301
}
@@ -313,7 +314,8 @@ pub fn get_lint_settings_level(settings: LintSettings,
313314
// This is kind of unfortunate. It should be somewhere else, or we should use
314315
// a persistent data structure...
315316
fn clone_lint_modes(modes: LintModes) -> LintModes {
316-
@mut (copy *modes)
317+
oldsmallintmap::SmallIntMap_(@oldsmallintmap::SmallIntMap_
318+
{v: copy modes.v})
317319
}
318320

319321
struct Context {
@@ -330,7 +332,7 @@ impl Context {
330332

331333
fn set_level(&self, lint: lint, level: level) {
332334
if level == allow {
333-
self.curr.remove(&(lint as uint));
335+
self.curr.remove(lint as uint);
334336
} else {
335337
self.curr.insert(lint as uint, level);
336338
}
@@ -438,7 +440,7 @@ fn build_settings_item(i: @ast::item, &&cx: Context, v: visit::vt<Context>) {
438440
pub fn build_settings_crate(sess: session::Session, crate: @ast::crate) {
439441
let cx = Context {
440442
dict: get_lint_dict(),
441-
curr: @mut SmallIntMap::new(),
443+
curr: oldsmallintmap::mk(),
442444
is_default: true,
443445
sess: sess
444446
};
@@ -456,7 +458,7 @@ pub fn build_settings_crate(sess: session::Session, crate: @ast::crate) {
456458

457459
do cx.with_lint_attrs(/*bad*/copy crate.node.attrs) |cx| {
458460
// Copy out the default settings
459-
for cx.curr.each |&(k, &v)| {
461+
for cx.curr.each |k, v| {
460462
sess.lint_settings.default_settings.insert(k, v);
461463
}
462464

branches/snap-stage3/src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ use core::option::{is_none, is_some};
7676
use core::option;
7777
use core::uint;
7878
use std::oldmap::HashMap;
79+
use std::oldsmallintmap;
7980
use std::{oldmap, time, list};
8081
use syntax::ast_map::{path, path_elt_to_str, path_mod, path_name};
8182
use syntax::ast_util::{def_id_of_def, local_def, path_to_ident};

branches/snap-stage3/src/librustc/middle/ty.rs

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ use core::uint;
4242
use core::vec;
4343
use core::hashmap::linear::LinearMap;
4444
use std::oldmap::HashMap;
45-
use std::oldmap;
46-
use std::smallintmap::SmallIntMap;
45+
use std::{oldmap, oldsmallintmap};
4746
use syntax::ast::*;
4847
use syntax::ast_util::{is_local, local_def};
4948
use syntax::ast_util;
@@ -768,7 +767,7 @@ type type_cache = HashMap<ast::def_id, ty_param_bounds_and_ty>;
768767

769768
type constness_cache = HashMap<ast::def_id, const_eval::constness>;
770769

771-
pub type node_type_table = @mut SmallIntMap<t>;
770+
pub type node_type_table = @oldsmallintmap::SmallIntMap<t>;
772771

773772
fn mk_rcache() -> creader_cache {
774773
type val = {cnum: int, pos: uint, len: uint};
@@ -813,7 +812,7 @@ pub fn mk_ctxt(s: session::Session,
813812
def_map: dm,
814813
region_map: region_map,
815814
region_paramd_items: region_paramd_items,
816-
node_types: @mut SmallIntMap::new(),
815+
node_types: @oldsmallintmap::mk(),
817816
node_type_substs: oldmap::HashMap(),
818817
items: amap,
819818
intrinsic_defs: oldmap::HashMap(),
@@ -2788,8 +2787,8 @@ pub fn br_hashmap<V:Copy>() -> HashMap<bound_region, V> {
27882787
27892788
pub fn node_id_to_type(cx: ctxt, id: ast::node_id) -> t {
27902789
//io::println(fmt!("%?/%?", id, cx.node_types.len()));
2791-
match cx.node_types.find(&(id as uint)) {
2792-
Some(&t) => t,
2790+
match oldsmallintmap::find(*cx.node_types, id as uint) {
2791+
Some(t) => t,
27932792
None => cx.sess.bug(
27942793
fmt!("node_id_to_type: no type for node `%s`",
27952794
ast_map::node_id_to_str(cx.items, id,
@@ -3180,8 +3179,8 @@ pub fn expr_kind(tcx: ctxt,
31803179
}
31813180

31823181
ast::expr_cast(*) => {
3183-
match tcx.node_types.find(&(expr.id as uint)) {
3184-
Some(&t) => {
3182+
match oldsmallintmap::find(*tcx.node_types, expr.id as uint) {
3183+
Some(t) => {
31853184
if ty::type_is_immediate(t) {
31863185
RvalueDatumExpr
31873186
} else {
@@ -4290,8 +4289,7 @@ pub fn eval_repeat_count(tcx: ctxt,
42904289
count_expr: @ast::expr,
42914290
span: span)
42924291
-> uint {
4293-
match const_eval::eval_const_expr_partial(tcx, count_expr) {
4294-
Ok(ref const_val) => match *const_val {
4292+
match const_eval::eval_const_expr(tcx, count_expr) {
42954293
const_eval::const_int(count) => return count as uint,
42964294
const_eval::const_uint(count) => return count as uint,
42974295
const_eval::const_float(count) => {
@@ -4312,13 +4310,7 @@ pub fn eval_repeat_count(tcx: ctxt,
43124310
repeat count but found boolean");
43134311
return 0;
43144312
}
4315-
},
4316-
Err(*) => {
4317-
tcx.sess.span_err(span,
4318-
~"expected constant integer for repeat count \
4319-
but found variable");
4320-
return 0;
4321-
}
4313+
43224314
}
43234315
}
43244316

branches/snap-stage3/src/librustc/middle/typeck/infer/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ use core::result;
277277
use core::vec;
278278
use std::list::Nil;
279279
use std::oldmap::HashMap;
280-
use std::smallintmap::SmallIntMap;
280+
use std::oldsmallintmap;
281281
use syntax::ast::{ret_style, purity};
282282
use syntax::ast::{m_const, m_imm, m_mutbl};
283283
use syntax::ast::{unsafe_fn, impure_fn, pure_fn, extern_fn};
@@ -353,7 +353,7 @@ pub fn fixup_err_to_str(f: fixup_err) -> ~str {
353353

354354
fn new_ValsAndBindings<V:Copy,T:Copy>() -> ValsAndBindings<V, T> {
355355
ValsAndBindings {
356-
vals: @mut SmallIntMap::new(),
356+
vals: oldsmallintmap::mk(),
357357
bindings: ~[]
358358
}
359359
}

branches/snap-stage3/src/librustc/middle/typeck/infer/unify.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use core::prelude::*;
1212
use core::result;
13-
use std::smallintmap::SmallIntMap;
13+
use std::oldsmallintmap::SmallIntMap;
1414

1515
use middle::ty::{Vid, expected_found, IntVarValue};
1616
use middle::ty;
@@ -27,7 +27,7 @@ pub enum VarValue<V, T> {
2727
}
2828

2929
pub struct ValsAndBindings<V, T> {
30-
vals: @mut SmallIntMap<VarValue<V, T>>,
30+
vals: SmallIntMap<VarValue<V, T>>,
3131
bindings: ~[(V, VarValue<V, T>)],
3232
}
3333

@@ -64,12 +64,12 @@ pub impl InferCtxt {
6464
vid: V) -> Node<V, T>
6565
{
6666
let vid_u = vid.to_uint();
67-
match vb.vals.find(&vid_u) {
67+
match vb.vals.find(vid_u) {
6868
None => {
6969
tcx.sess.bug(fmt!(
7070
"failed lookup of vid `%u`", vid_u));
7171
}
72-
Some(var_val) => {
72+
Some(ref var_val) => {
7373
match *var_val {
7474
Redirect(vid) => {
7575
let node: Node<V,T> = helper(tcx, vb, vid);
@@ -103,8 +103,8 @@ pub impl InferCtxt {
103103

104104
{ // FIXME(#4903)---borrow checker is not flow sensitive
105105
let vb = UnifyVid::appropriate_vals_and_bindings(self);
106-
let old_v = vb.vals.get(&vid.to_uint());
107-
vb.bindings.push((vid, *old_v));
106+
let old_v = vb.vals.get(vid.to_uint());
107+
vb.bindings.push((vid, old_v));
108108
vb.vals.insert(vid.to_uint(), new_v);
109109
}
110110
}

branches/snap-stage3/src/librustc/middle/typeck/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ use std::list::{List, Nil, Cons};
6969
use std::list;
7070
use std::oldmap::HashMap;
7171
use std::oldmap;
72+
use std::oldsmallintmap;
7273
use syntax::ast::{provided, required};
7374
use syntax::ast_map::node_id_to_str;
7475
use syntax::ast_util::{local_def, split_trait_methods};

0 commit comments

Comments
 (0)