Skip to content

Commit bc6b765

Browse files
committed
---
yaml --- r: 52440 b: refs/heads/dist-snap c: 2c870e4 h: refs/heads/master v: v3
1 parent 245cf21 commit bc6b765

File tree

11 files changed

+222
-142
lines changed

11 files changed

+222
-142
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
99
refs/heads/incoming: 44d4d6de762f3f9aae1fedcf454c66b79b3ad58d
10-
refs/heads/dist-snap: 7eb8642aed3cd12a836c75aff25cbaf2dfc35017
10+
refs/heads/dist-snap: 2c870e40744b873bf3205af7b2057cf4f76c3d1f
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libcore/gc.rs

Lines changed: 4 additions & 10 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::LinearMap;
47+
use send_map::linear::LinearSet;
4848
use stackwalk;
4949
use sys;
5050

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

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

@@ -337,13 +331,13 @@ pub fn cleanup_stack_for_failure() {
337331
ptr::null()
338332
};
339333

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

348342
if ptr::is_null(tydesc) {
349343
// FIXME #4420: Destroy this box

branches/dist-snap/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-
impl <T: Hash IterBytes Eq> LinearSet<T> {
488+
pub impl <T: Hash IterBytes Eq> LinearSet<T> {
489489
/// Create an empty LinearSet
490490
static fn new() -> LinearSet<T> { LinearSet{map: LinearMap()} }
491491
}

branches/dist-snap/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::LinearMap<*rust_task,()>;
99+
type TaskSet = send_map::linear::LinearSet<*rust_task>;
100100

101101
fn new_taskset() -> TaskSet {
102-
send_map::linear::LinearMap()
102+
send_map::linear::LinearSet::new()
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_key(|k| blk(*k))
113+
tasks.each(|k| blk(*k))
114114
}
115115

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

branches/dist-snap/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::LinearMap;
33+
use core::send_map::linear::LinearSet;
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: LinearMap<ast::node_id,()>};
76+
mut ignore_adjustments: LinearSet<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: LinearMap()});
84+
mut ignore_adjustments: LinearSet::new()});
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_key(&ex.id) {
129+
if !self.ignore_adjustments.contains(&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
}

branches/dist-snap/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 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.
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.
369369
let scope_to_use = if
370370
self.bccx.stmt_map.contains_key(scope_id) {
371371
// Root it in its parent scope, b/c

branches/dist-snap/src/librustc/middle/trans/consts.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,8 @@ 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 => llvm::LLVMConstPointerCast(f, T_ptr(T_i8())),
408+
ast::extern_fn =>
409+
llvm::LLVMConstPointerCast(f, T_ptr(T_i8())),
409410
_ => C_struct(~[f, C_null(T_opaque_box_ptr(cx))])
410411
}
411412
}

branches/dist-snap/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::LinearMap();
696+
let mut provided_names = send_map::linear::LinearSet::new();
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_key(&method.ident) { loop; }
707+
if provided_names.contains(&method.ident) { loop; }
708708
709709
tcx.sess.span_err(trait_ref_span,
710710
fmt!("missing method `%s`",

branches/dist-snap/src/libstd/time.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,7 @@ mod tests {
10251025
}
10261026

10271027
#[test]
1028+
#[ignore(reason = "randomred")]
10281029
fn test_strptime() {
10291030
os::setenv(~"TZ", ~"America/Los_Angeles");
10301031
tzset();

branches/dist-snap/src/libstd/treemap.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ 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() }
123125

124126
/// Visit all key-value pairs in reverse order
125127
pure fn each_reverse(&self, f: fn(&K, &V) -> bool) {
@@ -174,7 +176,7 @@ impl <K: Ord, V> TreeMapIterator<K, V> {
174176
/// tuple with a reference to the key and value. If there are no
175177
/// more nodes, return `None`.
176178
fn next(&mut self) -> Option<(&self/K, &self/V)> {
177-
while !self.stack.is_empty() || self.node.is_some() {
179+
while self.stack.is_not_empty() || self.node.is_some() {
178180
match *self.node {
179181
Some(ref x) => {
180182
self.stack.push(x);
@@ -238,6 +240,9 @@ impl <T: Ord> TreeSet<T> {
238240
/// Create an empty TreeSet
239241
static pure fn new() -> TreeSet<T> { TreeSet{map: TreeMap::new()} }
240242

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

671676
fn check_equal<K: Eq Ord, V: Eq>(ctrl: &[(K, V)], map: &TreeMap<K, V>) {
672677
assert ctrl.is_empty() == map.is_empty();
678+
assert ctrl.is_not_empty() == map.is_not_empty();
673679
for ctrl.each |x| {
674680
let &(k, v) = x;
675681
assert map.find(&k).unwrap() == &v

0 commit comments

Comments
 (0)