Skip to content

Commit bf5a6bc

Browse files
committed
---
yaml --- r: 140542 b: refs/heads/try2 c: 847552f h: refs/heads/master v: v3
1 parent 9e28a70 commit bf5a6bc

File tree

21 files changed

+263
-67
lines changed

21 files changed

+263
-67
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: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: cc51186be0c68897042a72bd52147e345ad2a2cd
8+
refs/heads/try2: 847552f48b51aec0fcc6b7fd2ee2a51f3700321a
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/host.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,10 @@ $$(HLIB$(2)_H_$(4))/$(CFG_RUSTLLVM_$(4)): \
130130
$$(HBIN$(2)_H_$(4))/:
131131
mkdir -p $$@
132132

133+
ifneq ($(CFG_LIBDIR),bin)
133134
$$(HLIB$(2)_H_$(4))/:
134135
mkdir -p $$@
136+
endif
135137

136138
endef
137139

branches/try2/mk/install.mk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,9 @@ ifeq ($(CFG_ADB_DEVICE_STATUS),true)
192192
ifdef VERBOSE
193193
ADB = adb $(1)
194194
ADB_PUSH = adb push $(1) $(2)
195-
ADB_SHELL = adb shell $(1) $(2)
195+
ADB_SHELL = adb shell $(1) $(2)
196196
else
197-
ADB = $(Q)$(call E, adb $(1)) && adb $(1) 1>/dev/null
197+
ADB = $(Q)$(call E, adb $(1)) && adb $(1) 1>/dev/null
198198
ADB_PUSH = $(Q)$(call E, adb push $(1)) && adb push $(1) $(2) 1>/dev/null
199199
ADB_SHELL = $(Q)$(call E, adb shell $(1) $(2)) && adb shell $(1) $(2) 1>/dev/null
200200
endif
@@ -222,8 +222,8 @@ install-runtime-target: \
222222
install-runtime-target-arm-linux-androideabi-cleanup \
223223
install-runtime-target-arm-linux-androideabi-host-$(CFG_BUILD_TRIPLE)
224224
else
225-
install-runtime-target:
225+
install-runtime-target:
226226
@echo "No device to install runtime library"
227-
@echo
227+
@echo
228228
endif
229229
endif

branches/try2/mk/rt.mk

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,6 @@ endif
163163
ifdef CFG_WINDOWSY_$(1)
164164
$$(LIBUV_LIB_$(1)): $$(LIBUV_DEPS)
165165
$$(Q)$$(MAKE) -C $$(S)src/libuv/ \
166-
CFLAGS="$$(CFG_GCCISH_CFLAGS)" \
167-
LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS)" \
168166
builddir_name="$$(CFG_BUILD_DIR)/rt/$(1)/libuv" \
169167
OS=mingw \
170168
V=$$(VERBOSE)

branches/try2/mk/target.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,10 @@ endif
8686
$$(TBIN$(1)_T_$(2)_H_$(3))/:
8787
mkdir -p $$@
8888

89+
ifneq ($(CFG_LIBDIR),bin)
8990
$$(TLIB$(1)_T_$(2)_H_$(3))/:
9091
mkdir -p $$@
92+
endif
9193

9294
endef
9395

branches/try2/mk/tests.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ endef
9292
$(foreach target,$(CFG_TARGET_TRIPLES), \
9393
$(eval $(call DEF_TARGET_COMMANDS,$(target))))
9494

95-
# Target platform specific variables
95+
# Target platform specific variables
9696
# for arm-linux-androidabi
9797
define DEF_ADB_DEVICE_STATUS
9898
CFG_ADB_DEVICE_STATUS=$(1)
@@ -402,7 +402,7 @@ $(foreach host,$(CFG_HOST_TRIPLES), \
402402
$(eval $(call DEF_TEST_CRATE_RULES_null,$(stage),$(target),$(host),$(crate))) \
403403
), \
404404
$(eval $(call DEF_TEST_CRATE_RULES,$(stage),$(target),$(host),$(crate))) \
405-
))))))
405+
))))))
406406

407407

408408
######################################################################

branches/try2/src/libcore/cell.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ A dynamic, mutable location.
1919
Similar to a mutable option type, but friendlier.
2020
*/
2121

22+
#[mutable]
2223
pub struct Cell<T> {
2324
priv value: Option<T>
2425
}

branches/try2/src/libcore/hashmap.rs

Lines changed: 75 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,16 +352,27 @@ impl<K:Hash + Eq,V> Map<K, V> for HashMap<K, V> {
352352
}
353353
354354
/// Return a mutable reference to the value corresponding to the key
355+
#[cfg(stage0)]
355356
fn find_mut<'a>(&'a mut self, k: &K) -> Option<&'a mut V> {
356357
let idx = match self.bucket_for_key(k) {
357358
FoundEntry(idx) => idx,
358359
TableFull | FoundHole(_) => return None
359360
};
360-
unsafe { // FIXME(#4903)---requires flow-sensitive borrow checker
361+
unsafe {
361362
Some(::cast::transmute_mut_region(self.mut_value_for_bucket(idx)))
362363
}
363364
}
364365
366+
/// Return a mutable reference to the value corresponding to the key
367+
#[cfg(not(stage0))]
368+
fn find_mut<'a>(&'a mut self, k: &K) -> Option<&'a mut V> {
369+
let idx = match self.bucket_for_key(k) {
370+
FoundEntry(idx) => idx,
371+
TableFull | FoundHole(_) => return None
372+
};
373+
Some(self.mut_value_for_bucket(idx))
374+
}
375+
365376
/// Insert a key-value pair into the map. An existing value for a
366377
/// key is replaced by the new value. Return true if the key did
367378
/// not already exist in the map.
@@ -424,6 +435,7 @@ pub impl<K: Hash + Eq, V> HashMap<K, V> {
424435
425436
/// Return the value corresponding to the key in the map, or insert
426437
/// and return the value if it doesn't exist.
438+
#[cfg(stage0)]
427439
fn find_or_insert<'a>(&'a mut self, k: K, v: V) -> &'a V {
428440
if self.size >= self.resize_at {
429441
// n.b.: We could also do this after searching, so
@@ -447,13 +459,43 @@ pub impl<K: Hash + Eq, V> HashMap<K, V> {
447459
},
448460
};
449461
450-
unsafe { // FIXME(#4903)---requires flow-sensitive borrow checker
462+
unsafe {
451463
::cast::transmute_region(self.value_for_bucket(idx))
452464
}
453465
}
454466
467+
/// Return the value corresponding to the key in the map, or insert
468+
/// and return the value if it doesn't exist.
469+
#[cfg(not(stage0))]
470+
fn find_or_insert<'a>(&'a mut self, k: K, v: V) -> &'a V {
471+
if self.size >= self.resize_at {
472+
// n.b.: We could also do this after searching, so
473+
// that we do not resize if this call to insert is
474+
// simply going to update a key in place. My sense
475+
// though is that it's worse to have to search through
476+
// buckets to find the right spot twice than to just
477+
// resize in this corner case.
478+
self.expand();
479+
}
480+
481+
let hash = k.hash_keyed(self.k0, self.k1) as uint;
482+
let idx = match self.bucket_for_key_with_hash(hash, &k) {
483+
TableFull => fail!(~"Internal logic error"),
484+
FoundEntry(idx) => idx,
485+
FoundHole(idx) => {
486+
self.buckets[idx] = Some(Bucket{hash: hash, key: k,
487+
value: v});
488+
self.size += 1;
489+
idx
490+
},
491+
};
492+
493+
self.value_for_bucket(idx)
494+
}
495+
455496
/// Return the value corresponding to the key in the map, or create,
456497
/// insert, and return a new value if it doesn't exist.
498+
#[cfg(stage0)]
457499
fn find_or_insert_with<'a>(&'a mut self, k: K, f: &fn(&K) -> V) -> &'a V {
458500
if self.size >= self.resize_at {
459501
// n.b.: We could also do this after searching, so
@@ -478,11 +520,41 @@ pub impl<K: Hash + Eq, V> HashMap<K, V> {
478520
},
479521
};
480522
481-
unsafe { // FIXME(#4903)---requires flow-sensitive borrow checker
523+
unsafe {
482524
::cast::transmute_region(self.value_for_bucket(idx))
483525
}
484526
}
485527
528+
/// Return the value corresponding to the key in the map, or create,
529+
/// insert, and return a new value if it doesn't exist.
530+
#[cfg(not(stage0))]
531+
fn find_or_insert_with<'a>(&'a mut self, k: K, f: &fn(&K) -> V) -> &'a V {
532+
if self.size >= self.resize_at {
533+
// n.b.: We could also do this after searching, so
534+
// that we do not resize if this call to insert is
535+
// simply going to update a key in place. My sense
536+
// though is that it's worse to have to search through
537+
// buckets to find the right spot twice than to just
538+
// resize in this corner case.
539+
self.expand();
540+
}
541+
542+
let hash = k.hash_keyed(self.k0, self.k1) as uint;
543+
let idx = match self.bucket_for_key_with_hash(hash, &k) {
544+
TableFull => fail!(~"Internal logic error"),
545+
FoundEntry(idx) => idx,
546+
FoundHole(idx) => {
547+
let v = f(&k);
548+
self.buckets[idx] = Some(Bucket{hash: hash, key: k,
549+
value: v});
550+
self.size += 1;
551+
idx
552+
},
553+
};
554+
555+
self.value_for_bucket(idx)
556+
}
557+
486558
fn consume(&mut self, f: &fn(K, V)) {
487559
let mut buckets = ~[];
488560
self.buckets <-> buckets;

branches/try2/src/libcore/rt/io/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ pub enum IoErrorKind {
337337
// XXX: Can't put doc comments on macros
338338
// Raised by `I/O` operations on error.
339339
condition! {
340-
io_error: super::IoError -> ();
340+
// FIXME (#6009): uncomment `pub` after expansion support lands.
341+
/*pub*/ io_error: super::IoError -> ();
341342
}
342343

343344
pub trait Reader {

branches/try2/src/libcore/stackwalk.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,32 +64,20 @@ fn test_simple_deep() {
6464
if i == 0 { return }
6565

6666
for walk_stack |_frame| {
67-
breakpoint();
67+
// Would be nice to test something here...
6868
}
6969
run(i - 1);
7070
}
7171

7272
run(10);
7373
}
7474

75-
fn breakpoint() {
76-
unsafe {
77-
rustrt::rust_dbg_breakpoint()
78-
}
79-
}
80-
8175
fn frame_address(f: &fn(x: *u8)) {
8276
unsafe {
8377
rusti::frame_address(f)
8478
}
8579
}
8680

87-
pub mod rustrt {
88-
pub extern {
89-
pub unsafe fn rust_dbg_breakpoint();
90-
}
91-
}
92-
9381
pub mod rusti {
9482
#[abi = "rust-intrinsic"]
9583
pub extern "rust-intrinsic" {

branches/try2/src/libcore/trie.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,9 +289,9 @@ fn chunk(n: uint, idx: uint) -> uint {
289289
(n >> sh) & MASK
290290
}
291291

292-
fn find_mut<'r, T>(child: &'r mut Child<T>, key: uint, idx: uint)
293-
-> Option<&'r mut T> {
294-
unsafe { // FIXME(#4903)---requires flow-sensitive borrow checker
292+
#[cfg(stage0)]
293+
fn find_mut<'r, T>(child: &'r mut Child<T>, key: uint, idx: uint) -> Option<&'r mut T> {
294+
unsafe {
295295
(match *child {
296296
External(_, ref value) => Some(cast::transmute_mut(value)),
297297
Internal(ref x) => find_mut(cast::transmute_mut(&x.children[chunk(key, idx)]),
@@ -301,6 +301,15 @@ fn find_mut<'r, T>(child: &'r mut Child<T>, key: uint, idx: uint)
301301
}
302302
}
303303

304+
#[cfg(not(stage0))]
305+
fn find_mut<'r, T>(child: &'r mut Child<T>, key: uint, idx: uint) -> Option<&'r mut T> {
306+
match *child {
307+
External(_, ref mut value) => Some(value),
308+
Internal(ref mut x) => find_mut(&mut x.children[chunk(key, idx)], key, idx + 1),
309+
Nothing => None
310+
}
311+
}
312+
304313
fn insert<T>(count: &mut uint, child: &mut Child<T>, key: uint, value: T,
305314
idx: uint) -> Option<T> {
306315
let mut tmp = Nothing;

branches/try2/src/libcore/vec.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ pub fn connect<T:Copy>(v: &[~[T]], sep: &T) -> ~[T] {
991991
* ~~~
992992
*
993993
*/
994-
pub fn foldl<T, U>(z: T, v: &[U], p: &fn(t: T, u: &U) -> T) -> T {
994+
pub fn foldl<'a, T, U>(z: T, v: &'a [U], p: &fn(t: T, u: &'a U) -> T) -> T {
995995
let mut accum = z;
996996
let mut i = 0;
997997
let l = v.len();
@@ -1023,12 +1023,13 @@ pub fn foldl<T, U>(z: T, v: &[U], p: &fn(t: T, u: &U) -> T) -> T {
10231023
* ~~~
10241024
*
10251025
*/
1026-
pub fn foldr<T, U: Copy>(v: &[T], z: U, p: &fn(t: &T, u: U) -> U) -> U {
1027-
let mut accum = z;
1028-
for v.each_reverse |elt| {
1029-
accum = p(elt, accum);
1026+
pub fn foldr<'a, T, U>(v: &'a [T], mut z: U, p: &fn(t: &'a T, u: U) -> U) -> U {
1027+
let mut i = v.len();
1028+
while i > 0 {
1029+
i -= 1;
1030+
z = p(&v[i], z);
10301031
}
1031-
accum
1032+
return z;
10321033
}
10331034
10341035
/**
@@ -1848,7 +1849,7 @@ pub trait ImmutableVector<'self, T> {
18481849
fn last_opt(&self) -> Option<&'self T>;
18491850
fn each_reverse(&self, blk: &fn(&T) -> bool);
18501851
fn eachi_reverse(&self, blk: &fn(uint, &T) -> bool);
1851-
fn foldr<U: Copy>(&self, z: U, p: &fn(t: &T, u: U) -> U) -> U;
1852+
fn foldr<'a, U>(&'a self, z: U, p: &fn(t: &'a T, u: U) -> U) -> U;
18521853
fn map<U>(&self, f: &fn(t: &T) -> U) -> ~[U];
18531854
fn mapi<U>(&self, f: &fn(uint, t: &T) -> U) -> ~[U];
18541855
fn map_r<U>(&self, f: &fn(x: &T) -> U) -> ~[U];
@@ -1921,7 +1922,7 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
19211922

19221923
/// Reduce a vector from right to left
19231924
#[inline]
1924-
fn foldr<U:Copy>(&self, z: U, p: &fn(t: &T, u: U) -> U) -> U {
1925+
fn foldr<'a, U>(&'a self, z: U, p: &fn(t: &'a T, u: U) -> U) -> U {
19251926
foldr(*self, z, p)
19261927
}
19271928

@@ -3304,7 +3305,7 @@ mod tests {
33043305
}
33053306

33063307
#[test]
3307-
fn test_iter_nonempty() {
3308+
fn test_each_nonempty() {
33083309
let mut i = 0;
33093310
for each(~[1, 2, 3]) |v| {
33103311
i += *v;
@@ -3313,7 +3314,7 @@ mod tests {
33133314
}
33143315

33153316
#[test]
3316-
fn test_iteri() {
3317+
fn test_eachi() {
33173318
let mut i = 0;
33183319
for eachi(~[1, 2, 3]) |j, v| {
33193320
if i == 0 { assert!(*v == 1); }

0 commit comments

Comments
 (0)