Commit Graph

21085 Commits

Author SHA1 Message Date
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
Stepan Koltsov
b9945f83c9 Add #[inline] to impl Zero for ()
Follow-up to #8155
2013-08-09 02:19:50 +04:00
Tim Chevalier
e751c90513 Makefiles: make rustpkgtest depend on rustpkg executable 2013-08-08 15:17:28 -07:00
Tim Chevalier
7c1eb83052 rustpkg: Eliminate a copy 2013-08-08 15:17:28 -07:00
Maxim Kolganov
b4fe856645 typo in tutorial 2013-08-09 01:43:44 +04:00
bors
8f65dbfcfa auto merge of #8385 : cmr/rust/big-rollup, r=alexcrichton
This is a fairly large rollup, but I've tested everything locally, and none of
it should be platform-specific.

r=alexcrichton (bdfdbdd)
r=brson (d803c18)
r=alexcrichton (a5041d0)
r=bstrie (317412a)
r=alexcrichton (135c85e)
r=thestinger (8805baa)
r=pcwalton (0661178)
r=cmr (9397fe0)
r=cmr (caa4135)
r=cmr (6a21d93)
r=cmr (4dc3379)
r=cmr (0aa5154)
r=cmr (18be261)
r=thestinger (f10be03)
2013-08-08 14:32:02 -07:00
toddaaro
af2e03998d Enabled workstealing in the scheduler. Previously we had one global work queue shared by each scheduler. Now there is a separate work queue for each scheduler, and work is "stolen" from other queues when it is exhausted locally. 2013-08-08 14:13:41 -07:00
blake2-ppc
06783ce831 std::vec: Fix typo in fn ne 2013-08-08 23:07:24 +02:00
Corey Richardson
878e74e1ce Fix more priv fallout 2013-08-08 17:02:03 -04:00
blake2-ppc
8ed8a41c62 std::iterator::order test cases 2013-08-08 22:07:22 +02:00
blake2-ppc
5dde29c947 std: Fix tuple lexicographical order
Use the definition, where R is <, <=, >=, or >

    [x, ..xs] R [y, ..ys]  =  if x != y { x R y } else { xs R ys }

Previously, tuples would only implement < and derive the other
comparisons from it; this is incorrect. Included are several testcases
involving NaN comparisons that are now correct.

Previously, tuples would consider an element equal if both a < b and
b < a were false, this was also incorrect.
2013-08-08 22:07:22 +02:00
blake2-ppc
86da55e85b std: Fix Ord for Option, using iterator::order 2013-08-08 22:07:22 +02:00
blake2-ppc
9cac4ccc90 std::vec: Use iterator::order functions for Eq, Ord, TotalOrd, TotalEq 2013-08-08 22:07:21 +02:00
blake2-ppc
e0b08533b4 std: Implement traits for the one-tuple
(A,) did not have the trait implementations of 2- to 12- tuples.
2013-08-08 22:07:21 +02:00
blake2-ppc
a2e3cdfc36 extra::dlist: Use iterator::order for sequence ordering 2013-08-08 22:07:21 +02:00
blake2-ppc
5d9fd882b7 Add std::iterator::order with lexical ordering functions for sequences
Use Eq + Ord for lexicographical ordering of sequences.

For each of <, <=, >= or > as R, use::

    [x, ..xs] R [y, ..ys]  =  if x != y { x R y } else { xs R ys }

Previous code using `a < b` and then `!(b < a)` for short-circuiting
fails on cases such as  [1.0, 2.0] < [0.0/0.0, 3.0], where the first
element was effectively considered equal.
2013-08-08 22:07:21 +02:00
Corey Richardson
86d581f83b xfail-fast an aux test 2013-08-08 15:34:59 -04:00
Steven Fackler
c3825c8351 env! syntax extension changes
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.

Close #2248
2013-08-08 10:35:42 -07:00
Erick Tryzelaar
03cc757fe9 std: more fixes for os.rs for windows 2013-08-08 06:37:55 -07:00
Paul Collins
3596f666bb rust-mode: make indentation customizable
Add new variable rust-indent-offset, defaulting to
the old value, and use it.
2013-08-08 19:25:21 +12:00
bors
a0080f4e07 auto merge of #8245 : alexcrichton/rust/fmt2, r=graydon
This is a reopening of #8182, although this removes any abuse of the compiler internals. Now it's just a pure syntax extension (hard coded what the attribute names are).
2013-08-08 00:22:52 -07:00
Erick Tryzelaar
7a5ee374e2 std: import HANDLE for os::list_dir for windows 2013-08-07 21:07:06 -07:00
Erick Tryzelaar
e7f0882214 Fix a stack to use the new .to_c_str() api 2013-08-07 20:25:38 -07:00
Corey Richardson
0627089bba Fix fallout 2013-08-07 23:20:06 -04:00
Ben Blum
fb1575bcc4 (cleanup) Improve rtabort message for atomic-sleep. 2013-08-07 22:41:15 -04:00
Ben Blum
8ebdb37fd2 fix recv_ready for Port to take &self and not need to return a tuple. Close #8192. 2013-08-07 22:41:15 -04:00
blake2-ppc
898226f39a extra: Remove all each_* methods in treemap
.each_key(), .each_value() and the other methods are replaced by .iter()
and .rev_iter(), and restrictions of those iterators.
2013-08-07 22:41:15 -04:00
blake2-ppc
7afface3ff extra: Implement .rev_iter() in treemap
Implement reverse iterators for TreeMap and TreeSet, that produce the
keys in backward order.
2013-08-07 22:41:14 -04:00
blake2-ppc
52b01c50cb extra: External iterators for TreeSet set operations
Write external iterators for Difference, Sym. Difference, Intersection
and Union set operations.

These iterators are generic insofar that they could work on any ordered
sequence iterators, even though they are type specialized to the
TreeSetIterator in this case.

Looking at the `check` function in the treeset tests, rustc seems
unwilling to compile a function resembling::

    fn check<'a, T: Iterator<&'a int>>(... )

so the tests for these iterators are still running the legacy loop
protocol.
2013-08-07 22:41:14 -04:00
blake2-ppc
4ab05f91f4 extra: Simplify Eq/Ord in treemap
Write the Eq and Ord impls for TreeMap in a more straightforward way
using iterator::Zip
2013-08-07 22:41:14 -04:00
Simon Sapin
240f8f03c9 Gedit/gtksourceview language spec: add 'in' keyword 2013-08-07 22:41:14 -04:00
Huon Wilson
8460dac909 std: add missing #[inline] annotation to the f64 arithmetic trait impls. 2013-08-07 22:41:14 -04:00
Do Nhat Minh
a185343fc4 misc help message fix 2013-08-07 22:41:14 -04:00
Alex Crichton
1b103912ea Add some documentation about globals in ffi docs 2013-08-07 22:41:14 -04:00
Jordi Boggiano
403c52d2ae Add weak_rng to get a random algo that puts more emphasis on speed than security 2013-08-07 22:41:14 -04:00
Jordi Boggiano
3db9dc1dfd Document rand module with more emphasis on cryptographic security 2013-08-07 22:41:13 -04:00
Sangeun Kim
a9b7bec2e7 Change const to static 2013-08-07 22:41:13 -04:00
Sangeun Kim
19d0eb9060 Change Freeze to Static 2013-08-07 22:41:13 -04:00
Alex Crichton
ffd80aa276 Fix unit structs in cross-crate situtations 2013-08-07 22:41:13 -04:00
darkf
cc160a0028 extra: add internal to {de,in}flate_bytes_ naming to address nit 2013-08-07 22:41:13 -04:00
darkf
dd5e8b218f add extra::flate::deflate_bytes_zlib and a test 2013-08-07 22:41:13 -04:00
darkf
9b221f56f1 add inflate_bytes_zlib to exra::flate 2013-08-07 22:41:13 -04:00