Skip to content

Commit a3b8458

Browse files
committed
---
yaml --- r: 58184 b: refs/heads/auto c: 398cd18 h: refs/heads/master v: v3
1 parent aa5938d commit a3b8458

File tree

11 files changed

+68
-129
lines changed

11 files changed

+68
-129
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: db1a274bf54343605c8ac3a38a6c69f7d930192b
17+
refs/heads/auto: 398cd18bfeba5d2c143b4b4e722a16ec9a2de2e8
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/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/auto/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/auto/src/libcore/hashmap.rs

Lines changed: 3 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -352,27 +352,16 @@ 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)]
356355
fn find_mut<'a>(&'a mut self, k: &K) -> Option<&'a mut V> {
357356
let idx = match self.bucket_for_key(k) {
358357
FoundEntry(idx) => idx,
359358
TableFull | FoundHole(_) => return None
360359
};
361-
unsafe {
360+
unsafe { // FIXME(#4903)---requires flow-sensitive borrow checker
362361
Some(::cast::transmute_mut_region(self.mut_value_for_bucket(idx)))
363362
}
364363
}
365364
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-
376365
/// Insert a key-value pair into the map. An existing value for a
377366
/// key is replaced by the new value. Return true if the key did
378367
/// not already exist in the map.
@@ -435,7 +424,6 @@ pub impl<K: Hash + Eq, V> HashMap<K, V> {
435424
436425
/// Return the value corresponding to the key in the map, or insert
437426
/// and return the value if it doesn't exist.
438-
#[cfg(stage0)]
439427
fn find_or_insert<'a>(&'a mut self, k: K, v: V) -> &'a V {
440428
if self.size >= self.resize_at {
441429
// n.b.: We could also do this after searching, so
@@ -459,43 +447,13 @@ pub impl<K: Hash + Eq, V> HashMap<K, V> {
459447
},
460448
};
461449
462-
unsafe {
450+
unsafe { // FIXME(#4903)---requires flow-sensitive borrow checker
463451
::cast::transmute_region(self.value_for_bucket(idx))
464452
}
465453
}
466454
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-
496455
/// Return the value corresponding to the key in the map, or create,
497456
/// insert, and return a new value if it doesn't exist.
498-
#[cfg(stage0)]
499457
fn find_or_insert_with<'a>(&'a mut self, k: K, f: &fn(&K) -> V) -> &'a V {
500458
if self.size >= self.resize_at {
501459
// n.b.: We could also do this after searching, so
@@ -520,41 +478,11 @@ pub impl<K: Hash + Eq, V> HashMap<K, V> {
520478
},
521479
};
522480
523-
unsafe {
481+
unsafe { // FIXME(#4903)---requires flow-sensitive borrow checker
524482
::cast::transmute_region(self.value_for_bucket(idx))
525483
}
526484
}
527485
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-
558486
fn consume(&mut self, f: &fn(K, V)) {
559487
let mut buckets = ~[];
560488
self.buckets <-> buckets;

branches/auto/src/libcore/io.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -868,19 +868,9 @@ impl Reader for *libc::FILE {
868868
assert!(buf_len >= len);
869869

870870
let count = libc::fread(buf_p as *mut c_void, 1u as size_t,
871-
len as size_t, *self) as uint;
872-
if count < len {
873-
match libc::ferror(*self) {
874-
0 => (),
875-
_ => {
876-
error!("error reading buffer");
877-
error!("%s", os::last_os_error());
878-
fail!();
879-
}
880-
}
881-
}
871+
len as size_t, *self);
882872

883-
count
873+
count as uint
884874
}
885875
}
886876
}

branches/auto/src/libcore/task/local_data.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub type LocalDataKey<'self,T> = &'self fn(v: @T);
4949
* Remove a task-local data value from the table, returning the
5050
* reference that was originally created to insert it.
5151
*/
52-
pub unsafe fn local_data_pop<T:Durable>(
52+
pub unsafe fn local_data_pop<T: 'static>(
5353
key: LocalDataKey<T>) -> Option<@T> {
5454

5555
local_pop(Handle::new(), key)
@@ -58,7 +58,7 @@ pub unsafe fn local_data_pop<T:Durable>(
5858
* Retrieve a task-local data value. It will also be kept alive in the
5959
* table until explicitly removed.
6060
*/
61-
pub unsafe fn local_data_get<T:Durable>(
61+
pub unsafe fn local_data_get<T: 'static>(
6262
key: LocalDataKey<T>) -> Option<@T> {
6363

6464
local_get(Handle::new(), key)
@@ -67,7 +67,7 @@ pub unsafe fn local_data_get<T:Durable>(
6767
* Store a value in task-local data. If this key already has a value,
6868
* that value is overwritten (and its destructor is run).
6969
*/
70-
pub unsafe fn local_data_set<T:Durable>(
70+
pub unsafe fn local_data_set<T: 'static>(
7171
key: LocalDataKey<T>, data: @T) {
7272

7373
local_set(Handle::new(), key, data)
@@ -76,7 +76,7 @@ pub unsafe fn local_data_set<T:Durable>(
7676
* Modify a task-local data value. If the function returns 'None', the
7777
* data is removed (and its reference dropped).
7878
*/
79-
pub unsafe fn local_data_modify<T:Durable>(
79+
pub unsafe fn local_data_modify<T: 'static>(
8080
key: LocalDataKey<T>,
8181
modify_fn: &fn(Option<@T>) -> Option<@T>) {
8282

@@ -215,3 +215,12 @@ fn test_tls_cleanup_on_failure() {
215215
fail!();
216216
}
217217
}
218+
219+
#[test]
220+
fn test_static_pointer() {
221+
unsafe {
222+
fn key(_x: @&'static int) { }
223+
static VALUE: int = 0;
224+
local_data_set(key, @&VALUE);
225+
}
226+
}

branches/auto/src/libcore/task/local_data_priv.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl Handle {
4444
}
4545

4646
pub trait LocalData { }
47-
impl<T:Durable> LocalData for @T { }
47+
impl<T: 'static> LocalData for @T { }
4848

4949
impl Eq for @LocalData {
5050
fn eq(&self, other: &@LocalData) -> bool {
@@ -131,15 +131,15 @@ unsafe fn get_newsched_local_map(local: *mut LocalStorage) -> TaskLocalMap {
131131
}
132132
}
133133

134-
unsafe fn key_to_key_value<T:Durable>(key: LocalDataKey<T>) -> *libc::c_void {
134+
unsafe fn key_to_key_value<T: 'static>(key: LocalDataKey<T>) -> *libc::c_void {
135135
// Keys are closures, which are (fnptr,envptr) pairs. Use fnptr.
136136
// Use reintepret_cast -- transmute would leak (forget) the closure.
137137
let pair: (*libc::c_void, *libc::c_void) = cast::transmute_copy(&key);
138138
pair.first()
139139
}
140140

141141
// If returning Some(..), returns with @T with the map's reference. Careful!
142-
unsafe fn local_data_lookup<T:Durable>(
142+
unsafe fn local_data_lookup<T: 'static>(
143143
map: TaskLocalMap, key: LocalDataKey<T>)
144144
-> Option<(uint, *libc::c_void)> {
145145

@@ -157,7 +157,7 @@ unsafe fn local_data_lookup<T:Durable>(
157157
}
158158
}
159159

160-
unsafe fn local_get_helper<T:Durable>(
160+
unsafe fn local_get_helper<T: 'static>(
161161
handle: Handle, key: LocalDataKey<T>,
162162
do_pop: bool) -> Option<@T> {
163163

@@ -179,21 +179,21 @@ unsafe fn local_get_helper<T:Durable>(
179179
}
180180

181181

182-
pub unsafe fn local_pop<T:Durable>(
182+
pub unsafe fn local_pop<T: 'static>(
183183
handle: Handle,
184184
key: LocalDataKey<T>) -> Option<@T> {
185185

186186
local_get_helper(handle, key, true)
187187
}
188188

189-
pub unsafe fn local_get<T:Durable>(
189+
pub unsafe fn local_get<T: 'static>(
190190
handle: Handle,
191191
key: LocalDataKey<T>) -> Option<@T> {
192192

193193
local_get_helper(handle, key, false)
194194
}
195195

196-
pub unsafe fn local_set<T:Durable>(
196+
pub unsafe fn local_set<T: 'static>(
197197
handle: Handle, key: LocalDataKey<T>, data: @T) {
198198

199199
let map = get_local_map(handle);
@@ -225,7 +225,7 @@ pub unsafe fn local_set<T:Durable>(
225225
}
226226
}
227227

228-
pub unsafe fn local_modify<T:Durable>(
228+
pub unsafe fn local_modify<T: 'static>(
229229
handle: Handle, key: LocalDataKey<T>,
230230
modify_fn: &fn(Option<@T>) -> Option<@T>) {
231231

branches/auto/src/libcore/trie.rs

Lines changed: 3 additions & 12 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-
#[cfg(stage0)]
293-
fn find_mut<'r, T>(child: &'r mut Child<T>, key: uint, idx: uint) -> Option<&'r mut T> {
294-
unsafe {
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
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,15 +301,6 @@ fn find_mut<'r, T>(child: &'r mut Child<T>, key: uint, idx: uint) -> Option<&'r
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-
313304
fn insert<T>(count: &mut uint, child: &mut Child<T>, key: uint, value: T,
314305
idx: uint) -> Option<T> {
315306
let mut tmp = Nothing;

branches/auto/src/libcore/vec.rs

Lines changed: 8 additions & 9 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<'a, T, U>(z: T, v: &'a [U], p: &fn(t: T, u: &'a U) -> T) -> T {
994+
pub fn foldl<T, U>(z: T, v: &[U], p: &fn(t: T, u: &U) -> T) -> T {
995995
let mut accum = z;
996996
let mut i = 0;
997997
let l = v.len();
@@ -1023,13 +1023,12 @@ pub fn foldl<'a, T, U>(z: T, v: &'a [U], p: &fn(t: T, u: &'a U) -> T) -> T {
10231023
* ~~~
10241024
*
10251025
*/
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);
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);
10311030
}
1032-
return z;
1031+
accum
10331032
}
10341033
10351034
/**
@@ -1849,7 +1848,7 @@ pub trait ImmutableVector<'self, T> {
18491848
fn last_opt(&self) -> Option<&'self T>;
18501849
fn each_reverse(&self, blk: &fn(&T) -> bool);
18511850
fn eachi_reverse(&self, blk: &fn(uint, &T) -> bool);
1852-
fn foldr<'a, U>(&'a self, z: U, p: &fn(t: &'a T, u: U) -> U) -> U;
1851+
fn foldr<U: Copy>(&self, z: U, p: &fn(t: &T, u: U) -> U) -> U;
18531852
fn map<U>(&self, f: &fn(t: &T) -> U) -> ~[U];
18541853
fn mapi<U>(&self, f: &fn(uint, t: &T) -> U) -> ~[U];
18551854
fn map_r<U>(&self, f: &fn(x: &T) -> U) -> ~[U];
@@ -1922,7 +1921,7 @@ impl<'self,T> ImmutableVector<'self, T> for &'self [T] {
19221921

19231922
/// Reduce a vector from right to left
19241923
#[inline]
1925-
fn foldr<'a, U>(&'a self, z: U, p: &fn(t: &'a T, u: U) -> U) -> U {
1924+
fn foldr<U:Copy>(&self, z: U, p: &fn(t: &T, u: U) -> U) -> U {
19261925
foldr(*self, z, p)
19271926
}
19281927

0 commit comments

Comments
 (0)