Commit Graph

26277 Commits

Author SHA1 Message Date
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
bors
7d7a060f8d auto merge of #12073 : alexcrichton/rust/doc-examples, r=cmr
"How do I start in libX" is a common question that I've seen, so I figured
putting the examples in as many places as possible is probably a good idea.
2014-02-07 12:41:35 -08:00
Adrien Tétar
ec2f047aa9 doc: add license information for gen. files 2014-02-07 20:50:15 +01:00
bors
56565eb129 auto merge of #12055 : dguenther/rust/tidy_test, r=alexcrichton
This PR extends the tidy formatting check to rust files in the test folder. To facilitate this, a few flags were added to tidy:

* `xfail-tidy-cr` - Disables the check for CR characters for all following lines in the file
* `xfail-tidy-tab` - Disables the check for tab characters for all following lines in the file
* `xfail-tidy-linelength` - Disables the line length check for all following lines in the file

Checks should not have to be disabled often. I disabled line length checks in `debug-info` tests that use `debugger:` checks, but aside from that, there were relatively few exclusions. Running tidy on all the tests does slow down the formatting check, so it may be worth investigating further optimization.

cc #4534
2014-02-07 11:26:29 -08:00
Derek Guenther
730bdb6403 Added tests to make tidy 2014-02-07 12:49:24 -06:00
Brendan Zabarauskas
8192f5508a Clean up formatting in macros module 2014-02-08 05:39:50 +11:00
bors
ca40da8b55 auto merge of #12075 : chromatic/rust/gh_11983_deglob_std, r=alexcrichton
This replaces the imports from the prelude with the re-exported symbols.
2014-02-07 10:11:29 -08:00
chromatic
b91b6a746b Cleaned up imports per coding standards.
No functional changes; just style.
2014-02-07 09:59:19 -08:00
chromatic
813886b22c Removed prelude::* from libstd files.
This replaces the imports from the prelude with the re-exported symbols.
2014-02-07 09:59:19 -08:00
Brendan Zabarauskas
1e55cae783 Add missing test for unreachable! macro 2014-02-08 04:43:51 +11:00
Brendan Zabarauskas
7e1cfc8893 Add unimplemented! macro 2014-02-08 04:43:39 +11:00
bors
c3ccaacc6c auto merge of #12087 : sanxiyn/rust/show-span, r=huonw 2014-02-07 03:26:34 -08:00
Seo Sanghyeon
e5463b996c Add comments to span debugger 2014-02-07 20:13:07 +09:00
Seo Sanghyeon
5109d1adce Correct span for ExprFnBlock, ExprMethodCall, ExprParen 2014-02-07 19:52:12 +09:00
Seo Sanghyeon
104002be6f Span debugger 2014-02-07 19:50:07 +09:00
bors
14cb4be6e9 auto merge of #12083 : bjz/rust/semver, r=huonw 2014-02-07 02:11:30 -08:00
bors
36f1b38f80 auto merge of #12062 : kballard/rust/from_utf8_lossy, r=huonw
`from_utf8_lossy()` takes a byte vector and produces a `~str`, converting
any invalid UTF-8 sequence into the U+FFFD REPLACEMENT CHARACTER.

The replacement follows the guidelines in §5.22 Best Practice for U+FFFD
Substitution from the Unicode Standard (Version 6.2)[1], which also
matches the WHATWG rules for utf-8 decoding[2].

[1]: http://www.unicode.org/versions/Unicode6.2.0/ch05.pdf
[2]: http://encoding.spec.whatwg.org/#utf-8

Closes #9516.
2014-02-07 00:56:31 -08:00