Commit Graph

19946 Commits

Author SHA1 Message Date
blake2-ppc
08dc72f5d5 deque: Implement FromIterator
So that deque can be used with IteratorUtil::collect()
2013-07-06 05:42:45 +02:00
blake2-ppc
40ce0b7d76 deque: Speed up deque growth by a lot
Fix some issues with the deque being very slow, keep the same vec around
instead of constructing a new. Move as few elements as possible, so the
self.lo point is not moved after grow.

   [o o o o o|o o o]
       hi...^ ^.... lo

   grows to

   [. . . . .|o o o o o o o o|. . .]
              ^.. lo        ^.. hi

If the deque is append-only, it will result in moving no elements on
grow. If the deque is prepend-only, all will be moved each time.

The bench tests added show big improvements:

Timed using `rust build -O --test extra.rs && ./extra --bench deque`

Old version:

test deque::tests::bench_add_back ... bench: 4976 ns/iter (+/- 9)
test deque::tests::bench_add_front ... bench: 4108 ns/iter (+/- 18)
test deque::tests::bench_grow ... bench: 416964 ns/iter (+/- 4197)
test deque::tests::bench_new ... bench: 408 ns/iter (+/- 12)

With this commit:

test deque::tests::bench_add_back ... bench: 12 ns/iter (+/- 0)
test deque::tests::bench_add_front ... bench: 16 ns/iter (+/- 0)
test deque::tests::bench_grow ... bench: 1515 ns/iter (+/- 30)
test deque::tests::bench_new ... bench: 419 ns/iter (+/- 3)
2013-07-06 05:42:45 +02:00
blake2-ppc
81933edf92 deque: Add tests and bench tests
Add a test that excercises deque growing.

Add bench tests for grow, new, add_back, add_front, to expose how slow
these functions are.
2013-07-06 05:42:45 +02:00
blake2-ppc
5a37cf8a31 deque: Fix grow condition in add_front
Without this, it will hit the assert in fn grow after 32 consecutive
add_front.
2013-07-06 05:42:45 +02:00
Daniel Micay
51eb1e14d4 str: stop encoding invalid out-of-range char 2013-07-05 21:07:37 -04:00
Gary Linscott
37494d39d3 Switch json parsing to read_chars for performance
Avoids the overhead of read_char for every character.

Benchmark reading example.json 10 times from
https://code.google.com/p/rapidjson/wiki/Performance

Before: 2.55s
After:  0.16s

Regression testing is already done by isrustfastyet.
2013-07-05 19:40:01 -04:00
blake2-ppc
fc17d4371f vec: Add .shift_opt() -> Option<T>
Add a function to safely retrieve the first element of a ~[T], as
Option<T>. Implement shift() using shift_opt().

Add tests for both .shift() and .shift_opt()
2013-07-05 20:32:25 +02:00
blake2-ppc
d805b832f5 vec: Add .pop_opt() -> Option<T>
Add a function to safely retrieve the last element of a ~[T], as
Option<T>. Implement pop() using pop_opt(); it benches the same as the
old implementation when tested with optimization level 2.
2013-07-05 20:32:25 +02:00
bors
58eb70a5e2 auto merge of #7554 : jld/rust/rm-ssoe, r=catamorphism 2013-07-05 04:28:56 -07:00
Kevin Ballard
20016b92c8 Implement .size_hint() on the remaining Iterator adaptors
Every iterator adaptor now has an implementation of .size_hint() that
makes sense, except for when the default of (0, None) is correct.
2013-07-05 01:56:48 -07:00
Kevin Ballard
dc9b3ff1b3 Change signature of Iterator.size_hint
Remove the Option wrapper around the lower bound. None is semantically
the same as Size(0), so there's no point in having a distinction.
2013-07-05 01:56:48 -07:00
Seo Sanghyeon
376d5d6aae Fix fallout from span change 2013-07-05 14:56:54 +09:00
Seo Sanghyeon
30fca57f17 Change spans for sugary call expressions 2013-07-05 13:03:25 +09:00
Seo Sanghyeon
20458899d5 vim: Highlight 0i as number 2013-07-05 13:03:15 +09:00
Seo Sanghyeon
2e65782c17 Do not rely on newtype enum dereference 2013-07-05 13:03:04 +09:00
Seo Sanghyeon
c9b9462e8f Remove visit_struct_method 2013-07-05 13:02:43 +09:00
bors
8c50ee3916 auto merge of #7530 : alexcrichton/rust/issue-5194, r=thestinger
Closes #5194
2013-07-04 20:53:00 -07:00
Chris Morgan
b6024e4ca2 Remove superfluous super::super:: 2013-07-05 13:07:10 +10:00
bors
e89dcb887b auto merge of #7549 : sfackler/rust/docs, r=msullivan
I'm leaving the Sized kind undocumented since it isn't fully implemented
yet.
2013-07-04 19:01:54 -07:00
Chris Morgan
bbfef92e3d Move extra::net_* to extra::net::* properly.
Where * = tcp, ip, url.

Formerly, extra::net::* were aliases of extra::net_*, but were the
recommended path to use. Thus, the documentation talked of the `net_*`
modules while everything else was written expecting `net::*`.

This moves the actual modules so that `extra::net::*` is the actual
location of the modules.

This will naturally break any code which used `extra::net_*` directly.
They should be altered to use `extra::net::*` (which has been the
documented way of doing things for some time).

This ensures that there is one, and only one, obvious way of doing
things.
2013-07-05 10:16:04 +10:00
Alex Crichton
8552a74775 Bring compiletest/rustpkg/driver up to date on std vs core 2013-07-04 16:30:48 -07:00
bors
b055a10662 auto merge of #7545 : msullivan/rust/default-methods, r=catamorphism
r?
2013-07-04 13:49:53 -07:00
bors
f8507778a3 auto merge of #7547 : luqmana/rust/mingw64, r=yichoi
Add the x64 windows target to platform.mk and reorder some headers to fix build on mingw64. There are still some issues with building llvm but this gets us one step closer.
2013-07-04 12:07:56 -07:00
Philipp Brüschweiler
3c5cfdf2e7 libsyntax: fix infinite loop when recursively including modules
Fixes #7276
2013-07-04 19:51:11 +02:00
bors
3d7c1ddf74 auto merge of #7513 : sfackler/rust/master, r=msullivan
The Base64 package previously had extremely basic functionality. It only
suported the standard encoding character set, didn't support line breaks
and always padded output. This commit makes it significantly more
powerful.

The FromBase64 impl now supports all of the standard variants of Base64.
It ignores newlines,interprets '-' and '_' as well as '+' and '/' and
doesn't require padding. It isn't incredibly pedantic and will
successfully parse strings that are not strictly valid, but I don't
think the extra complexity required to make it accept _only_ valid
strings is worth it.

The ToBase64 trait has been modified such that to_base64 now takes a
base64::Config struct which contains the output format configuration.
This currently includes the selection of character set (standard or
url safe), whether or not to pad and an optional line break width. The
package comes with three static Config structs for the RFC 4648
standard, RFC 4648 url safe and RFC 2045 MIME formats.

The other option for configuring ToBase64 output would be to have one
method with the configuration flags passed and other traits with default
impls for the common cases, but I think that's a little messier.

FromBase64 still kills the task if you pass it invalid input, which isn't
particularly appropriate for a function into which you'll be passing
unvalidated input. Would it be worth changing its signature to return a
Result?
2013-07-04 10:25:59 -07:00
Aljaž "g5pw" Srebrnič
e9ce97cc2a Copy the correct libs when using local-rust-root
This fixes a segfault when configuring rust to use local-rust-root. The
libraries were renamed in the 0.6-0.7 transition, and the script was not copying
them all. I also removed the line referencing libcore (now libstd).
2013-07-04 16:18:05 +02:00
Armin Ronacher
8cb1a290a8 Removed drop from the keyword list in the docs 2013-07-04 11:56:11 +02:00
bors
e07e9bbf36 auto merge of #7543 : sanxiyn/rust/newtype-immediates, r=catamorphism
Fix #6612. Rebase of #6725. Fixed an additional bug and added a test.
2013-07-03 23:31:56 -07:00
Alex Crichton
e80dcf700b Use #[allow(warnings)] in rusti instead of explicitly listing warnings 2013-07-03 23:26:38 -07:00
Daniel Micay
dd4f6bb2a2 Merge pull request #7565 from Blei/fix-rev-size-hint
vec: Fix size_hint() of reverse iterators
2013-07-03 22:07:20 -07:00
Alex Crichton
fe4a15886c Fail when a vec::reserve is too large 2013-07-03 20:59:34 -07:00
Luqman Aden
5007fb2d4d Add x64 windows to platform.mk and mingw64 header fixes. 2013-07-03 23:33:59 -04:00
Steven Fackler
e9988c1e2d Upper-cased exported statics 2013-07-03 23:33:55 -04:00
Daniel Micay
23da380291 force LLVM clean 2013-07-03 23:23:29 -04:00
Steven Fackler
1482cf5ded Base64 API changes
There's now an enum to pick the character set instead of a url_safe
bool.

from_base64 now returns a Result<~[u8], ~str> and returns an Err instead
of killing the task when it is called on invalid input.

Fixed documentation examples.
2013-07-03 22:45:39 -04:00
Steven Fackler
5a8a30f45b Added functionality to Base64 package
The Base64 package previously had extremely basic functionality. It only
suported the standard encoding character set, didn't support line breaks
and always padded output. This commit makes it significantly more
powerful.

The FromBase64 impl now supports all of the standard variants of Base64.
It ignores newlines,interprets '-' and '_' as well as '+' and '/' and
doesn't require padding. It isn't incredibly pedantic and will
successfully parse strings that are not strictly valid, but I don't
think the extra complexity required to make it accept _only_ valid
strings is worth it.

The ToBase64 trait has been modified such that to_base64 now takes a
base64::Config struct which contains the output format configuration.
This currently includes the selection of character set (standard or
url safe), whether or not to pad and an optional line break width. The
package comes with three static Config structs for the RFC 4648
standard, RFC 4648 url safe and RFC 2045 MIME formats.

The other option for configuring ToBase64 output would be to have one
method with the configuration flags passed and other traits with default
impls for the common cases, but I think that's a little messier.
2013-07-03 22:45:38 -04:00
Graydon Hoare
f80d6dc4c1 rustc: improve -Z trans-stats to report per-fn LLVM instruction counts and translation timing 2013-07-03 18:06:36 -07:00
bors
3c0a1621b5 auto merge of #7542 : alexcrichton/rust/patch-rusti, r=cmr
Doesn't disable it completely, also removes the bogus `rc` file.
2013-07-03 17:40:56 -07:00
Gareth Smith
908a22b626 Address @catamorphism's error message grammar nit. 2013-07-03 23:43:03 +01:00
bors
648c5e9c92 auto merge of #7534 : bblum/rust/soundness-messages, r=catamorphism 2013-07-03 15:25:55 -07:00
Brian Anderson
1098d6980b Merge remote-tracking branch 'mozilla/master'
Conflicts:
	src/libextra/test.rs
	src/libstd/at_vec.rs
	src/libstd/cleanup.rs
	src/libstd/rt/comm.rs
	src/libstd/rt/global_heap.rs
	src/libstd/task/spawn.rs
	src/libstd/unstable/lang.rs
	src/libstd/vec.rs
	src/rt/rustrt.def.in
	src/test/run-pass/extern-pub.rs
2013-07-03 14:49:13 -07:00
Gareth Smith
656c8f9143 Make the error messages that result from referencing
nonexistent traits consistent, and add a test.
2013-07-03 22:16:08 +01:00
Michael Sullivan
7238d5a141 Make privacy checking on default methods for cross crate structs not fail. Closes #7481.
It is unclear to me that the way method call privacy checking is done
makes any sense, though. It is only performed if the type is a
struct...
2013-07-03 09:59:45 -07:00
Michael Sullivan
419a14772a Fix make_mono_id to take into account self types. Closes #7536. 2013-07-03 09:59:45 -07:00
bors
0c6fc46c03 auto merge of #7566 : huonw/rust/vec-kill, r=cmr
The last remaining internal iterator in `vec` is `each_permutation`.
2013-07-03 08:16:54 -07:00
Huon Wilson
cdea73cf5b Convert vec::{as_imm_buf, as_mut_buf} to methods. 2013-07-04 00:46:50 +10:00
Huon Wilson
a732a2daff Convert vec::windowed to an external iterator, and add an n-at-a-time chunk iterator. 2013-07-04 00:46:50 +10:00
Huon Wilson
944d904ad4 Convert vec::{split, splitn, rsplit, rsplitn} to external iterators. 2013-07-04 00:46:50 +10:00
Huon Wilson
f19fb2459f Remove standalone comparison functions in vec, make the trait impls better. 2013-07-04 00:46:50 +10:00
Huon Wilson
9207802589 Remove vec::reversed, replaced by iterators. 2013-07-04 00:46:50 +10:00