Commit Graph

26097 Commits

Author SHA1 Message Date
Brendan Zabarauskas
78cb1e2ab0 Make semver::Version fields public 2014-02-07 17:19:21 +11:00
bors
9a9a70b3fd auto merge of #12047 : huonw/rust/cyclic-rc, r=thestinger
A weak pointer inside itself will have its destructor run when the last
strong pointer to that data disappears, so we need to make sure that the
Weak and Rc destructors don't duplicate work (i.e. freeing).

By making the Rcs effectively take a weak pointer, we ensure that no
Weak destructor will free the pointer while still ensuring that Weak
pointers can't be upgraded to strong ones as the destructors run.

This approach of starting weak at 1 is what libstdc++ does.

Fixes #12046.
2014-02-06 03:11:39 -08:00
bors
d8c4e78603 auto merge of #12001 : yuriks/rust/getopts-tweaks, r=brson
This complements `usage` by auto-generating a short one-liner summary
of the options.

(First timer here, be gentle... :)
2014-02-06 00:01:34 -08:00
bors
8dc06802b2 auto merge of #12054 : alexcrichton/rust/less-flaky-udp, r=brson
I have a hunch this just deadlocked the windows bots. Due to UDP being a lossy
protocol, I don't think we can guarantee that the server can receive both
packets, so just listen for one of them.
2014-02-05 22:46:33 -08:00
Alex Crichton
7b81cc09c1 Make a double-write UDP test more robust
I have a hunch this just deadlocked the windows bots. Due to UDP being a lossy
protocol, I don't think we can guarantee that the server can receive both
packets, so just listen for one of them.
2014-02-05 18:47:49 -08:00
bors
9a672f98e5 auto merge of #11989 : adridu59/rust/tidy, r=alexcrichton
Closes #11985
Closes #4533

@huonw, @alexcrichton
2014-02-05 18:31:36 -08:00
Huon Wilson
da45340ab8 Ensure an Rc isn't freed while running its own destructor.
A weak pointer inside itself will have its destructor run when the last
strong pointer to that data disappears, so we need to make sure that the
Weak and Rc destructors don't duplicate work (i.e. freeing).

By making the Rcs effectively take a weak pointer, we ensure that no
Weak destructor will free the pointer while still ensuring that Weak
pointers can't be upgraded to strong ones as the destructors run.

This approach of starting weak at 1 is what libstdc++ does.

Fixes #12046.
2014-02-06 09:05:59 +11:00
bors
6aad3bf944 auto merge of #11894 : alexcrichton/rust/io-clone, r=brson
This is part of the overall strategy I would like to take when approaching
issue #11165. The only two I/O objects that reasonably want to be "split" are
the network stream objects. Everything else can be "split" by just creating
another version.

The initial idea I had was the literally split the object into a reader and a
writer half, but that would just introduce lots of clutter with extra interfaces
that were a little unnnecssary, or it would return a ~Reader and a ~Writer which
means you couldn't access things like the remote peer name or local socket name.

The solution I found to be nicer was to just clone the stream itself. The clone
is just a clone of the handle, nothing fancy going on at the kernel level.
Conceptually I found this very easy to wrap my head around (everything else
supports clone()), and it solved the "split" problem at the same time.

The cloning support is pretty specific per platform/lib combination:

* native/win32 - uses some specific WSA apis to clone the SOCKET handle
* native/unix - uses dup() to get another file descriptor
* green/all - This is where things get interesting. When we support full clones
              of a handle, this implies that we're allowing simultaneous writes
              and reads to happen. It turns out that libuv doesn't support two
              simultaneous reads or writes of the same object. It does support
              *one* read and *one* write at the same time, however. Some extra
              infrastructure was added to just block concurrent writers/readers
              until the previous read/write operation was completed.

I've added tests to the tcp/unix modules to make sure that this functionality is
supported everywhere.
2014-02-05 12:56:34 -08:00
Alex Crichton
56080c4767 Implement clone() for TCP/UDP/Unix sockets
This is part of the overall strategy I would like to take when approaching
issue #11165. The only two I/O objects that reasonably want to be "split" are
the network stream objects. Everything else can be "split" by just creating
another version.

The initial idea I had was the literally split the object into a reader and a
writer half, but that would just introduce lots of clutter with extra interfaces
that were a little unnnecssary, or it would return a ~Reader and a ~Writer which
means you couldn't access things like the remote peer name or local socket name.

The solution I found to be nicer was to just clone the stream itself. The clone
is just a clone of the handle, nothing fancy going on at the kernel level.
Conceptually I found this very easy to wrap my head around (everything else
supports clone()), and it solved the "split" problem at the same time.

The cloning support is pretty specific per platform/lib combination:

* native/win32 - uses some specific WSA apis to clone the SOCKET handle
* native/unix - uses dup() to get another file descriptor
* green/all - This is where things get interesting. When we support full clones
              of a handle, this implies that we're allowing simultaneous writes
              and reads to happen. It turns out that libuv doesn't support two
              simultaneous reads or writes of the same object. It does support
              *one* read and *one* write at the same time, however. Some extra
              infrastructure was added to just block concurrent writers/readers
              until the previous read/write operation was completed.

I've added tests to the tcp/unix modules to make sure that this functionality is
supported everywhere.
2014-02-05 11:43:49 -08:00
Adrien Tétar
611c7a6fa5 rustdoc: update deps 2014-02-05 19:54:01 +01:00
Adrien Tétar
0ebe112b3b etc: add missing license boilerplates 2014-02-05 19:53:53 +01:00
Adrien Tétar
fc1d655ed2 etc/tidy: don't check SNAP against triple 2014-02-05 19:53:46 +01:00
bors
55684ba13f auto merge of #11984 : olsonjeffery/rust/libserialize, r=alexcrichton
- `extra::json` didn't make the cut, because of `extra::json`'s required
   dep on `extra::TreeMap`. If/when `extra::TreeMap` moves out of `extra`,
   then `extra::json` could move into `libserialize`
- `libextra`, `libsyntax` and `librustc` depend on the newly created
  `libserialize`
- The extensions to various `extra` types like `DList`, `RingBuf`, `TreeMap`
  and `TreeSet` for `Encodable`/`Decodable` were moved into the respective
  modules in `extra`
- There is some trickery, evident in `src/libextra/lib.rs` where a stub
  of `extra::serialize` is set up (in `src/libextra/serialize.rs`) for
  use in the stage0 build, where the snapshot rustc is still making
  deriving for `Encodable` and `Decodable` point at extra. Big props to
  @huonw for help working out the re-export solution for this
- @pcwalton's change in 449a7a8 didn't sneak back in
2014-02-05 10:41:34 -08:00
Jeff Olson
b8852e89ce pull extra::{serialize, ebml} into a separate libserialize crate
- `extra::json` didn't make the cut, because of `extra::json` required
   dep on `extra::TreeMap`. If/when `extra::TreeMap` moves out of `extra`,
   then `extra::json` could move into `serialize`
- `libextra`, `libsyntax` and `librustc` depend on the newly created
  `libserialize`
- The extensions to various `extra` types like `DList`, `RingBuf`, `TreeMap`
  and `TreeSet` for `Encodable`/`Decodable` were moved into the respective
  modules in `extra`
- There is some trickery, evident in `src/libextra/lib.rs` where a stub
  of `extra::serialize` is set up (in `src/libextra/serialize.rs`) for
  use in the stage0 build, where the snapshot rustc is still making
  deriving for `Encodable` and `Decodable` point at extra. Big props to
  @huonw for help working out the re-export solution for this

extra: inline extra::serialize stub

fix stuff clobbered in rebase + don't reexport serialize::serialize

no more globs in libserialize

syntax: fix import of libserialize traits

librustc: fix bad imports in encoder/decoder

add serialize dep to librustdoc

fix failing run-pass tests w/ serialize dep

adjust uuid dep

more rebase de-clobbering for libserialize

fixing tests, pushing libextra dep into cfg(test)

fix doc code in extra::json

adjust index.md links to serialize and uuid library
2014-02-05 10:38:22 -08:00
bors
2bf575c86f auto merge of #11939 : JeremyLetang/rust/move-libsync, r=alexcrichton
This time everything should be okay, No break due to a failed merge or rebase...

Sorry for the abuse of pull request.

So this move extra::sync, extra::arc, extra::future, extra::comm and extra::task_pool to libsync.
2014-02-05 09:21:34 -08:00
JeremyLetang
dd21a51d29 move concurrent stuff from libextra to libsync 2014-02-05 11:56:04 -05:00
bors
faf60551ec auto merge of #12045 : thestinger/rust/glue, r=pcwalton
A solid step towards fixing #11998. Eventually, the size may always be
passed to `exchange_free` but this will not be required to fix the bug.
2014-02-05 08:06:37 -08:00
bors
ed885e35fe auto merge of #12035 : chromatic/rust/tutorial_improvements, r=alexcrichton
This cleans up a warning about an unused variable and explains the code
further.
2014-02-05 03:16:35 -08:00
bors
53864ce512 auto merge of #12025 : lilac/rust/feature-gate-quote, r=brson
Closes #11630.
2014-02-05 01:06:32 -08:00
Daniel Micay
1778b63616 stop calling exchange_free on 0-size types
A solid step towards fixing #11998. Eventually, the size may always be
passed to `exchange_free` but this will not be required to fix the bug.
2014-02-05 03:05:36 -05:00
bors
1bcc73fe9d auto merge of #12023 : nick29581/rust/err_res, r=alexcrichton
closes #3512
2014-02-04 23:46:37 -08:00
bors
4509b49451 auto merge of #12018 : alexcrichton/rust/triage, r=sfackler
Mostly just test suite modifications.
2014-02-04 21:46:35 -08:00
bors
28f277b909 auto merge of #12014 : eddyb/rust/less-copies, r=cmr 2014-02-04 18:41:38 -08:00
Alex Crichton
50bdeb9a34 Run all target crate tests on the windows/try bots
Previously, the check-fast and check-lite test suites weren't picking up all
target crates, rather just std/extra. In order to ensure that all of our crates
work on windows, I've modified these rules to build the test suites for all
TARGET_CRATES members. Note that this still excludes rustc/syntax/rustdoc.
2014-02-04 18:05:13 -08:00
Alex Crichton
03c28b4ac5 Make cfail test error messages more precise
Closes #3192
2014-02-04 18:05:13 -08:00
Alex Crichton
8a1dda92ba Adding tests for closed issues
Closes #5521
Closes #9396
Closes #10714
2014-02-04 18:05:13 -08:00
chromatic
87d026b76e Improved pattern-match code and explanation.
This cleans up a warning about an unused variable and explains the code
further.
2014-02-04 16:11:32 -08:00
bors
acb1ec0b67 auto merge of #11230 : csherratt/rust/cow, r=alexcrichton
This allows patch adds a new arc type that allows for creation of copy-on-write data structures. The idea is that it is safe to mutate any data structure as long as it has only one reference to it. If there are multiple, it requires cloning of the data structure before mutation is possible.
2014-02-04 14:41:36 -08:00
Nick Cameron
8d8c7835f7 Check for trait impl conflicts across crates 2014-02-05 08:50:05 +13:00
Eduard Burtescu
01815b3920 Don't copy arguments passed by value with indirection to allocas. 2014-02-04 20:53:58 +02:00
bors
ef53b7a97c auto merge of #12026 : alexcrichton/rust/snapshots, r=cmr 2014-02-04 06:31:34 -08:00
bors
cdc678945f auto merge of #11951 : dmanescu/rust/reserve-rename, r=huonw
Changes in std::{str,vec,hashmap} and extra::{priority_queue,ringbuf}.
Fixes #11949
2014-02-04 04:31:34 -08:00
James Deng
124938bcf5 Replaced with a single "quote" feature gate. 2014-02-04 22:03:00 +11:00
bors
10de762f6c auto merge of #11717 : DiamondLovesYou/rust/master, r=alexcrichton
Note that it still doesn't allow generic types to be marked with #[simd].
2014-02-04 01:11:34 -08:00
Richard Diamond
7becc0f34c Added missing xfail-fast. 2014-02-04 02:26:02 -06:00
Alex Crichton
6c41192c41 Register new snapshots 2014-02-04 00:06:08 -08:00
Richard Diamond
63ba2e1219 Simd feature gating + Win32/64 fixes. 2014-02-04 01:04:19 -06:00
James Deng
38f2526beb Feature gate all quasi-quoting macros. 2014-02-04 16:35:57 +11:00
bors
e99fe7e4b9 auto merge of #11912 : poiru/rust/8784-libuuid, r=alexcrichton
cc #8784
2014-02-03 21:21:32 -08:00
Birunthan Mohanathas
f8afc9a5c1 extra: Move uuid to libuuid
cc #8784
2014-02-04 06:44:02 +02:00
bors
346d378ad5 auto merge of #12022 : alexcrichton/rust/unblock-snapshot, r=thestinger
cc #12021
2014-02-03 19:41:31 -08:00
bors
c1395ea588 auto merge of #11999 : joaoxsouls/rust/master, r=cmr 2014-02-03 17:46:37 -08:00
David Manescu
65f3578148 Rename reserve to reserve_exact and reserve_at_least to reserve
Changes in std::{str,vec,hashmap} and extra::{priority_queue,ringbuf}.
Fixes #11949
2014-02-04 12:33:41 +11:00
Alex Crichton
882b4829ce xfail a test to unblock the snapshot
cc #12021
2014-02-03 17:12:52 -08:00
bors
2877928b22 auto merge of #12016 : FlaPer87/rust/remove-non-copyable, r=alexcrichton
cc #10834
2014-02-03 16:31:33 -08:00
joaoxsouls
b69c81c9e0 doc: update boxes section on Manual, remove managed pointers references 2014-02-04 00:07:16 +00:00
Flavio Percoco
c6b1bce96f Replace NonCopyable usage with NoPod
cc #10834
2014-02-04 00:15:27 +01:00
bors
fde11e7ae5 auto merge of #12012 : omasanori/rust/semver, r=alexcrichton
Done as a part of #8784.
2014-02-03 15:11:44 -08:00
bors
d42521aa92 auto merge of #11866 : alexcrichton/rust/atomic-u64, r=brson
Let's try this again.

This is an implementation of mutexes which I believe is free from undefined behavior of OS mutexes (the pitfall of the previous implementation).

This implementation is not ideal. There's a yield-loop spot, and it's not particularly fair with respect to lockers who steal without going through the normal code paths. That being said, I believe that this is a correct implementation which is a stepping stone to move from.

I haven't done rigorous benchmarking of this mutex, but preliminary results show that it's about 25% slower in the uncontended case on linux (same runtime on OSX), and it's actually faster than a pthreads mutex on high contention (again, not rigorous benchmarking, I just saw these numbers come up).
2014-02-03 13:11:35 -08:00
Alex Crichton
acacfb20fd Various bug fixes and rebase conflicts 2014-02-03 12:05:16 -08:00