Skip to content

Commit d92e8c1

Browse files
committed
---
yaml --- r: 41891 b: refs/heads/master c: 7eb8642 h: refs/heads/master i: 41889: 6a08cb1 41887: 214eefd v: v3
1 parent 3586658 commit d92e8c1

File tree

10 files changed

+142
-221
lines changed

10 files changed

+142
-221
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 9cdcd9bff930fd9fc0813418c63def0a06f2558a
2+
refs/heads/master: 7eb8642aed3cd12a836c75aff25cbaf2dfc35017
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
55
refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650

trunk/src/libcore/gc.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ use io;
4444
use libc::{size_t, uintptr_t};
4545
use option::{None, Option, Some};
4646
use ptr;
47-
use send_map::linear::LinearSet;
47+
use send_map::linear::LinearMap;
4848
use stackwalk;
4949
use sys;
5050

@@ -294,6 +294,12 @@ pub fn gc() {
294294
}
295295
}
296296

297+
type RootSet = LinearMap<*Word,()>;
298+
299+
fn RootSet() -> RootSet {
300+
LinearMap()
301+
}
302+
297303
#[cfg(gc)]
298304
fn expect_sentinel() -> bool { true }
299305

@@ -331,13 +337,13 @@ pub fn cleanup_stack_for_failure() {
331337
ptr::null()
332338
};
333339

334-
let mut roots = LinearSet::new();
340+
let mut roots = ~RootSet();
335341
for walk_gc_roots(need_cleanup, sentinel) |root, tydesc| {
336342
// Track roots to avoid double frees.
337-
if roots.contains(&*root) {
343+
if roots.find(&*root).is_some() {
338344
loop;
339345
}
340-
roots.insert(*root);
346+
roots.insert(*root, ());
341347

342348
if ptr::is_null(tydesc) {
343349
// FIXME #4420: Destroy this box

trunk/src/libcore/send_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ pub mod linear {
485485
fn remove(&mut self, value: &T) -> bool { self.map.remove(value) }
486486
}
487487

488-
pub impl <T: Hash IterBytes Eq> LinearSet<T> {
488+
impl <T: Hash IterBytes Eq> LinearSet<T> {
489489
/// Create an empty LinearSet
490490
static fn new() -> LinearSet<T> { LinearSet{map: LinearMap()} }
491491
}

trunk/src/libcore/task/spawn.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,21 +96,21 @@ macro_rules! move_it (
9696
{ $x:expr } => ( unsafe { let y = move *ptr::addr_of(&($x)); move y } )
9797
)
9898

99-
type TaskSet = send_map::linear::LinearSet<*rust_task>;
99+
type TaskSet = send_map::linear::LinearMap<*rust_task,()>;
100100

101101
fn new_taskset() -> TaskSet {
102-
send_map::linear::LinearSet::new()
102+
send_map::linear::LinearMap()
103103
}
104104
fn taskset_insert(tasks: &mut TaskSet, task: *rust_task) {
105-
let didnt_overwrite = tasks.insert(task);
105+
let didnt_overwrite = tasks.insert(task, ());
106106
assert didnt_overwrite;
107107
}
108108
fn taskset_remove(tasks: &mut TaskSet, task: *rust_task) {
109109
let was_present = tasks.remove(&task);
110110
assert was_present;
111111
}
112112
pub fn taskset_each(tasks: &TaskSet, blk: fn(v: *rust_task) -> bool) {
113-
tasks.each(|k| blk(*k))
113+
tasks.each_key(|k| blk(*k))
114114
}
115115

116116
// One of these per group of linked-failure tasks.

trunk/src/librustc/middle/borrowck/gather_loans.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use util::common::indenter;
3030
use util::ppaux::{expr_repr, region_to_str};
3131

3232
use core::dvec;
33-
use core::send_map::linear::LinearSet;
33+
use core::send_map::linear::LinearMap;
3434
use core::vec;
3535
use std::map::HashMap;
3636
use syntax::ast::{m_const, m_imm, m_mutbl};
@@ -73,15 +73,15 @@ enum gather_loan_ctxt = @{bccx: borrowck_ctxt,
7373
req_maps: req_maps,
7474
mut item_ub: ast::node_id,
7575
mut root_ub: ast::node_id,
76-
mut ignore_adjustments: LinearSet<ast::node_id>};
76+
mut ignore_adjustments: LinearMap<ast::node_id,()>};
7777

7878
fn gather_loans(bccx: borrowck_ctxt, crate: @ast::crate) -> req_maps {
7979
let glcx = gather_loan_ctxt(@{bccx: bccx,
8080
req_maps: {req_loan_map: HashMap(),
8181
pure_map: HashMap()},
8282
mut item_ub: 0,
8383
mut root_ub: 0,
84-
mut ignore_adjustments: LinearSet::new()});
84+
mut ignore_adjustments: LinearMap()});
8585
let v = visit::mk_vt(@visit::Visitor {visit_expr: req_loans_in_expr,
8686
visit_fn: req_loans_in_fn,
8787
visit_stmt: add_stmt_to_map,
@@ -126,7 +126,7 @@ fn req_loans_in_expr(ex: @ast::expr,
126126
ex.id, pprust::expr_to_str(ex, tcx.sess.intr()));
127127

128128
// If this expression is borrowed, have to ensure it remains valid:
129-
if !self.ignore_adjustments.contains(&ex.id) {
129+
if !self.ignore_adjustments.contains_key(&ex.id) {
130130
for tcx.adjustments.find(ex.id).each |adjustments| {
131131
self.guarantee_adjustments(ex, *adjustments);
132132
}
@@ -221,7 +221,7 @@ fn req_loans_in_expr(ex: @ast::expr,
221221

222222
// FIXME (#3387): Total hack: Ignore adjustments for the left-hand
223223
// side. Their regions will be inferred to be too large.
224-
self.ignore_adjustments.insert(rcvr.id);
224+
self.ignore_adjustments.insert(rcvr.id, ());
225225

226226
visit::visit_expr(ex, self, vt);
227227
}

trunk/src/librustc/middle/borrowck/preserve.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -358,14 +358,14 @@ priv impl &preserve_ctxt {
358358
debug!("Elected to root");
359359
let rk = {id: base.id, derefs: derefs};
360360
// This code could potentially lead cause boxes to be frozen
361-
// for longer than necessarily at runtime. It prevents an
362-
// ICE in trans; the fundamental problem is that it's hard
363-
// to make sure trans and borrowck have the same notion of
364-
// scope. The real fix is to clean up how trans handles
365-
// cleanups, but that's hard. If this becomes an issue, it's
366-
// an option to just change this to `let scope_to_use =
367-
// scope_id;`. Though that would potentially re-introduce
368-
// the ICE. See #3511 for more details.
361+
// for longer than necessarily at runtime. It prevents an ICE
362+
// in trans; the fundamental problem is that it's hard to make
363+
// sure trans and borrowck have the same notion of scope. The
364+
// real fix is to clean up how trans handles cleanups, but
365+
// that's hard. If this becomes an issue, it's an option to just
366+
// change this to `let scope_to_use = scope_id;`. Though that
367+
// would potentially re-introduce the ICE. See #3511 for more
368+
// details.
369369
let scope_to_use = if
370370
self.bccx.stmt_map.contains_key(scope_id) {
371371
// Root it in its parent scope, b/c

trunk/src/librustc/middle/trans/consts.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,7 @@ fn const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
405405
assert ast_util::is_local(def_id);
406406
let f = base::get_item_val(cx, def_id.node);
407407
match purity {
408-
ast::extern_fn =>
409-
llvm::LLVMConstPointerCast(f, T_ptr(T_i8())),
408+
ast::extern_fn => llvm::LLVMConstPointerCast(f, T_ptr(T_i8())),
410409
_ => C_struct(~[f, C_null(T_opaque_box_ptr(cx))])
411410
}
412411
}

trunk/src/librustc/middle/typeck/coherence.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -693,18 +693,18 @@ impl CoherenceChecker {
693693
694694
let tcx = self.crate_context.tcx;
695695
696-
let mut provided_names = send_map::linear::LinearSet::new();
696+
let mut provided_names = send_map::linear::LinearMap();
697697
// Implemented methods
698698
for uint::range(0, all_methods.len()) |i| {
699-
provided_names.insert(all_methods[i].ident);
699+
provided_names.insert(all_methods[i].ident, ());
700700
}
701701
// Default methods
702702
for ty::provided_trait_methods(tcx, trait_did).each |ident| {
703-
provided_names.insert(*ident);
703+
provided_names.insert(*ident, ());
704704
}
705705
706706
for (*ty::trait_methods(tcx, trait_did)).each |method| {
707-
if provided_names.contains(&method.ident) { loop; }
707+
if provided_names.contains_key(&method.ident) { loop; }
708708
709709
tcx.sess.span_err(trait_ref_span,
710710
fmt!("missing method `%s`",

trunk/src/libstd/treemap.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@ impl <K: Ord, V> TreeMap<K, V> {
120120
/// Create an empty TreeMap
121121
static pure fn new() -> TreeMap<K, V> { TreeMap{root: None, length: 0} }
122122

123-
/// Return true if the map contains some elements
124-
pure fn is_not_empty(&self) -> bool { self.root.is_some() }
125123

126124
/// Visit all key-value pairs in reverse order
127125
pure fn each_reverse(&self, f: fn(&K, &V) -> bool) {
@@ -176,7 +174,7 @@ impl <K: Ord, V> TreeMapIterator<K, V> {
176174
/// tuple with a reference to the key and value. If there are no
177175
/// more nodes, return `None`.
178176
fn next(&mut self) -> Option<(&self/K, &self/V)> {
179-
while self.stack.is_not_empty() || self.node.is_some() {
177+
while !self.stack.is_empty() || self.node.is_some() {
180178
match *self.node {
181179
Some(ref x) => {
182180
self.stack.push(x);
@@ -240,9 +238,6 @@ impl <T: Ord> TreeSet<T> {
240238
/// Create an empty TreeSet
241239
static pure fn new() -> TreeSet<T> { TreeSet{map: TreeMap::new()} }
242240

243-
/// Return true if the set contains some elements
244-
pure fn is_not_empty(&self) -> bool { self.map.is_not_empty() }
245-
246241
/// Visit all values in reverse order
247242
pure fn each_reverse(&self, f: fn(&T) -> bool) {
248243
self.map.each_key_reverse(f)
@@ -675,7 +670,6 @@ mod test_treemap {
675670

676671
fn check_equal<K: Eq Ord, V: Eq>(ctrl: &[(K, V)], map: &TreeMap<K, V>) {
677672
assert ctrl.is_empty() == map.is_empty();
678-
assert ctrl.is_not_empty() == map.is_not_empty();
679673
for ctrl.each |x| {
680674
let &(k, v) = x;
681675
assert map.find(&k).unwrap() == &v

0 commit comments

Comments
 (0)