Commit Graph

21009 Commits

Author SHA1 Message Date
blake2-ppc
0b35e3b5a3 extra::treemap: Use IteratorUtil::peekable
Replace the previous equivalent iterator adaptor with .peekable().
Refactor the set operation iterators so that they are easier to read.
2013-08-11 02:18:21 +02:00
Simon Sapin
deb7b67aa1 Add a "peekable" iterator adaptor, with a peek() method that returns the next element. 2013-08-11 02:18:21 +02:00
blake2-ppc
b44f423dd4 std::iterator: Rename .peek() to .inspect() 2013-08-11 01:57:20 +02:00
bors
8b9e1ce75a auto merge of #8430 : erickt/rust/cleanup-iterators, r=erickt
This PR does a bunch of cleaning up of various APIs. The major one is that it merges `Iterator` and `IteratorUtil`, and renames functions like `transform` into `map`. I also merged `DoubleEndedIterator` and `DoubleEndedIteratorUtil`, as well as I renamed various .consume* functions to .move_iter(). This helps to implement part of #7887.
2013-08-10 13:17:19 -07:00
Erick Tryzelaar
c8a93efdae Merge remote-tracking branch 'remotes/origin/master' into cleanup-iterators 2013-08-10 12:04:40 -07:00
bors
2ba36ec629 auto merge of #8327 : sstewartgallus/rust/factor_out_waitqueue, r=bblum
I'm a bit disappointed that I couldn't figure out how to factor out more of the code implementing `extra::sync` but I feel this is an okay start. Also I added some documentation explaining that `WaitQueue` isn't thread safe, and needs an exclusive lock.
 
@bblum
2013-08-10 07:47:14 -07:00
Erick Tryzelaar
5b2c1c543f syntax and rustc: fix some warnings 2013-08-10 07:33:22 -07:00
Erick Tryzelaar
e48ca19bc5 std: fix the non-stage0 str::raw::slice_bytes which broke in a merge 2013-08-10 07:33:22 -07:00
Erick Tryzelaar
6fcf2ee8e3 std: Transform.find_ -> .find 2013-08-10 07:33:22 -07:00
Erick Tryzelaar
f9dee04aaa std: Iterator.len_ -> .len 2013-08-10 07:33:22 -07:00
Erick Tryzelaar
74d2552b0a std: Iterator.last_ -> .last 2013-08-10 07:33:21 -07:00
Erick Tryzelaar
1db62d8311 std: Iterator.chain_ -> .chain 2013-08-10 07:33:21 -07:00
Erick Tryzelaar
60c2661684 std: Iterator.flat_map_ -> .flat_map 2013-08-10 07:33:21 -07:00
Erick Tryzelaar
24d2cd0ef4 std: Iterator.take_ -> .take 2013-08-10 07:33:21 -07:00
Erick Tryzelaar
68f40d215e std: Rename Iterator.transform -> .map
cc #5898
2013-08-10 07:33:21 -07:00
Erick Tryzelaar
4062b84f4a std: merge Iterator and IteratorUtil 2013-08-10 07:02:17 -07:00
Erick Tryzelaar
a6614621af std: merge iterator::DoubleEndedIterator and DoubleEndedIteratorUtil 2013-08-10 07:01:08 -07:00
Erick Tryzelaar
229eeda4cd Clean up some unused imports in tests 2013-08-10 07:01:07 -07:00
Erick Tryzelaar
fad7857c7b Mass rename of .consume{,_iter}() to .move_iter()
cc #7887
2013-08-10 07:01:07 -07:00
bors
e70aac572a auto merge of #8270 : dotdash/rust/ret_alloca_elim, r=pcwalton
When there is only a single store to the ret slot that dominates the
load that gets the value for the "ret" instruction, we can elide the
ret slot and directly return the operand of the dominating store
instruction. This is the same thing that clang does, except for a
special case that doesn't seem to affect us.

Fixes #8238
2013-08-10 04:44:13 -07:00
Björn Steinbrink
4b74b8dca4 Elide unnecessary ret slot allocas
When there is only a single store to the ret slot that dominates the
load that gets the value for the "ret" instruction, we can elide the
ret slot and directly return the operand of the dominating store
instruction. This is the same thing that clang does, except for a
special case that doesn't seem to affect us.

Fixes #8238
2013-08-10 11:04:50 +02:00
bors
f0fc9c92ff auto merge of #8425 : dim-an/rust/increase-stack-size, r=brson 2013-08-10 01:20:14 -07:00
bors
60f5011005 auto merge of #8296 : erickt/rust/remove-str-trailing-nulls, r=erickt
This PR fixes #7235 and #3371, which removes trailing nulls from `str` types. Instead, it replaces the creation of c strings with a new type, `std::c_str::CString`, which wraps a malloced byte array, and respects:

*  No interior nulls
* Ends with a trailing null
2013-08-09 21:56:17 -07:00
Erick Tryzelaar
ee59aacac4 Merge remote-tracking branch 'remotes/origin/master' into remove-str-trailing-nulls 2013-08-09 18:48:01 -07:00
bors
e81e81f234 auto merge of #8387 : brson/rust/nooldrt, r=brson 2013-08-09 18:41:13 -07:00
Brian Anderson
b75915d0ca Remove the C++ runtime. Sayonara 2013-08-09 16:45:50 -07:00
Dmitry Ermolov
980bcdd381 Increase system stack size. 2013-08-10 03:37:39 +04:00
bors
6f6dce7bbc auto merge of #8176 : catamorphism/rust/rustpkg-extern-mod, r=catamorphism
r? @graydon Also, notably, make rustpkgtest depend on the rustpkg executable (otherwise, tests that shell out to rustpgk might run when rustpkg doesn't exist).
2013-08-09 16:17:10 -07:00
Tim Chevalier
37fd8f03fd rustpkg: Simplify the PkgId struct
Get rid of special cases for names beginning with "rust-" or
containing hyphens, and just store a Path in a package ID. The Rust-identifier
for the crate is none of rustpkg's business.
2013-08-09 14:11:55 -07:00
Tim Chevalier
96fd606ddd std/rustc/rustpkg/syntax: Support the extern mod = ... form
This commit allows you to write:

 extern mod x = "a/b/c";

which means rustc will search in the RUST_PATH for a package with
ID a/b/c, and bind it to the name `x` if it's found.

Incidentally, move get_relative_to from back::rpath into std::path
2013-08-09 14:11:50 -07:00
Erick Tryzelaar
cab6d46e58 rustpkg: another fix for windows 2013-08-09 14:06:03 -07:00
bors
1de201c3c6 auto merge of #8415 : brson/rust/newrt-local-heap-perf, r=pcwalton,brson
Mostly optimizing TLS accesses to bring local heap allocation performance
closer to that of oldsched. It's not completely at parity but removing the
branches involved in supporting oldsched and optimizing pthread_get/setspecific
to instead use our dedicated TCB slot will probably make up for it.
2013-08-09 13:53:08 -07:00
Erick Tryzelaar
c14e14e63a std: more windows fixes to os.rs and run.rs 2013-08-09 11:13:26 -07:00
bors
c20b90647e auto merge of #8369 : yichoi/rust/arm-test, r=sanxiyn
fix some part of test code to pass make check on ARM Android
2013-08-09 10:59:08 -07:00
bors
74efdf6197 auto merge of #8352 : stepancheg/rust/ipv6-to-str, r=luqmana
Reported by @luqmana
2013-08-09 08:17:04 -07:00
bors
6928a10e3f auto merge of #8362 : sfackler/rust/env, r=alexcrichton
env! aborts compilation of the specified environment variable is not
defined and takes an optional second argument containing a custom
error message. option_env! creates an Option<&'static str> containing
the value of the environment variable.

There are no run-pass tests that check the behavior when the environment
variable is defined since the test framework doesn't support setting
environment variables at compile time as opposed to runtime. However,
both env! and option_env! are used inside of rustc itself, which should
act as a sufficient test.

Fixes #2248.
2013-08-09 05:35:06 -07:00
Stepan Koltsov
ae81151ad6 Fix Ipv6Addr to_str for ::1:x.x.x.x addresses
Reported by luqmana@
2013-08-09 13:53:28 +04:00
bors
2fe2e59c67 auto merge of #8361 : alexcrichton/rust/fix-node-hashes-in-crates, r=thestinger
When running rusti 32-bit tests from a 64-bit host, these errors came up frequently. My best idea as to what was happening is:

1. First, if you hash the same `int` value on 32-bit and 64-bit, you will get two different hashes.
2. In a cross-compile situation, let's say x86_64 is building an i686 library, all of the hashes will be 64-bit hashes.
3. Then let's say you use the i686 libraries and then attempt to link against the same i686 libraries, because you're calculating hashes with a 32-bit int instead of a 64-bit one, you'll have different hashes and you won't be able to find items in the metadata (the items were generated with a 64-bit int).

This patch changes the items to always be hashed as an `i64` to preserve the hash value across architectures. Here's a nice before/after for this patch of the state of rusti tests

```
host   target  before  after
64     64      yes     yes
64     32      no      no (llvm assertion)
32     64      no      yes
32     32      no      no (llvm assertion)
```

Basically one case started working, but currently when the target is 32-bit LLVM is having a lot of problems generating code. That's another separate issue though.
2013-08-09 02:53:08 -07:00
Brian Anderson
d392556160 std: Fix perf of local allocations in newsched
Mostly optimizing TLS accesses to bring local heap allocation performance
closer to that of oldsched. It's not completely at parity but removing the
branches involved in supporting oldsched and optimizing pthread_get/setspecific
to instead use our dedicated TCB slot will probably make up for it.
2013-08-09 01:15:31 -07:00
bors
094e4260f8 auto merge of #8357 : omasanori/rust/cleanup, r=alexcrichton
I feel it's time to eliminate them (and add some testcases.)
2013-08-09 00:17:06 -07:00
OGINO Masanori
b4d6ae5bb8 Remove redundant Ord method impls.
Basically, generic containers should not use the default methods since a
type of elements may not guarantees total order. str could use them
since u8's Ord guarantees total order. Floating point numbers are also
broken with the default methods because of NaN. Thanks for @thestinger.

Timespec also guarantees total order AIUI. I'm unsure whether
extra::semver::Identifier does so I left it alone. Proof needed.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2013-08-09 14:28:14 +09:00
bors
a931e04b75 auto merge of #8350 : dim-an/rust/fix-struct-match, r=pcwalton
Code that collects fields in struct-like patterns used to ignore
wildcard patterns like `Foo{_}`. But `enter_defaults` considered
struct-like patterns as default in order to overcome this
(accoring to my understanding of situation).

However such behaviour caused code like this:
```
enum E {
    Foo{f: int},
    Bar
}
let e = Bar;
match e {
    Foo{f: _f} => { /* do something (1) */ }
    _ => { /* do something (2) */ }
}
```
consider pattern `Foo{f: _f}` as default. That caused inproper behaviour
and even segfaults while trying to destruct `Bar` as `Foo{f: _f}`.
Issues: #5625 , #5530.

This patch fixes `collect_record_or_struct_fields` to split cases of
single wildcard struct-like pattern and no struct-like pattern at all.
Former case resolved with `enter_rec_or_struct` (and not with
`enter_defaults`).

Closes #5625.
Closes #5530.
2013-08-08 21:41:05 -07:00
Steven Stewart-Gallus
1e576a35eb Isolate common wait_end logic 2013-08-08 19:34:01 -07:00
Erick Tryzelaar
56730c094c Merge remote-tracking branch 'remotes/origin/master' into remove-str-trailing-nulls 2013-08-08 19:27:03 -07:00
bors
7a1b61d631 auto merge of #8336 : stepancheg/rust/socket-addr-from-str, r=brson
FromStr implemented from scratch.

It is overengineered a bit, however.

Old implementation handles errors by fail!()-ing. And it has bugs, like it accepts `127.0.0.1::127.0.0.1` as IPv6 address, and does not handle all ipv4-in-ipv6 schemes. So I decided to implement parser from scratch.
2013-08-08 19:08:02 -07:00
bors
936f70bd87 auto merge of #8356 : toddaaro/rust/ws, r=brson
This pull request converts the scheduler from a naive shared queue scheduler to a naive workstealing scheduler. The deque is still a queue inside a lock, but there is still a substantial performance gain. Fiddling with the messaging benchmark I got a ~10x speedup and observed massively reduced memory usage.

There are still *many* locations for optimization, but based on my experience so far it is a clear performance win as it is now.
2013-08-08 16:32:02 -07:00
Tim Chevalier
e751c90513 Makefiles: make rustpkgtest depend on rustpkg executable 2013-08-08 15:17:28 -07:00
Tim Chevalier
7c1eb83052 rustpkg: Eliminate a copy 2013-08-08 15:17:28 -07:00
bors
8f65dbfcfa auto merge of #8385 : cmr/rust/big-rollup, r=alexcrichton
This is a fairly large rollup, but I've tested everything locally, and none of
it should be platform-specific.

r=alexcrichton (bdfdbdd)
r=brson (d803c18)
r=alexcrichton (a5041d0)
r=bstrie (317412a)
r=alexcrichton (135c85e)
r=thestinger (8805baa)
r=pcwalton (0661178)
r=cmr (9397fe0)
r=cmr (caa4135)
r=cmr (6a21d93)
r=cmr (4dc3379)
r=cmr (0aa5154)
r=cmr (18be261)
r=thestinger (f10be03)
2013-08-08 14:32:02 -07:00
toddaaro
af2e03998d Enabled workstealing in the scheduler. Previously we had one global work queue shared by each scheduler. Now there is a separate work queue for each scheduler, and work is "stolen" from other queues when it is exhausted locally. 2013-08-08 14:13:41 -07:00