Skip to content

Commit 7b23d12

Browse files
committed
---
yaml --- r: 107663 b: refs/heads/dist-snap c: 0aef487 h: refs/heads/master i: 107661: 8e52f45 107659: 7d735c8 107655: 779aa39 107647: 5eca07d v: v3
1 parent b7a8f60 commit 7b23d12

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+617
-645
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: f64fdf524a434f0e5cd0bc91d09c144723f3c90d
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: e139b49eef62618f7894fde57a54b4d6642fbef8
9+
refs/heads/dist-snap: 0aef487a5c2797b34e64ddcfa3974264fbc9830b
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/doc/guide-ffi.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -303,15 +303,15 @@ which would call back to `callback()` in Rust.
303303

304304
## Targetting callbacks to Rust objects
305305

306-
The former example showed how a global function can be called from C code.
306+
The former example showed how a global function can be called from C-Code.
307307
However it is often desired that the callback is targetted to a special
308308
Rust object. This could be the object that represents the wrapper for the
309309
respective C object.
310310

311311
This can be achieved by passing an unsafe pointer to the object down to the
312312
C library. The C library can then include the pointer to the Rust object in
313-
the notification. This will allow the callback to unsafely access the
314-
referenced Rust object.
313+
the notification. This will provide a unsafe possibility to access the
314+
referenced Rust object in callback.
315315

316316
Rust code:
317317
~~~~ {.xfail-test}
@@ -364,25 +364,25 @@ void trigger_callback() {
364364

365365
## Asynchronous callbacks
366366

367-
In the previously given examples the callbacks are invoked as a direct reaction
367+
In the already given examples the callbacks are invoked as a direct reaction
368368
to a function call to the external C library.
369-
The control over the current thread is switched from Rust to C to Rust for the
369+
The control over the current thread switched from Rust to C to Rust for the
370370
execution of the callback, but in the end the callback is executed on the
371371
same thread (and Rust task) that lead called the function which triggered
372372
the callback.
373373

374-
Things get more complicated when the external library spawns its own threads
374+
Things get more complicated when the external library spawns it's own threads
375375
and invokes callbacks from there.
376-
In these cases access to Rust data structures inside the callbacks is
376+
In these cases access to Rust data structures inside he callbacks is
377377
especially unsafe and proper synchronization mechanisms must be used.
378-
Besides classical synchronization mechanisms like mutexes, one possibility in
378+
Besides classical synchronization mechanisms like mutexes one possibility in
379379
Rust is to use channels (in `std::comm`) to forward data from the C thread
380380
that invoked the callback into a Rust task.
381381

382382
If an asychronous callback targets a special object in the Rust address space
383383
it is also absolutely necessary that no more callbacks are performed by the
384-
C library after the respective Rust object gets destroyed.
385-
This can be achieved by unregistering the callback in the object's
384+
C library after the respective Rust object get's destroyed.
385+
This can be achieved by unregistering the callback it the object's
386386
destructor and designing the library in a way that guarantees that no
387387
callback will be performed after unregistration.
388388

branches/dist-snap/doc/guide-lifetimes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ example:
597597
# }
598598
// -+ r
599599
fn select_based_on_unit_circle<'r, T>( // |-+ B
600-
threshold: f64, a: &'r T, b: &'r T) -> &'r T { // | |
600+
threshold: f64, a: &'r T, b: &'r T) -> &'r T { // | |
601601
// | |
602602
let shape = Circle(Point {x: 0., y: 0.}, 1.); // | |
603603
select(&shape, threshold, a, b) // | |

branches/dist-snap/src/libextra/arena.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ mod test {
504504
#[test]
505505
pub fn test_pod() {
506506
let arena = TypedArena::new();
507-
for _ in range(0, 100000) {
507+
for _ in range(0, 1000000) {
508508
arena.alloc(Point {
509509
x: 1,
510510
y: 2,
@@ -558,7 +558,7 @@ mod test {
558558
#[test]
559559
pub fn test_nonpod() {
560560
let arena = TypedArena::new();
561-
for _ in range(0, 100000) {
561+
for _ in range(0, 1000000) {
562562
arena.alloc(Nonpod {
563563
string: ~"hello world",
564564
array: ~[ 1, 2, 3, 4, 5 ],

branches/dist-snap/src/libextra/bitv.rs

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -121,8 +121,8 @@ struct BigBitv {
121121
*/
122122
#[inline]
123123
fn big_mask(nbits: uint, elem: uint) -> uint {
124-
let rmd = nbits % uint::BITS;
125-
let nelems = nbits/uint::BITS + if rmd == 0 {0} else {1};
124+
let rmd = nbits % uint::bits;
125+
let nelems = nbits/uint::bits + if rmd == 0 {0} else {1};
126126

127127
if elem < nelems - 1 || rmd == 0 {
128128
!0
@@ -192,16 +192,16 @@ impl BigBitv {
192192

193193
#[inline]
194194
pub fn get(&self, i: uint) -> bool {
195-
let w = i / uint::BITS;
196-
let b = i % uint::BITS;
195+
let w = i / uint::bits;
196+
let b = i % uint::bits;
197197
let x = 1 & self.storage[w] >> b;
198198
x == 1
199199
}
200200

201201
#[inline]
202202
pub fn set(&mut self, i: uint, x: bool) {
203-
let w = i / uint::BITS;
204-
let b = i % uint::BITS;
203+
let w = i / uint::bits;
204+
let b = i % uint::bits;
205205
let flag = 1 << b;
206206
self.storage[w] = if x { self.storage[w] | flag }
207207
else { self.storage[w] & !flag };
@@ -269,20 +269,20 @@ impl Bitv {
269269

270270
impl Bitv {
271271
pub fn new(nbits: uint, init: bool) -> Bitv {
272-
let rep = if nbits < uint::BITS {
272+
let rep = if nbits < uint::bits {
273273
Small(SmallBitv::new(if init {(1<<nbits)-1} else {0}))
274-
} else if nbits == uint::BITS {
274+
} else if nbits == uint::bits {
275275
Small(SmallBitv::new(if init {!0} else {0}))
276276
} else {
277-
let exact = nbits % uint::BITS == 0;
278-
let nelems = nbits/uint::BITS + if exact {0} else {1};
277+
let exact = nbits % uint::bits == 0;
278+
let nelems = nbits/uint::bits + if exact {0} else {1};
279279
let s =
280280
if init {
281281
if exact {
282282
vec::from_elem(nelems, !0u)
283283
} else {
284284
let mut v = vec::from_elem(nelems-1, !0u);
285-
v.push((1<<nbits % uint::BITS)-1);
285+
v.push((1<<nbits % uint::bits)-1);
286286
v
287287
}
288288
} else { vec::from_elem(nelems, 0u)};
@@ -576,7 +576,7 @@ fn iterate_bits(base: uint, bits: uint, f: |uint| -> bool) -> bool {
576576
if bits == 0 {
577577
return true;
578578
}
579-
for i in range(0u, uint::BITS) {
579+
for i in range(0u, uint::bits) {
580580
if bits & (1 << i) != 0 {
581581
if !f(base + i) {
582582
return false;
@@ -680,7 +680,7 @@ impl BitvSet {
680680

681681
/// Returns the capacity in bits for this bit vector. Inserting any
682682
/// element less than this amount will not trigger a resizing.
683-
pub fn capacity(&self) -> uint { self.bitv.storage.len() * uint::BITS }
683+
pub fn capacity(&self) -> uint { self.bitv.storage.len() * uint::bits }
684684

685685
/// Consumes this set to return the underlying bit vector
686686
pub fn unwrap(self) -> Bitv {
@@ -693,7 +693,7 @@ impl BitvSet {
693693
fn other_op(&mut self, other: &BitvSet, f: |uint, uint| -> uint) {
694694
fn nbits(mut w: uint) -> uint {
695695
let mut bits = 0;
696-
for _ in range(0u, uint::BITS) {
696+
for _ in range(0u, uint::bits) {
697697
if w == 0 {
698698
break;
699699
}
@@ -703,7 +703,7 @@ impl BitvSet {
703703
return bits;
704704
}
705705
if self.capacity() < other.capacity() {
706-
self.bitv.storage.grow(other.capacity() / uint::BITS, &0);
706+
self.bitv.storage.grow(other.capacity() / uint::bits, &0);
707707
}
708708
for (i, &w) in other.bitv.storage.iter().enumerate() {
709709
let old = self.bitv.storage[i];
@@ -808,7 +808,7 @@ impl Mutable for BitvSet {
808808

809809
impl Set<uint> for BitvSet {
810810
fn contains(&self, value: &uint) -> bool {
811-
*value < self.bitv.storage.len() * uint::BITS && self.bitv.get(*value)
811+
*value < self.bitv.storage.len() * uint::bits && self.bitv.get(*value)
812812
}
813813

814814
fn is_disjoint(&self, other: &BitvSet) -> bool {
@@ -846,7 +846,7 @@ impl MutableSet<uint> for BitvSet {
846846
}
847847
let nbits = self.capacity();
848848
if value >= nbits {
849-
let newsize = num::max(value, nbits * 2) / uint::BITS + 1;
849+
let newsize = num::max(value, nbits * 2) / uint::bits + 1;
850850
assert!(newsize > self.bitv.storage.len());
851851
self.bitv.storage.grow(newsize, &0);
852852
}
@@ -884,7 +884,7 @@ impl BitvSet {
884884
let min = num::min(self.bitv.storage.len(), other.bitv.storage.len());
885885
self.bitv.storage.slice(0, min).iter().enumerate()
886886
.zip(Repeat::new(&other.bitv.storage))
887-
.map(|((i, &w), o_store)| (i * uint::BITS, w, o_store[i]))
887+
.map(|((i, &w), o_store)| (i * uint::bits, w, o_store[i]))
888888
}
889889

890890
/// Visits each word in `self` or `other` that extends beyond the other. This
@@ -903,11 +903,11 @@ impl BitvSet {
903903
if olen < slen {
904904
self.bitv.storage.slice_from(olen).iter().enumerate()
905905
.zip(Repeat::new(olen))
906-
.map(|((i, &w), min)| (true, (i + min) * uint::BITS, w))
906+
.map(|((i, &w), min)| (true, (i + min) * uint::bits, w))
907907
} else {
908908
other.bitv.storage.slice_from(slen).iter().enumerate()
909909
.zip(Repeat::new(slen))
910-
.map(|((i, &w), min)| (false, (i + min) * uint::BITS, w))
910+
.map(|((i, &w), min)| (false, (i + min) * uint::bits, w))
911911
}
912912
}
913913
}
@@ -1529,7 +1529,7 @@ mod tests {
15291529

15301530
assert!(a.insert(1000));
15311531
assert!(a.remove(&1000));
1532-
assert_eq!(a.capacity(), uint::BITS);
1532+
assert_eq!(a.capacity(), uint::bits);
15331533
}
15341534

15351535
#[test]
@@ -1561,16 +1561,16 @@ mod tests {
15611561
let mut r = rng();
15621562
let mut bitv = 0 as uint;
15631563
b.iter(|| {
1564-
bitv |= (1 << ((r.next_u32() as uint) % uint::BITS));
1564+
bitv |= (1 << ((r.next_u32() as uint) % uint::bits));
15651565
})
15661566
}
15671567

15681568
#[bench]
15691569
fn bench_small_bitv_small(b: &mut BenchHarness) {
15701570
let mut r = rng();
1571-
let mut bitv = SmallBitv::new(uint::BITS);
1571+
let mut bitv = SmallBitv::new(uint::bits);
15721572
b.iter(|| {
1573-
bitv.set((r.next_u32() as uint) % uint::BITS, true);
1573+
bitv.set((r.next_u32() as uint) % uint::bits, true);
15741574
})
15751575
}
15761576

@@ -1579,15 +1579,15 @@ mod tests {
15791579
let mut r = rng();
15801580
let mut bitv = BigBitv::new(~[0]);
15811581
b.iter(|| {
1582-
bitv.set((r.next_u32() as uint) % uint::BITS, true);
1582+
bitv.set((r.next_u32() as uint) % uint::bits, true);
15831583
})
15841584
}
15851585

15861586
#[bench]
15871587
fn bench_big_bitv_big(b: &mut BenchHarness) {
15881588
let mut r = rng();
15891589
let mut storage = ~[];
1590-
storage.grow(BENCH_BITS / uint::BITS, &0u);
1590+
storage.grow(BENCH_BITS / uint::bits, &0u);
15911591
let mut bitv = BigBitv::new(storage);
15921592
b.iter(|| {
15931593
bitv.set((r.next_u32() as uint) % BENCH_BITS, true);
@@ -1606,9 +1606,9 @@ mod tests {
16061606
#[bench]
16071607
fn bench_bitv_small(b: &mut BenchHarness) {
16081608
let mut r = rng();
1609-
let mut bitv = Bitv::new(uint::BITS, false);
1609+
let mut bitv = Bitv::new(uint::bits, false);
16101610
b.iter(|| {
1611-
bitv.set((r.next_u32() as uint) % uint::BITS, true);
1611+
bitv.set((r.next_u32() as uint) % uint::bits, true);
16121612
})
16131613
}
16141614

@@ -1617,7 +1617,7 @@ mod tests {
16171617
let mut r = rng();
16181618
let mut bitv = BitvSet::new();
16191619
b.iter(|| {
1620-
bitv.insert((r.next_u32() as uint) % uint::BITS);
1620+
bitv.insert((r.next_u32() as uint) % uint::bits);
16211621
})
16221622
}
16231623

@@ -1641,7 +1641,7 @@ mod tests {
16411641

16421642
#[bench]
16431643
fn bench_btv_small_iter(b: &mut BenchHarness) {
1644-
let bitv = Bitv::new(uint::BITS, false);
1644+
let bitv = Bitv::new(uint::bits, false);
16451645
b.iter(|| {
16461646
let mut _sum = 0;
16471647
for pres in bitv.iter() {

branches/dist-snap/src/libextra/btree.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
///number of elements that a given node can contain.
2323
#[allow(missing_doc)]
2424
pub struct BTree<K, V> {
25-
root: Node<K, V>,
26-
len: uint,
27-
lower_bound: uint,
28-
upper_bound: uint
25+
priv root: Node<K, V>,
26+
priv len: uint,
27+
priv lower_bound: uint,
28+
priv upper_bound: uint
2929
}
3030

3131
//We would probably want to remove the dependence on the Clone trait in the future.
@@ -47,9 +47,9 @@ impl<K: TotalOrd, V> BTree<K, V> {
4747

4848
///Helper function for clone: returns new BTree with supplied root node,
4949
///length, and lower bound. For use when the length is known already.
50-
pub fn new_with_node_len(n: Node<K, V>,
51-
length: uint,
52-
lb: uint) -> BTree<K, V> {
50+
fn new_with_node_len(n: Node<K, V>,
51+
length: uint,
52+
lb: uint) -> BTree<K, V> {
5353
BTree {
5454
root: n,
5555
len: length,
@@ -590,4 +590,3 @@ mod test_btree {
590590
}
591591

592592
}
593-

branches/dist-snap/src/libextra/ebml.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -364,7 +364,7 @@ pub mod reader {
364364
fn read_u8 (&mut self) -> u8 { doc_as_u8 (self.next_doc(EsU8 )) }
365365
fn read_uint(&mut self) -> uint {
366366
let v = doc_as_u64(self.next_doc(EsUint));
367-
if v > (::std::uint::MAX as u64) {
367+
if v > (::std::uint::max_value as u64) {
368368
fail!("uint {} too large for this architecture", v);
369369
}
370370
v as uint
@@ -384,7 +384,7 @@ pub mod reader {
384384
}
385385
fn read_int(&mut self) -> int {
386386
let v = doc_as_u64(self.next_doc(EsInt)) as i64;
387-
if v > (int::MAX as i64) || v < (int::MIN as i64) {
387+
if v > (int::max_value as i64) || v < (int::min_value as i64) {
388388
debug!("FIXME \\#6122: Removing this makes this function miscompile");
389389
fail!("int {} out of range for this architecture", v);
390390
}

branches/dist-snap/src/libextra/getopts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -848,7 +848,7 @@ pub mod groups {
848848
t("hello", 15, [~"hello"]);
849849
t("\nMary had a little lamb\nLittle lamb\n", 15,
850850
[~"Mary had a", ~"little lamb", ~"Little lamb"]);
851-
t("\nMary had a little lamb\nLittle lamb\n", ::std::uint::MAX,
851+
t("\nMary had a little lamb\nLittle lamb\n", ::std::uint::max_value,
852852
[~"Mary had a little lamb\nLittle lamb"]);
853853
}
854854
} // end groups module

0 commit comments

Comments
 (0)