Commit Graph

21888 Commits

Author SHA1 Message Date
bors
c8db9e2638 auto merge of #8905 : sstewartgallus/rust/cleanup_tests, r=bblum
In this commit I:
- removed unneeded heap allocations
- added extra whitespace to crowded expressions
- and removed unneeded syntax

Also, CC @bblum although this change is fairly unobjectionable.
2013-08-31 12:40:40 -07:00
Steven Stewart-Gallus
e2f2a601e8 Cleanup concurrency tests
In this commit I:
- removed unneeded heap allocations
- added extra whitespace to crowded expressions
- and removed unneeded syntax
2013-08-31 11:26:01 -07:00
Luqman Aden
ba5f101fa9 librustc: Add export_name attribute to specify symbol name. 2013-08-31 13:23:31 -04:00
Daniel Micay
6655b3c462 repr: remove trailing {} from unit-like structs 2013-08-31 03:54:15 -04:00
Daniel Micay
874611b348 repr: print the name of structs 2013-08-31 03:54:13 -04:00
bors
bb35e23f1c auto merge of #8896 : lightcatcher/rust/default_eq_fix, r=thestinger
Summary:
-removed "ne" methods in libstd and librustpkg
-made default "ne" be inlined
-made one of the "eq" methods in librustpkg follow more standard parameter naming convention
2013-08-30 21:40:32 -07:00
bors
5fe553d30f auto merge of #8862 : dcrewi/rust/drop-redundant-ord-impls, r=thestinger
If this were to break something, I would expect existing tests to catch it, and a `make check` run passes locally.
2013-08-30 20:30:35 -07:00
bors
206ad61fd8 auto merge of #8894 : alexcrichton/rust/faster, r=thestinger
The only changes to the default passes is that O1 now doesn't run the inline
pass, just always-inline with lifetime intrinsics. O2 also now has a threshold
of 225 instead of 275. Otherwise the default passes being run is the same.

I've also added a few more options for configuring the pass pipeline. Namely you
can now specify arguments to LLVM directly via the `--llvm-args` command line
option which operates similarly to `--passes`. I also added the ability to turn
off pre-population of the pass manager in case you want to run *only* your own
passes.

I would consider this as closing #8890. I don't think that we should change the default inlining threshold because LLVM/clang will probably have chosen those numbers more carefully than we would. Regardless, here's the performance numbers from this commit:

```
$ ./x86_64-apple-darwin/stage0/bin/rustc ./gistfile1.rs --test --opt-level=3 -o before
warning: no debug symbols in executable (-arch x86_64)
$ ./before --bench

running 1 test
test bench::aes_bench_x8 ... bench: 1602 ns/iter (+/- 66) = 7990 MB/s

test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured

$ ./x86_64-apple-darwin/stage1/bin/rustc ./gistfile1.rs --test --opt-level=3 -o after
warning: no debug symbols in executable (-arch x86_64)
$ ./after --bench

running 1 test
test bench::aes_bench_x8 ... bench: 2103 ns/iter (+/- 175) = 6086 MB/s

test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured

$ ./x86_64-apple-darwin/stage1/bin/rustc ./gistfile1.rs --test --opt-level=3 -o after --llvm-args '-inline-threshold=225'
warning: no debug symbols in executable (-arch x86_64)
$ ./after --bench

running 1 test
test bench::aes_bench_x8 ... bench: 1600 ns/iter (+/- 71) = 8000 MB/s

test result: ok. 0 passed; 0 failed; 0 ignored; 1 measured

```
2013-08-30 19:20:36 -07:00
Eric Martin
1ab0ddae5c made Eq for package_id use more standard parameter names 2013-08-30 22:10:36 -04:00
Eric Martin
ed2217d7b6 Now inline default 'ne' methods 2013-08-30 22:02:24 -04:00
Eric Martin
babe20f018 remove several 'ne' methods 2013-08-30 21:53:25 -04:00
Alex Crichton
8d12673c82 Tweak pass management and add some more options
The only changes to the default passes is that O1 now doesn't run the inline
pass, just always-inline with lifetime intrinsics. O2 also now has a threshold
of 225 instead of 275. Otherwise the default passes being run is the same.

I've also added a few more options for configuring the pass pipeline. Namely you
can now specify arguments to LLVM directly via the `--llvm-args` command line
option which operates similarly to `--passes`. I also added the ability to turn
off pre-population of the pass manager in case you want to run *only* your own
passes.
2013-08-30 17:56:04 -07:00
bors
29449e355a auto merge of #8889 : erickt/rust/cleanup, r=catamorphism
This fixes a couple minor things I've been sitting on. It cleans up some warnings, CapCases some types in librustc's rscope module, and adds a fixme.
2013-08-30 17:20:36 -07:00
bors
8002a09bf9 auto merge of #8831 : catamorphism/rust/extend_rust_path, r=catamorphism
r? @brson

@metajack requested the ability to violate the "only workspaces can be in the RUST_PATH" rule for the purpose of bootstrapping Servo without having to restructure all the directories. This patch gives rustpkg the ability to find sources if a directory in the RUST_PATH directly contains one of rustpkg's "special" files (lib.rs, main.rs, bench.rs, or test.rs), even if it's not a workspace. In this case, it puts the build artifacts in the first workspace in the RUST_PATH.

I'm not sure whether or not it's a good idea to keep this feature in rustpkg permanently. Thus, I added a flag, ```--use-rust-path-hack```, and only enabled it when the flag is set.
2013-08-30 16:10:52 -07:00
Tim Chevalier
98e470ad73 rustpkg: Allow package directories to appear in the RUST_PATH
This commit adds a rustpkg flag, --rust-path-hack, that allows
rustpkg to *search* inside package directories if they appear in
the RUST_PATH, while *building* libraries and executables into a
different target directory.

This behavior is hidden behind a flag because I believe we only
want to support it temporarily, to make it easier to port servo to
rustpkg.

This commit also includes a fix for how rustpkg fetches sources
from git repositories -- it uses a temporary directory as the target
when invoking `git clone`, then moves that directory into the workspace
if the clone was successful. (The old behavior was that when the
`git clone` failed, the empty target directory would be left lying
around anyway.)
2013-08-30 15:48:41 -07:00
Tim Chevalier
7cbdee1663 rustpkg: Add a not_a_workspace condition 2013-08-30 15:48:41 -07:00
Tim Chevalier
34ed4e26a2 std: Add a file-renaming function to std::os 2013-08-30 15:48:37 -07:00
Erick Tryzelaar
9730ed9b02 std: Add a fixme for when we add Trait::<for T>::static_method() 2013-08-30 15:10:55 -07:00
Erick Tryzelaar
66e3a4c50e rustc: capitalize types in rscope.rs 2013-08-30 15:10:55 -07:00
Erick Tryzelaar
91d6c60bed fix various warnings 2013-08-30 15:10:55 -07:00
Tim Chevalier
8464ee04a4 rustc: Change a stray error! statement to debug! 2013-08-30 14:31:52 -07:00
bors
6a225951e3 auto merge of #8886 : cmr/rust/test-restructure, r=cmr 2013-08-30 14:00:43 -07:00
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