Commit Graph

26374 Commits

Author SHA1 Message Date
bors
d394a48e73 auto merge of #12196 : dguenther/rust/fix-fourcc-example, r=alexcrichton
Cleans up a few issues with `fourcc`:
* Corrects the endianness in the docs example
* Removes `#[cfg(not(test))]` (bors might not build this on Windows. If the build fails, I'll re-add it)
* Adds a FIXME referencing the LLVM assert issue we encountered with bors builds on Windows (Same error as #10872)
2014-02-12 06:21:44 -08:00
bors
fb12aebbd8 auto merge of #12180 : eddyb/rust/rm-ty_type, r=nikomatsakis 2014-02-12 04:36:43 -08:00
Eduard Burtescu
54760b9f27 Removed ty_type (previously used to represent *tydesc). 2014-02-12 14:17:06 +02:00
Matthijs van der Vleuten
4f72c018ce doc: rename 'nil' to 'unit' when describing () 2014-02-12 13:11:12 +01:00
bors
e192cd97e7 auto merge of #12194 : WebeWizard/rust/master, r=cmr 2014-02-12 03:21:44 -08:00
bors
2ca02eae1c auto merge of #12190 : alexcrichton/rust/fix-snap-again, r=brson
Loadable syntax extensions don't work when cross compiling (see #12102), so the
fourcc tests all need to be ignored. They're valuable tests, so they shouldn't
be outright ignored, so they're now flagged with ignore-cross-compile
2014-02-12 01:36:45 -08:00
bors
975908dd58 auto merge of #12185 : nikomatsakis/rust/issue-12033-tweak-test, r=alexchrichton 2014-02-11 23:06:44 -08:00
bors
db264b4a70 auto merge of #12184 : JeremyLetang/rust/rustpkg-link, r=alexcrichton 2014-02-11 21:51:46 -08:00
Alex Crichton
1b6a1e98a8 Finalize the Seek API
This adopts the rules posted in #10432:

1. If a seek position is negative, then an error is generated
2. Seeks beyond the end-of-file are allowed. Future writes will fill the gap
   with data and future reads will return errors.
3. Seeks within the bounds of a file are fine.

Closes #10432
2014-02-11 20:18:34 -08:00
bors
11bc14d724 auto merge of #11578 : alexcrichton/rust/chan-changes, r=brson
The user-facing API-level change of this commit is that `SharedChan` is gone and `Chan` now has `clone`. The major parts of this patch are the internals which have changed.

Channels are now internally upgraded from oneshots to streams to shared channels depending on the use case. I've noticed a 3x improvement in the oneshot case and very little slowdown (if any) in the stream/shared case.

This patch is mostly a reorganization of the `std::comm` module, and the large increase in code is from either dispatching to one of 3 impls or the duplication between the stream/shared impl (because they're not entirely separate).

The `comm` module is now divided into `oneshot`, `stream`, `shared`, and `select` modules. Each module contains the implementation for that flavor of channel (or the select implementation for select).

Some notable parts of this patch

* Upgrades are done through a semi-ad-hoc scheme for oneshots and messages for streams
* Upgrades are processed ASAP and have some interesting interactions with select
* send_deferred is gone because I expect the mutex to land before this
* Some of stream/shared is straight-up duplicated, but I like having the distinction between the two modules
* Select got a little worse, but it's still "basically limping along"
* This lumps in the patch of deallocating the queue backlog on packet drop
* I'll rebase this on top of the "more errors from try_recv" patch once it lands (all the infrastructure is here already)

All in all, this shouldn't be merged until the new mutexes are merged (because send_deferred wasn't implemented).

Closes #11351
2014-02-11 20:16:47 -08:00
Alex Crichton
e633249b31 Test fixes and rebase conflicts 2014-02-11 19:58:44 -08:00
bors
db8a580fb4 auto merge of #12027 : vadimcn/rust/compiler-rt, r=alexcrichton
This is an attempt to remove some more of Rust's dependencies on libgcc and replace it with LLVM's compiler-rt lib.  I've added compiler-rt as a submodule and changed libstd to link with it.  
As far as I could verify, after this change, the only symbols still imported by std from libgcc are the stack unwinding functions.   Other crates, however, still picked up symbols from libgcc, not from libstd, as I had hoped.  So linking definitely requires some work. 

I've only tested this on windows, 32-bit linux and android and fully expect it to fail on other platforms. Patches are welcome.
2014-02-11 18:21:49 -08:00
Alex Crichton
0a6b9219d1 Rewrite channels yet again for upgradeability
This, the Nth rewrite of channels, is not a rewrite of the core logic behind
channels, but rather their API usage. In the past, we had the distinction
between oneshot, stream, and shared channels, but the most recent rewrite
dropped oneshots in favor of streams and shared channels.

This distinction of stream vs shared has shown that it's not quite what we'd
like either, and this moves the `std::comm` module in the direction of "one
channel to rule them all". There now remains only one Chan and one Port.

This new channel is actually a hybrid oneshot/stream/shared channel under the
hood in order to optimize for the use cases in question. Additionally, this also
reduces the cognitive burden of having to choose between a Chan or a SharedChan
in an API.

My simple benchmarks show no reduction in efficiency over the existing channels
today, and a 3x improvement in the oneshot case. I sadly don't have a
pre-last-rewrite compiler to test out the old old oneshots, but I would imagine
that the performance is comparable, but slightly slower (due to atomic reference
counting).

This commit also brings the bonus bugfix to channels that the pending queue of
messages are all dropped when a Port disappears rather then when both the Port
and the Chan disappear.
2014-02-11 16:32:00 -08:00
Alex Crichton
47ef20014c Shuffle around ownership in concurrent queues
Beforehand, using a concurrent queue always mandated that the "shared state" be
stored internally to the queues in order to provide a safe interface. This isn't
quite as flexible as one would want in some circumstances, so instead this
commit moves the queues to not containing the shared state.

The queues no longer have a "default useful safe" interface, but rather a
"default safe" interface (minus the useful part). The queues have to be shared
manually through an Arc or some other means. This allows them to be a little
more flexible at the cost of a usability hindrance.

I plan on using this new flexibility to upgrade a channel to a shared channel
seamlessly.
2014-02-11 16:32:00 -08:00
bors
a4a908eafd auto merge of #11961 : niftynif/rust/btree, r=brson
I implemented an add method for the btree in progress.  It is intended to be refactored later using an alternative to .clone() that passes the borrow checker, but for now, it works as intended. r? @catamorphism
2014-02-11 16:31:48 -08:00
Vadim Chugunov
b7651325eb Build compiler-rt and link it to all crates, similarly to morestack. 2014-02-11 15:59:59 -08:00
bors
0ac6e5afda auto merge of #12158 : nikomatsakis/rust/issue-6801-borrowck-closures, r=pcwalton
I factored the commits by affected files, for the most part. The last 7 or 8 contain the meat of the PR. The rest are small changes to closures found in the codebase. Maybe interesting to read to see some of the impact of the rules.

r? @pcwalton

Fixes #6801
2014-02-11 15:06:49 -08:00
Derek Guenther
0465fd7fae Fixed fourcc example doc 2014-02-11 17:03:59 -06:00
WebeWizard
bed34ecd08 Added examples for converting vectors of u8 into strings. Also fixed some styling 2014-02-11 16:41:19 -06:00
Vadim Chugunov
5d12d84f45 Added compiler-rt submodule. 2014-02-11 13:58:25 -08:00
Niko Matsakis
484f0f11e6 Correct nits from @pcwalton 2014-02-11 16:55:25 -05:00
Niko Matsakis
c9e3cb678d test -- add new tests specifically examining closure borrows 2014-02-11 16:55:25 -05:00
Niko Matsakis
3805c5416e test -- update tests with new error messages 2014-02-11 16:55:25 -05:00
Niko Matsakis
1bd7b182c5 dataflow -- do not consider the interprocedural case 2014-02-11 16:55:25 -05:00
Niko Matsakis
6b8b751429 borrowck -- treak borrows from closures like other borrows 2014-02-11 16:55:25 -05:00
Niko Matsakis
db38192daf mem_categorization -- parameterize over TYPER interface, treat upvar refs as
deref'd borrowed pointers
2014-02-11 16:55:24 -05:00
Niko Matsakis
d45dd2754e regionck -- rewrite in terms of mem_categorization, compute upvar borrow kinds 2014-02-11 16:55:24 -05:00
Niko Matsakis
b1962a2b2e add upvar_borrow_map to tcx and fcx in typeck 2014-02-11 16:55:24 -05:00
Niko Matsakis
807def022a region -- Improve comments in region.rs 2014-02-11 16:55:24 -05:00
Niko Matsakis
844eab1940 librustuv -- fix unsafe sharing in rustuv 2014-02-11 16:55:24 -05:00
Niko Matsakis
56c5d4cec3 libsyntax -- fix unsafe sharing in closures 2014-02-11 16:55:24 -05:00
Niko Matsakis
c7560387af libgetopts -- fix unsafe sharing in closures 2014-02-11 16:55:24 -05:00
Niko Matsakis
7ffa67ce92 front -- collapse iterator actions that require access to the same &mut state 2014-02-11 16:55:24 -05:00
Niko Matsakis
ec6d122826 libsyntax -- combine two iter ops into one so that fld does not need to be mutably shared between them both 2014-02-11 16:55:24 -05:00
Niko Matsakis
e3ca1c2fca str -- borrow fields of self for use in closure since self.iter is borrowed 2014-02-11 16:55:24 -05:00
Niko Matsakis
b0ac40a243 sha2 -- introduce locals to clarify which subportions are being borrowed 2014-02-11 16:55:24 -05:00
Niko Matsakis
8dff89c238 librustdoc -- move closure to clarify scope 2014-02-11 16:55:24 -05:00
Niko Matsakis
c9c8049cda io -- introduce local to avoid conflicting borrow 2014-02-11 16:55:23 -05:00
Niko Matsakis
42cd820c62 ppaux -- add Repr implementations 2014-02-11 16:55:23 -05:00
Niko Matsakis
95c53c049c back/link -- introduce block to clarify scope of closure 2014-02-11 16:55:23 -05:00
Niko Matsakis
8b760fd844 vec -- introduce local var to make clear what subportion is being borrowed 2014-02-11 16:55:23 -05:00
Niko Matsakis
7ba5bef86e syntax/fold -- remove conflicting (and rather pointless) closures 2014-02-11 16:55:23 -05:00
Niko Matsakis
ca65c00ef2 syntax/ext/format -- rewrite conflicting closures into methods 2014-02-11 16:55:23 -05:00
Niko Matsakis
b2b4c79b17 resolve -- rewrite conflict closure into method 2014-02-11 16:55:23 -05:00
Niko Matsakis
949e1c7935 metadata -- remove tiny convenience closure that was causing conflicting mutable borrows 2014-02-11 16:55:23 -05:00
Niko Matsakis
7286e35c6b error_reporting -- explain reborrowed upvar constraints in a hopefully useful way 2014-02-11 16:55:23 -05:00
Niko Matsakis
64c9b5c3ae trans/datum -- move mutable variable into closure 2014-02-11 16:55:23 -05:00
Niko Matsakis
f7e5d8418c ty -- minor refactorings, helper methods 2014-02-11 16:55:22 -05:00
Niko Matsakis
0e005ab848 to_str -- update to contain scope of closure 2014-02-11 16:55:22 -05:00
Niko Matsakis
0f5baad6ee container -- update example to contain scope of closure borrow 2014-02-11 16:55:22 -05:00