Commit Graph

21916 Commits

Author SHA1 Message Date
Corey Richardson
d7be86f1a5 Revert "src/test/bench: restructure"
This reverts commit 14cdc26e8a.
2013-08-30 16:17:53 -04:00
Corey Richardson
f585767fba Revert "Teach compiletest to use multiple --src-base's"
This reverts commit 8a07f57081.
2013-08-30 16:17:32 -04:00
Corey Richardson
fdcc415957 Revert "Teach the makefile to use multiple src-base's"
This reverts commit 43f851d2cb.
2013-08-30 16:17:29 -04:00
bors
116c034791 auto merge of #8878 : toqueteos/rust/patch-1, r=sanxiyn
As promised on #8876.
2013-08-30 12:55:39 -07:00
blake2-ppc
43ef5ad184 std::select: Use correct indices from the front
Caught a bug where .enumerate() was used on a reverse iterator. The
indices should be counted from the front here (bblum confirms).
2013-08-30 20:06:26 +02:00
blake2-ppc
46a6dbc541 std::str: Use reverse enumerate and .rposition
Simplify code by using the reversibility of enumerate and use
.rposition().
2013-08-30 20:06:26 +02:00
blake2-ppc
db22f2627d std: Implement .rposition() on double-ended iterators with known size
This is a generalization of the vector .rposition() method, to all
double-ended iterators that have the ExactSizeHint trait.

This resolves the slight asymmetry around `position` and `rposition`

* position from front is `vec.iter().position()`
* position from the back was, `vec.rposition()` is now `vec.iter().rposition()`

Additionally, other indexed sequences (only `extra::ringbuf` I think),
will have the same method available once it implements ExactSizeHint.
2013-08-30 20:06:26 +02:00
blake2-ppc
e7955b2a7d std::iterator: Add tests for .next_back() on Zip and Enumerate 2013-08-30 20:06:26 +02:00
blake2-ppc
ed607dd24a std::iterator: Implement .next_back() for Zip
Let Zip be double-ended when both its children have the ExactSizeHint
trait.
2013-08-30 20:06:26 +02:00
blake2-ppc
4b2cc22031 std::iterator: Introduce trait ExactSizeHint
The trait `ExactSizeHint` is introduced to solve a few small niggles:

* We can't reverse (`.invert()`) an enumeration iterator
* for a vector, we have `v.iter().position(f)` but `v.rposition(f)`.
* We can't reverse `Zip` even if both iterators are from vectors

`ExactSizeHint` is an empty trait that is intended to indicate that an
iterator, for example `VecIterator`, knows its exact finite size and
reports it correctly using `.size_hint()`. Only adaptors that preserve
this at all times, can expose this trait further. (Where here we say
finite for fitting in uint).
2013-08-30 20:03:40 +02:00
bors
0553618e08 auto merge of #8858 : blake2-ppc/rust/small-bugs, r=alexcrichton
Fix a bug in `s.slice_chars(a, b)` that did not accept `a == s.len()`.

Fix a bug in `!=` defined for DList.

Also simplify NormalizationIterator to use the CharIterator directly instead of mimicing the iteration itself.
2013-08-30 11:00:43 -07:00
bors
7077aefb10 auto merge of #8877 : bouk/rust/master, r=sanxiyn
Ran into a missing space in the stdlib source
2013-08-30 09:45:39 -07:00
bors
8e3efc112f auto merge of #8872 : MicahChalmer/rust/emacs-indent-fix, r=pnkfelix
This fixes some, but not all, of the issues mentioned in #8787
2013-08-30 08:40:46 -07:00
bors
f9142536a6 auto merge of #8869 : alexcrichton/rust/issue-8847-fix-unused, r=huonw
Closes #8847
2013-08-30 07:35:40 -07:00
bors
0ac3e023d8 auto merge of #8867 : thestinger/rust/smaller-arc, r=alexcrichton 2013-08-30 05:45:45 -07:00
bors
1f9bd62fd6 auto merge of #8857 : blake2-ppc/rust/std-str-remove, r=thestinger
These are very easy to replace with methods on string slices, basically
`.char_len()` and `.len()`.

These are the replacement implementations I did to clean these
functions up, but seeing this I propose removal:

/// ...
pub fn count_chars(s: &str, begin: uint, end: uint) -> uint {
    // .slice() checks the char boundaries
    s.slice(begin, end).char_len()
}

/// Counts the number of bytes taken by the first `n` chars in `s`
/// starting from byte index `begin`.
///
/// Fails if there are less than `n` chars past `begin`
pub fn count_bytes<'b>(s: &'b str, begin: uint, n: uint) -> uint {
    s.slice_from(begin).slice_chars(0, n).len()
}
2013-08-30 04:40:47 -07:00
Carlos
c7a269fedc doc/rust.md: Missing in keyword on keyword list. 2013-08-30 13:21:14 +02:00
Bouke van der Bijl
a2ffceaedd Add missing space 2013-08-30 12:53:05 +02:00
bors
72bf895629 auto merge of #8854 : huonw/rust/rt-papercuts, r=brson
The only user-facing change is handling non-integer (and zero) `RUST_THREADS` more nicely:

```
$ RUST_THREADS=x rustc # old

You've met with a terrible fate, haven't you?

fatal runtime error: runtime tls key not initialized
Aborted
$ RUST_THREADS=x ./x86_64-unknown-linux-gnu/stage2/bin/rustc # new

You've met with a terrible fate, haven't you?

fatal runtime error: `RUST_THREADS` is `x`, should be a positive integer
Aborted
```

The other changes are converting some `for .. in range(x,y)` to `vec::from_fn` or `for .. in x.iter()` as appropriate; and removing a chain of (seemingly) unnecessary pointer casts.

(Also, fixes a typo in `extra::test` from #8823.)
2013-08-30 03:30:43 -07:00
bors
f10e50a4be auto merge of #8843 : alexcrichton/rust/fix-bug, r=huonw
Whenever a generic function was encountered, only the top-level items were
recursed upon, even though the function could contain items inside blocks or
nested inside of other expressions. This fixes the existing code from traversing
just the top level items to using a Visitor to deeply recurse and find any items
which need to be translated.

This was uncovered when building code with --lib, because the encode_symbol
function would panic once it found that an item hadn't been translated.

Closes #8134
2013-08-30 02:25:47 -07:00
bors
f94844c558 auto merge of #8820 : alexcrichton/rust/no-io-writer, r=brson
At the same time, this updates the TyVisitor to use a mutable self because it's
probably going to be mutating state as it goes along anyway.
2013-08-30 01:20:44 -07:00
bors
974f854bb5 auto merge of #8839 : sanxiyn/rust/env, r=thestinger 2013-08-30 00:15:47 -07:00
Micah Chalmer
7a42dd8074 Align field names in struct expressions with fields on same line as the opening curly brace 2013-08-30 02:04:08 -04:00
Micah Chalmer
70bc1637b8 Multiline comments with leading *s line up the *s 2013-08-30 02:04:01 -04:00
Kevin Ballard
a3d18bc95b Make Zip iterator short-circuit
Python's zip() short-circuits by not even querying its right-hand
iterator if the left-hand one is done. Match that behavior here by not
calling .next() on the right iterator if the left one returns None.
2013-08-29 22:49:26 -07:00
Kevin Ballard
fb0b388804 Make the iterator protocol more explicit
Document the fact that the iterator protocol only defines behavior up
until the first None is returned. After this point, iterators are free
to behave how they wish.

Add a new iterator adaptor Fuse<T> that modifies iterators to return
None forever if they returned None once.
2013-08-29 22:49:26 -07:00
bors
ed422b8872 auto merge of #8819 : vadimcn/rust/unit-tests, r=brson
Some of the tests are failing.  I've only managed to fix 'memory_map_file', the rest are up for grabs...

Fixes #5261.
2013-08-29 20:40:47 -07:00
Micah Chalmer
0b9dc80d49 One indent after open paren with no argument 2013-08-29 23:28:36 -04:00
Micah Chalmer
20def31768 Correct indent with trailing spaces/comments on previous line 2013-08-29 23:12:08 -04:00
Alex Crichton
6409f6bcf1 Correct the sources of glob imports
Closes #8847
2013-08-29 19:54:10 -07:00
Alex Crichton
2c1d6568f2 Fix a bug with statics inside blocks in generic fns
Whenever a generic function was encountered, only the top-level items were
recursed upon, even though the function could contain items inside blocks or
nested inside of other expressions. This fixes the existing code from traversing
just the top level items to using a Visitor to deeply recurse and find any items
which need to be translated.

This was uncovered when building code with --lib, because the encode_symbol
function would panic once it found that an item hadn't been translated.

Closes #8134
2013-08-29 18:51:29 -07:00
bors
7c6c7519a7 auto merge of #8458 : cmr/rust/test-restructure, r=brson
This should make benchmarks easier to understand. But, it doesn't work.
BENCH_RS in mk/tests.mk has everything, from what I can tell in remake, but
only those that are direct children of src/test/bench get build and run.
@graydon, can you lend your expertise? I can't make heads or tails of this
makefile.
2013-08-29 18:45:47 -07:00
Daniel Micay
05bb4c4e1b reduce the size of UnsafeArc from 2 words to 1 2013-08-29 20:29:02 -04:00
bors
5ef8cdb8fd auto merge of #8866 : brson/rust/rvstdrun, r=alexcrichton
...ing, r=brson"

This reverts commit b8d1fa3994, reversing
changes made to f22b4b1698.

Conflicts:
	mk/rt.mk
	src/libuv

This caused a big performance regression on the windows bots and possibly some unexpected segfaults in pretty-printing tests.
2013-08-29 16:45:49 -07:00
David Creswick
b9601c48a5 partial revert of 31fa865
Ratio is generic and so might contain a non-total orderable type. It
should not use the default Ord implementation.
2013-08-29 17:52:22 -05:00
Brian Anderson
3c5a43e5b6 Revert "auto merge of #8645 : alexcrichton/rust/issue-6436-run-non-blocking, r=brson"
This reverts commit b8d1fa3994, reversing
changes made to f22b4b1698.

Conflicts:
	mk/rt.mk
	src/libuv
2013-08-29 14:23:44 -07:00
bors
698873e3a8 auto merge of #8848 : ILyoan/rust/mk_libuv, r=cmr 2013-08-29 13:05:47 -07:00
David Creswick
31fa86511c drop some redundant Ord method implementations 2013-08-29 14:24:24 -05:00
bors
a6835dd3cb auto merge of #8842 : jfager/rust/remove-iter-module, r=pnkfelix
Moves the Times trait to num while the question of whether it should
exist at all gets hashed out as a completely separate question.
2013-08-29 11:10:47 -07:00
bors
58c3fa92ed auto merge of #8840 : alexcrichton/rust/update-vendors, r=cmr
The LLVM update includes patches from #8488 by @klutzy to build llvm on mingw-64 and also to enable segmented stacks on that platform.

The libuv patch is a rebase on the now-current joyent/master in order to fix #8829
2013-08-29 09:50:48 -07:00
blake2-ppc
15bb9b4e1a extra::dlist: Fix bug in Eq::ne 2013-08-29 17:11:11 +02:00
blake2-ppc
479aefb670 std::str: Fix bug in .slice_chars()
`s.slice_chars(a, b)` did not allow the case where `a == s.len()`, this
is a bug I introduced last time I touched the method; add a test for
this case.
2013-08-29 17:11:11 +02:00
blake2-ppc
d8801ceabc std::str: Use CharIterator in NormalizationIterator
Just to simplify and not have the iteration logic repeated in multiple places.
2013-08-29 17:11:11 +02:00
blake2-ppc
b656bfaaa9 std::str: Remove functions count_chars, count_bytes
These are very easy to replace with methods on string slices, basically
`.char_len()` and `.len()`.

These are the replacement implementations I did to clean these
functions up, but seeing this I propose removal:

/// ...
pub fn count_chars(s: &str, begin: uint, end: uint) -> uint {
    // .slice() checks the char boundaries
    s.slice(begin, end).char_len()
}

/// Counts the number of bytes taken by the first `n` chars in `s`
/// starting from byte index `begin`.
///
/// Fails if there are less than `n` chars past `begin`
pub fn count_bytes<'b>(s: &'b str, begin: uint, n: uint) -> uint {
    s.slice_from(begin).slice_chars(0, n).len()
}
2013-08-29 15:51:39 +02:00
bors
2b035d908b auto merge of #8838 : brson/rust/rvfpelim, r=alexcrichton
This reverts commit 2c0f9bd354, reversing
changes made to f8c4f0ea9c.

Conflicts:
	src/rustllvm/RustWrapper.cpp

Fixes #8833
2013-08-29 06:00:48 -07:00
Huon Wilson
4fea236a85 extra: error message should reflact that RUST_TEST_TASKS should be strictly positive (zero is illegal). 2013-08-29 22:58:27 +10:00
Huon Wilson
e835c6b042 rt: remove a series of unfortunate casts. 2013-08-29 22:55:59 +10:00
Huon Wilson
440f1e2dad rt: use sugary functions rather than manual range loops. 2013-08-29 22:55:59 +10:00
Huon Wilson
54e7bdc48e rt: Handle non-integer RUST_THREADS (slightly) more gracefully.
Previously it would call Option.unwrap(), which calls `fail!` on None,
which doesn't work without the runtime (e.g. when initialising it).
2013-08-29 22:55:59 +10:00
bors
33d6572036 auto merge of #8823 : huonw/rust/6233, r=brson
Fixes #7335.
2013-08-29 04:50:43 -07:00