Commit Graph

21226 Commits

Author SHA1 Message Date
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
Chris Morgan
1ceee6a843 Remove in-tree test binary.
I presume this was accidentally committed.
2013-08-10 16:14:39 +10: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
Tim Chevalier
4fb37edd93 docs: In rustpkg manual, note future plans about versions 2013-08-09 18:26:22 -07:00
Michael Sullivan
437a4c28a3 Fix interaction between default matches and guards. Closes #3121. 2013-08-09 17:39:21 -07:00
Brian Anderson
b473ce304f rustc: Obey RUST_MIN_STACK env var
A lot of people are hitting stack overflows in rustc. This will make it
easier to experiment with stack size.
2013-08-09 17:28:27 -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
Michael Sullivan
8cefcc0ac5 Fix some warnings. 2013-08-09 16:07:26 -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
Alex Crichton
2f3fde60c3 Implement an address_insignificant attribute
This can be applied to statics and it will indicate that LLVM will attempt to
merge the constant in .data with other statics.

I have preliminarily applied this to all of the statics generated by the new
`ifmt!` syntax extension. I compiled a file with 1000 calls to `ifmt!` and a
separate file with 1000 calls to `fmt!` to compare the sizes, and the results
were:

fmt           310k
ifmt (before) 529k
ifmt (after)  202k

This now means that ifmt! is both faster and smaller than fmt!, yay!
2013-08-09 13:49:41 -07:00
Corey Richardson
4be086b7f6 Remove rtdebug_! and make rtdebug! work properly.
It now actually does logging, and is compiled out when `--cfg rtdebug` is not
given to the libstd build, which it isn't by default. This makes the rt
benchmarks 18-50% faster.
2013-08-09 14:48:10 -04:00
Michael Sullivan
fb32ddf1a2 Fix vector pattern matching. Closes #6909. 2013-08-09 11:29:41 -07:00
Michael Sullivan
6362c3ad6b Switch to using .enumerate() some places in _match. 2013-08-09 11:29:41 -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
Felix S. Klock II
eee044734c Add parse-error recovery for erroneous struct_id { } form.
There are 4 different new tests, to check some different scenarios for
what the parse context is at the time of recovery, becasue our
compile-fail infrastructure does not appear to handle verifying
error-recovery situations.

Differentiate between unit-like struct definition item and unit-like
struct construction in the error message.

----

More generally, outlines a more generic strategy for parse error
recovery: By committing to an expression/statement at set points in
the parser, we can then do some look-ahead to catch common mistakes
and skip over them.

One detail about this strategy is that you want to avoid emitting the
"helpful" message unless the input is reasonably close to the case of
interest.  (E.g. do not warn about a potential unit struct for an
input of the form `let hmm = do foo { } { };`)

To accomplish this, I added (partial) last_token tracking; used for
`commit_stmt` support.

The check_for_erroneous_unit_struct_expecting fn returns bool to
signal whether it "made progress"; currently unused; this is meant for
use to compose several such recovery checks together in a loop.
2013-08-09 18:32:46 +02: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
Huon Wilson
c8ca989c07 std: add a Clone impl for HashSet. 2013-08-10 00:44:35 +10: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
Dmitry Ermolov
2a2ea5e276 Implement lower_bound_iter/upper_bound_iter for TrieMap/TrieSet 2013-08-09 15:51:49 +04: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
blake2-ppc
854e219d0a std::tuple: Use != properly in Eq::ne for tuples
Just like the Ord methods, Eq::ne needs to be implemented in terms of
the same operation on the elements.
2013-08-09 05:54:49 +02: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
Niko Matsakis
33c6d3fd78 Allow attributes to appear as macro arguments
Fixes #8393
2013-08-08 19:41:02 -04: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