Commit Graph

26193 Commits

Author SHA1 Message Date
Derek Guenther
97078d43b2 Converted fourcc! to loadable syntax extension 2014-02-08 23:40:17 -06:00
Kevin Ballard
c1cc7e5f16 Add new syntax extension fourcc!()
fourcc!() allows you to embed FourCC (or OSType) values that are
evaluated as u32 literals. It takes a 4-byte ASCII string and produces
the u32 resulting in interpreting those 4 bytes as a u32, using either
the platform-native endianness, or explicitly as big or little endian.
2014-02-08 23:40:16 -06:00
bors
b66ec3483b auto merge of #12114 : brson/rust/faqs, r=cmr
These are ancient. I removed a bunch of questions that are less relevant - or completely unrelevant, updated other entries, and removed things that are already better expressed elsewhere.
2014-02-08 20:01:27 -08:00
bors
fddc18ec4b auto merge of #12105 : huonw/rust/bench-black-box, r=alexcrichton
This allows a result to be marked as "used" by passing it to a function
LLVM cannot see inside (unless LTO is enabled).

Closes #8261.
2014-02-08 18:46:27 -08:00
Huon Wilson
38447344f1 arena: use the generic bh.iter to stop the benchmarks being DCE'd.
Before:

    test test::bench_nonpod_nonarena  ... bench:        62 ns/iter (+/- 6)
    test test::bench_pod_nonarena     ... bench:         0 ns/iter (+/- 0)

After:

    test test::bench_nonpod_nonarena  ... bench:       158 ns/iter (+/- 11)
    test test::bench_pod_nonarena     ... bench:        48 ns/iter (+/- 2)

The other tests show no change, but are adjusted to use the generic
return value of `.iter` anyway so that this doesn't change in future.
2014-02-09 12:31:45 +11:00
Huon Wilson
b029a18820 extra::test: add an opaque function to assist with accurate
benchmarking.

This allows a result to be marked as "used" by passing it to a function
LLVM cannot see inside. By making `iter` generic and using this
`black_box` on the result benchmarks can get this behaviour simply by
returning their computation.
2014-02-09 12:02:03 +11:00
bors
a2290db797 auto merge of #12112 : lucab/rust/make-dist, r=alexcrichton
`make dist` or building from a generated tarball is currently not possible due to some files that have been renamed and the ongoing libextra split. This PR fixes all (current) issues in order to build rust from the .tar.gz source alone.
2014-02-08 15:17:30 -08:00
bors
cba7ac5e01 auto merge of #12065 : mrshu/rust/error-formating-fix, r=alexcrichton
This pull request tries to fix #12050.

I went after these wrong errors quite aggressively so it might be that I also changed some strings that are not actual errors.

Please point those out and I will update this pull request accordingly.
2014-02-08 13:56:45 -08:00
Luca Bruno
51b74c41ff make: update dist target after libextra split
libextra is currently being split into several crates. This commit adds
them all to the dist target in order to have them in the final tarballs.

Signed-off-by: Luca Bruno <lucab@debian.org>
2014-02-08 21:32:43 +01:00
mr.Shu
ee3fa68fed Fixed error starting with uppercase
Error messages cleaned in librustc/middle

Error messages cleaned in libsyntax

Error messages cleaned in libsyntax more agressively

Error messages cleaned in librustc more aggressively

Fixed affected tests

Fixed other failing tests

Last failing tests fixed
2014-02-08 20:59:38 +01:00
bors
c8759f6b56 auto merge of #12090 : bjz/rust/unimplemented, r=cmr
Adds a standardised placeholder for marking unfinished code.
2014-02-08 11:46:29 -08:00
bors
35518514c4 auto merge of #12109 : omasanori/rust/small-fixes, r=sfackler
Most of them are to reduce warnings in testing builds.
2014-02-08 10:31:33 -08:00
OGINO Masanori
f87e507858 rustpkg has gone.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-02-09 00:46:31 +09:00
Luca Bruno
99cdabab00 make: update dist target for renamed files
src/README.txt has been renamed in a30d61b05a, make dist is
thus failing as unable to find it.
This commit makes the dist target working again.

Signed-off-by: Luca Bruno <lucab@debian.org>
2014-02-08 14:36:18 +01:00
bors
5acc998ed9 auto merge of #12098 : kballard/rust/from_utf8_lossy_tweak, r=huonw
MaybeOwned allows from_utf8_lossy to avoid allocation if there are no
invalid bytes in the input.

Before:
```
test str::bench::from_utf8_lossy_100_ascii                      ... bench:       183 ns/iter (+/- 5)
test str::bench::from_utf8_lossy_100_invalid                    ... bench:       341 ns/iter (+/- 15)
test str::bench::from_utf8_lossy_100_multibyte                  ... bench:       227 ns/iter (+/- 13)
test str::bench::from_utf8_lossy_invalid                        ... bench:       102 ns/iter (+/- 4)
test str::bench::is_utf8_100_ascii                              ... bench:         2 ns/iter (+/- 0)
test str::bench::is_utf8_100_multibyte                          ... bench:         2 ns/iter (+/- 0)
```

Now:
```
test str::bench::from_utf8_lossy_100_ascii                      ... bench:        96 ns/iter (+/- 4)
test str::bench::from_utf8_lossy_100_invalid                    ... bench:       318 ns/iter (+/- 10)
test str::bench::from_utf8_lossy_100_multibyte                  ... bench:       105 ns/iter (+/- 2)
test str::bench::from_utf8_lossy_invalid                        ... bench:       105 ns/iter (+/- 2)
test str::bench::is_utf8_100_ascii                              ... bench:         2 ns/iter (+/- 0)
test str::bench::is_utf8_100_multibyte                          ... bench:         2 ns/iter (+/- 0)
```
2014-02-08 05:01:30 -08:00
bors
548b8cec19 auto merge of #12101 : csherratt/rust/master, r=alexcrichton
CowArc was crated before libsync and the merge request did not contain the required export change.
2014-02-08 03:46:29 -08:00
bors
b60bed9791 auto merge of #12096 : brson/rust/morestack-addr, r=thestinger 2014-02-08 01:56:30 -08:00
Brian Anderson
30dcc8285b doc: Modernize FAQs just slightly 2014-02-08 00:38:00 -08:00
bors
95483e30a2 auto merge of #12086 : huonw/rust/safe-json, r=kballard
The lexer and json were using `transmute(-1): char` as a sentinel value for EOF, which is invalid since `char` is strictly a unicode codepoint.

Fixing this allows for range asserts on chars since they always lie between 0 and 0x10FFFF.
2014-02-08 00:26:30 -08:00
Kevin Ballard
1d17c2129e Rewrite path::Display to reduce unnecessary allocation 2014-02-07 22:31:52 -08:00
Kevin Ballard
086c0dd33f Delete send_str, rewrite clients on top of MaybeOwned<'static>
Declare a `type SendStr = MaybeOwned<'static>` to ease readibility of
types that needed the old SendStr behavior.

Implement all the traits for MaybeOwned that SendStr used to implement.
2014-02-07 22:31:52 -08:00
Kevin Ballard
122c94d2f3 Implement BytesContainer for MaybeOwned 2014-02-07 22:31:51 -08:00
Kevin Ballard
28467f5d19 Tweak from_utf8_lossy to return a new MaybeOwned enum
MaybeOwned allows from_utf8_lossy to avoid allocation if there are no
invalid bytes in the input.
2014-02-07 22:31:51 -08:00
OGINO Masanori
e107121e34 Remove unnecessary parentheses.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-02-08 15:08:45 +09:00
OGINO Masanori
d4898e72e3 Remove an unused variable in a test of std::c_str.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-02-08 15:08:44 +09:00
OGINO Masanori
f7eb705248 Fix unused import warnings.
Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-02-08 15:08:44 +09:00
OGINO Masanori
dd071eeeb8 Remove redundant Ord implementation for Version.
I've forgot why we keep them, so let me know if you know their reason
for existing.

Signed-off-by: OGINO Masanori <masanori.ogino@gmail.com>
2014-02-08 15:08:44 +09:00
bors
b2c1a81649 auto merge of #12099 : alexcrichton/rust/rpath-tests, r=thestinger
This way when you disable rpaths you can still run `make check`
2014-02-07 22:01:30 -08:00
bors
dde2e0b386 auto merge of #12066 : huonw/rust/show2, r=alexcrichton
- Convert the formatting traits to `&self` rather than `_: &Self`
- Rejig `syntax::ext::{format,deriving}` a little in preparation
- Implement `#[deriving(Show)]`
2014-02-07 20:46:30 -08:00
bors
80c6c73647 auto merge of #12059 : thestinger/rust/glue, r=pcwalton
A follow-up from the work I started with 383e3fd13b.
2014-02-07 19:31:31 -08:00
Huon Wilson
b89afe2af7 Update docs and tests for #[deriving(Show)]. 2014-02-08 13:53:21 +11:00
Huon Wilson
6a8b3ae22f Implement #[deriving(Show)]. 2014-02-08 13:53:21 +11:00
Huon Wilson
5d63910f90 syntax: split out the parsing and the formatting part of format_args!(). 2014-02-08 13:53:21 +11:00
Huon Wilson
fa191a5591 syntax: convert deriving to take &mut ExtCtxt. 2014-02-08 13:53:21 +11:00
Huon Wilson
eac673ab0c syntax: remove some dead code. 2014-02-08 13:53:21 +11:00
Huon Wilson
8d1204a4b7 std::fmt: convert the formatting traits to a proper self.
Poly and String have polymorphic `impl`s and so require different method
names.
2014-02-08 13:53:21 +11:00
Colin Sherratt
0640fc3a8c Added missing export of CowArc 2014-02-07 21:47:23 -05:00
Daniel Micay
95d897c579 add a hack to fix debug-info tests under gdb 7.7 2014-02-07 21:22:47 -05:00
Daniel Micay
0c8ba5fe7f rm out-of-date comment from std::unstable::raw 2014-02-07 21:20:43 -05:00
Daniel Micay
eced501226 allow generating drop glue without the TyDesc
Reflection is now the only user of type descriptors. Uses of drop glue
no longer cause a type descriptor to be generated.
2014-02-07 21:20:43 -05:00
Huon Wilson
5e2de79b30 rustc: load bools as unsigned numbers.
Apparently loading them signed will break if/when they become i1.
2014-02-08 12:13:28 +11:00
Huon Wilson
285c25f7f4 rustc: put range asserts on char loads.
A `char` is a Unicode codepoint, and so ranges from 0--0x10FFFF (with
the surrogate gaps): we may as well inform LLVM of this.
2014-02-08 12:13:28 +11:00
Huon Wilson
1dd1880121 syntax: convert the lexer to use Option<char> over transmute(-1).
The transmute was unsound.

There are many instances of .unwrap_or('\x00') for "ignoring" EOF which
either do not make the situation worse than it was (well, actually make
it better, since it's easy to grep for places that don't handle EOF) or
can never ever be read.

Fixes #8971.
2014-02-08 12:13:27 +11:00
Huon Wilson
e7908c0a66 extra::json: remove the use of unsafe char transmutes.
Avoid using -1 as a char sentinel, when Option<char> is the perfect
thing.
2014-02-08 12:13:27 +11:00
Daniel Micay
940d1ae2f3 remove type descriptors from proc and @T
This also drops support for the managed pointer POISON_ON_FREE feature
as it's not worth adding back the support for it. After a snapshot, the
leftovers can be removed.
2014-02-07 20:08:35 -05:00
bors
29e500db8a auto merge of #12094 : adridu59/rust/licensing, r=brson
Closes #12069.

cc @brson
2014-02-07 16:16:35 -08:00
Alex Crichton
28b72cdae4 Set the LD_LIBRARY_PATH when running tests
This way when you disable rpaths you can still run `make check`
2014-02-07 16:04:57 -08:00
bors
1fd2d77860 auto merge of #12029 : zkamsler/rust/merge-sort-allocations, r=huonw
This pull request:
1) Changes the initial insertion sort to be in-place, and defers allocation of working set until merge is needed.
2) Increases the increases the maximum run length to use insertion sort for from 8 to 32 elements. This increases the size of vectors that will not allocate, and reduces the number of merge passes by two. It seemed to be the sweet spot in the benchmarks that I ran.

Here are the results of some benchmarks. Note that they are sorting u64s, so types that are more expensive to compare or copy may have different behaviors.
Before changes:
```
test vec::bench::sort_random_large      bench:    719753 ns/iter (+/- 130173) = 111 MB/s
test vec::bench::sort_random_medium     bench:      4726 ns/iter (+/- 742) = 169 MB/s
test vec::bench::sort_random_small      bench:       344 ns/iter (+/- 76) = 116 MB/s
test vec::bench::sort_sorted            bench:    437244 ns/iter (+/- 70043) = 182 MB/s
```

Deferred allocation (8 element insertion sort):
```
test vec::bench::sort_random_large      bench:    702630 ns/iter (+/- 88158) = 113 MB/s
test vec::bench::sort_random_medium     bench:      4529 ns/iter (+/- 497) = 176 MB/s
test vec::bench::sort_random_small      bench:       185 ns/iter (+/- 49) = 216 MB/s
test vec::bench::sort_sorted            bench:    425853 ns/iter (+/- 60907) = 187 MB/s
```

Deferred allocation (16 element insertion sort):
```
test vec::bench::sort_random_large      bench:    692783 ns/iter (+/- 165837) = 115 MB/s
test vec::bench::sort_random_medium     bench:      4434 ns/iter (+/- 722) = 180 MB/s
test vec::bench::sort_random_small      bench:       187 ns/iter (+/- 38) = 213 MB/s
test vec::bench::sort_sorted            bench:    393783 ns/iter (+/- 85548) = 203 MB/s
```

Deferred allocation (32 element insertion sort):
```
test vec::bench::sort_random_large      bench:    682556 ns/iter (+/- 131008) = 117 MB/s
test vec::bench::sort_random_medium     bench:      4370 ns/iter (+/- 1369) = 183 MB/s
test vec::bench::sort_random_small      bench:       179 ns/iter (+/- 32) = 223 MB/s
test vec::bench::sort_sorted            bench:    358353 ns/iter (+/- 65423) = 223 MB/s
```

Deferred allocation (64 element insertion sort):
```
test vec::bench::sort_random_large      bench:    712040 ns/iter (+/- 132454) = 112 MB/s
test vec::bench::sort_random_medium     bench:      4425 ns/iter (+/- 784) = 180 MB/s
test vec::bench::sort_random_small      bench:       179 ns/iter (+/- 81) = 223 MB/s
test vec::bench::sort_sorted            bench:    317812 ns/iter (+/- 62675) = 251 MB/s
```

This is the best I could manage with the basic merge sort while keeping the invariant that the original vector must contain each element exactly once when the comparison function is called. If one is not married to a stable sort, an in-place n*log(n) sorting algorithm may have better performance in some cases.

for #12011
cc @huonw
2014-02-07 14:21:30 -08:00
Zach Kamsler
cebe5e8e6b Reduced allocations in merge_sort for short vectors
Added a seperate in-place insertion sort for short vectors.
Increased threshold for insertion short for 8 to 32 elements
for small types and 16 for larger types. Added benchmarks
for sorting larger types.
2014-02-07 17:11:28 -05:00
Brian Anderson
b91caac729 rustc: Remove 'morestack_addr' intrinsic. Unused 2014-02-07 13:21:35 -08:00