Skip to content

Commit f0c03bf

Browse files
committed
---
yaml --- r: 155646 b: refs/heads/try2 c: 6adeb6a h: refs/heads/master v: v3
1 parent c91e3b7 commit f0c03bf

File tree

148 files changed

+1142
-1018
lines changed

Some content is hidden

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

148 files changed

+1142
-1018
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: 9115a7353cddb5600cc36c1d37f1722bd0bd71d3
8+
refs/heads/try2: 6adeb6a4a339e1b5c2c7eddb365c57b24d93c281
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/mk/rt.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
# that's per-target so you're allowed to conditionally add files based on the
3636
# target.
3737
################################################################################
38-
NATIVE_LIBS := rust_builtin hoedown uv_support morestack miniz context_switch \
38+
NATIVE_LIBS := rust_builtin hoedown morestack miniz context_switch \
3939
rustrt_native rust_test_helpers
4040

4141
# $(1) is the target triple
@@ -50,7 +50,6 @@ NATIVE_DEPS_hoedown_$(1) := hoedown/src/autolink.c \
5050
hoedown/src/html_smartypants.c \
5151
hoedown/src/stack.c \
5252
hoedown/src/version.c
53-
NATIVE_DEPS_uv_support_$(1) := rust_uv.c
5453
NATIVE_DEPS_miniz_$(1) = miniz.c
5554
NATIVE_DEPS_rust_builtin_$(1) := rust_builtin.c \
5655
rust_android_dummy.c

branches/try2/mk/tests.mk

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,13 @@ ALL_HS := $(filter-out $(S)src/rt/valgrind/valgrind.h \
261261
tidy:
262262
@$(call E, check: formatting)
263263
$(Q)find $(S)src -name '*.r[sc]' \
264-
| grep '^$(S)src/jemalloc' -v \
265-
| grep '^$(S)src/libuv' -v \
266-
| grep '^$(S)src/llvm' -v \
267-
| grep '^$(S)src/gyp' -v \
268-
| grep '^$(S)src/libbacktrace' -v \
269-
| xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
264+
-and -not -regex '^$(S)src/jemalloc.*' \
265+
-and -not -regex '^$(S)src/libuv.*' \
266+
-and -not -regex '^$(S)src/llvm.*' \
267+
-and -not -regex '^$(S)src/gyp.*' \
268+
-and -not -regex '^$(S)src/libbacktrace.*' \
269+
-print0 \
270+
| xargs -0 -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
270271
$(Q)find $(S)src/etc -name '*.py' \
271272
| xargs -n 10 $(CFG_PYTHON) $(S)src/etc/tidy.py
272273
$(Q)find $(S)src/doc -name '*.js' \

branches/try2/src/compiletest/compiletest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
#![crate_type = "bin"]
12-
#![feature(phase, slicing_syntax)]
12+
#![feature(phase)]
1313

1414
#![deny(warnings)]
1515

branches/try2/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ fn check_error_patterns(props: &TestProps,
874874
if done { return; }
875875

876876
let missing_patterns =
877-
props.error_patterns[next_err_idx..];
877+
props.error_patterns.slice(next_err_idx, props.error_patterns.len());
878878
if missing_patterns.len() == 1u {
879879
fatal_proc_rec(format!("error pattern '{}' not found!",
880880
missing_patterns[0]).as_slice(),

branches/try2/src/doc/guide-lifetimes.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -305,21 +305,17 @@ copying.
305305
# Circle(Point, f64), // origin, radius
306306
# Rectangle(Point, Size) // upper-left, dimensions
307307
# }
308-
# static tau: f64 = 6.28;
309308
fn compute_area(shape: &Shape) -> f64 {
310309
match *shape {
311-
Circle(_, radius) => 0.5 * tau * radius * radius,
310+
Circle(_, radius) => std::f64::consts::PI * radius * radius,
312311
Rectangle(_, ref size) => size.w * size.h
313312
}
314313
}
315314
~~~
316315

317316
The first case matches against circles. Here, the pattern extracts the
318317
radius from the shape variant and the action uses it to compute the
319-
area of the circle. (Like any up-to-date engineer, we use the [tau
320-
circle constant][tau] and not that dreadfully outdated notion of pi).
321-
322-
[tau]: http://www.math.utah.edu/~palais/pi.html
318+
area of the circle.
323319

324320
The second match is more interesting. Here we match against a
325321
rectangle and extract its size: but rather than copy the `size`

branches/try2/src/doc/guide.md

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -659,14 +659,12 @@ error: mismatched types: expected `int` but found `()` (expected int but found (
659659
```
660660

661661
We expected an integer, but we got `()`. `()` is pronounced 'unit', and is a
662-
special type in Rust's type system. `()` is different than `null` in other
663-
languages, because `()` is distinct from other types. For example, in C, `null`
664-
is a valid value for a variable of type `int`. In Rust, `()` is _not_ a valid
665-
value for a variable of type `int`. It's only a valid value for variables of
666-
the type `()`, which aren't very useful. Remember how we said statements don't
667-
return a value? Well, that's the purpose of unit in this case. The semicolon
668-
turns any expression into a statement by throwing away its value and returning
669-
unit instead.
662+
special type in Rust's type system. In Rust, `()` is _not_ a valid value for a
663+
variable of type `int`. It's only a valid value for variables of the type `()`,
664+
which aren't very useful. Remember how we said statements don't return a value?
665+
Well, that's the purpose of unit in this case. The semicolon turns any
666+
expression into a statement by throwing away its value and returning unit
667+
instead.
670668

671669
There's one more time in which you won't see a semicolon at the end of a line
672670
of Rust code. For that, we'll need our next concept: functions.
@@ -1680,11 +1678,11 @@ just `int`s.
16801678

16811679
Rust provides a method on these `IoResult<T>`s called `ok()`, which does the
16821680
same thing as our `match` statement, but assuming that we have a valid value.
1683-
If we don't, it will terminate our program. In this case, if we can't get
1684-
input, our program doesn't work, so we're okay with that. In most cases, we
1685-
would want to handle the error case explicitly. The result of `ok()` has a
1686-
method, `expect()`, which allows us to give an error message if this crash
1687-
happens.
1681+
We then call `expect()` on the result, which will terminate our program if we
1682+
don't have a valid value. In this case, if we can't get input, our program
1683+
doesn't work, so we're okay with that. In most cases, we would want to handle
1684+
the error case explicitly. `expect()` allows us to give an error message if
1685+
this crash happens.
16881686

16891687
We will cover the exact details of how all of this works later in the Guide.
16901688
For now, this gives you enough of a basic understanding to work with.
@@ -2030,7 +2028,7 @@ fn main() {
20302028
match cmp(input, secret_number) {
20312029
Less => println!("Too small!"),
20322030
Greater => println!("Too big!"),
2033-
Equal => { println!("You win!"); },
2031+
Equal => println!("You win!"),
20342032
}
20352033
}
20362034
@@ -2727,7 +2725,8 @@ mod hello {
27272725
}
27282726
```
27292727

2730-
This will work:
2728+
Usage of the `pub` keyword is sometimes called 'exporting', because
2729+
we're making the function available for other modules. This will work:
27312730

27322731
```{notrust,ignore}
27332732
$ cargo run
@@ -3291,8 +3290,7 @@ use super::times_four;
32913290

32923291
Because we've made a nested module, we can import functions from the parent
32933292
module by using `super`. Sub-modules are allowed to 'see' private functions in
3294-
the parent. We sometimes call this usage of `use` a 're-export,' because we're
3295-
exporting the name again, somewhere else.
3293+
the parent.
32963294

32973295
We've now covered the basics of testing. Rust's tools are primitive, but they
32983296
work well in the simple cases. There are some Rustaceans working on building

branches/try2/src/doc/reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3828,7 +3828,7 @@ type signature of `print`, and the cast expression in `main`.
38283828
Within the body of an item that has type parameter declarations, the names of
38293829
its type parameters are types:
38303830

3831-
```ignore
3831+
```
38323832
fn map<A: Clone, B: Clone>(f: |A| -> B, xs: &[A]) -> Vec<B> {
38333833
if xs.len() == 0 {
38343834
return vec![];

branches/try2/src/etc/x86.supp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -373,14 +373,6 @@
373373
fun:_ZN4llvm4UsernwEjj
374374
}
375375

376-
{
377-
libuv-0-byte-realloc
378-
Memcheck:Leak
379-
fun:malloc
380-
...
381-
fun:*uv_loop_delete*
382-
}
383-
384376
{
385377
race-or-something-ask-pcwalton-0
386378
Memcheck:Value4
@@ -502,15 +494,3 @@
502494
fun:*
503495
...
504496
}
505-
506-
{
507-
libuv-mac-no-thread-join
508-
Memcheck:Leak
509-
fun:malloc_zone_malloc
510-
fun:_CFRuntimeCreateInstance
511-
fun:CFRunLoopSourceCreate
512-
fun:uv__platform_loop_init
513-
fun:uv__loop_init
514-
fun:uv_loop_new
515-
...
516-
}

branches/try2/src/liballoc/heap.rs

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,15 @@ mod imp {
182182

183183
#[inline]
184184
pub unsafe fn reallocate_inplace(ptr: *mut u8, size: uint, align: uint,
185-
_old_size: uint) -> bool {
185+
old_size: uint) -> bool {
186186
let flags = align_to_flags(align);
187-
je_xallocx(ptr as *mut c_void, size as size_t, 0, flags) == size as size_t
187+
let new_size = je_xallocx(ptr as *mut c_void, size as size_t, 0, flags) as uint;
188+
// checking for failure to shrink is tricky
189+
if size < old_size {
190+
usable_size(size, align) == new_size as uint
191+
} else {
192+
new_size >= size
193+
}
188194
}
189195

190196
#[inline]
@@ -250,9 +256,9 @@ mod imp {
250256
}
251257

252258
#[inline]
253-
pub unsafe fn reallocate_inplace(_ptr: *mut u8, _size: uint, _align: uint,
254-
_old_size: uint) -> bool {
255-
false
259+
pub unsafe fn reallocate_inplace(_ptr: *mut u8, size: uint, _align: uint,
260+
old_size: uint) -> bool {
261+
size == old_size
256262
}
257263

258264
#[inline]
@@ -312,9 +318,9 @@ mod imp {
312318
}
313319

314320
#[inline]
315-
pub unsafe fn reallocate_inplace(_ptr: *mut u8, _size: uint, _align: uint,
316-
_old_size: uint) -> bool {
317-
false
321+
pub unsafe fn reallocate_inplace(_ptr: *mut u8, size: uint, _align: uint,
322+
old_size: uint) -> bool {
323+
size == old_size
318324
}
319325

320326
#[inline]
@@ -335,10 +341,21 @@ mod imp {
335341
}
336342

337343
#[cfg(test)]
338-
mod bench {
344+
mod test {
339345
extern crate test;
340346
use self::test::Bencher;
341347

348+
#[test]
349+
fn basic_reallocate_inplace_noop() {
350+
unsafe {
351+
let size = 4000;
352+
let ptr = heap::allocate(size, 8);
353+
let ret = heap::reallocate_inplace(ptr, size, 8, size);
354+
heap::deallocate(ptr, size, 8);
355+
assert!(ret);
356+
}
357+
}
358+
342359
#[bench]
343360
fn alloc_owned_small(b: &mut Bencher) {
344361
b.iter(|| {

branches/try2/src/libcollections/bitv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ impl Bitv {
194194
if start > self.storage.len() {
195195
start = self.storage.len();
196196
}
197-
let mut iter = self.storage[start..].iter();
197+
let mut iter = self.storage.slice_from(start).iter();
198198
MaskWords {
199199
next_word: iter.next(),
200200
iter: iter,

branches/try2/src/libcollections/btree/map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ struct AbsEntries<T> {
4646
}
4747

4848
/// An iterator over a BTreeMap's entries.
49-
pub struct Entries<'a, K, V> {
49+
pub struct Entries<'a, K: 'a, V: 'a> {
5050
inner: AbsEntries<Traversal<'a, K, V>>
5151
}
5252

5353
/// A mutable iterator over a BTreeMap's entries.
54-
pub struct MutEntries<'a, K, V> {
54+
pub struct MutEntries<'a, K: 'a, V: 'a> {
5555
inner: AbsEntries<MutTraversal<'a, K, V>>
5656
}
5757

branches/try2/src/libcollections/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@
1919
html_root_url = "http://doc.rust-lang.org/master/",
2020
html_playground_url = "http://play.rust-lang.org/")]
2121

22-
#![allow(unknown_features)]
2322
#![feature(macro_rules, managed_boxes, default_type_params, phase, globs)]
24-
#![feature(unsafe_destructor, import_shadowing, slicing_syntax)]
23+
#![feature(unsafe_destructor, import_shadowing)]
2524
#![no_std]
2625

2726
#[phase(plugin, link)] extern crate core;

branches/try2/src/libcollections/ringbuf.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ impl<T> RingBuf<T> {
271271
/// *num = *num - 2;
272272
/// }
273273
/// let b: &[_] = &[&mut 3, &mut 1, &mut 2];
274-
/// assert_eq!(buf.iter_mut().collect::<Vec<&mut int>>()[], b);
274+
/// assert_eq!(buf.iter_mut().collect::<Vec<&mut int>>().as_slice(), b);
275275
/// ```
276276
pub fn iter_mut<'a>(&'a mut self) -> MutItems<'a, T> {
277277
let start_index = raw_index(self.lo, self.elts.len(), 0);
@@ -291,7 +291,7 @@ impl<T> RingBuf<T> {
291291
} else {
292292
// Items to iterate goes from start_index to end_index:
293293
let (empty, elts) = self.elts.split_at_mut(0);
294-
let remaining1 = elts[mut start_index..end_index];
294+
let remaining1 = elts.slice_mut(start_index, end_index);
295295
MutItems { remaining1: remaining1,
296296
remaining2: empty,
297297
nelts: self.nelts }

0 commit comments

Comments
 (0)