Commit Graph

27441 Commits

Author SHA1 Message Date
bors
b1091c3141 auto merge of #13063 : brson/rust/dist, r=alexcrichton
Several things here:

* Cleanup
* Fix build targets for building .pkg so that it works and works for all hosts
* Adds support for nightly artifacts
* Put docs in a location suitable for upload to s3 during 'make dist'
* Add coverage of unix binary installers to 'distcheck'
* Fix 'distcheck'
* Change 'dist' to build source tarballs, binary tarballs and OS X packages
2014-03-25 00:01:52 -07:00
bors
1e6e98c0c2 auto merge of #12991 : alexcrichton/rust/sync-chan, r=brson
This commit contains an implementation of synchronous, bounded channels for
Rust. This is an implementation of the proposal made last January [1]. These
channels are built on mutexes, and currently focus on a working implementation
rather than speed. Receivers for sync channels have select() implemented for
them, but there is currently no implementation of select() for sync senders.

Rust will continue to provide both synchronous and asynchronous channels as part
of the standard distribution, there is no intent to remove asynchronous
channels. This flavor of channels is meant to provide an alternative to
asynchronous channels because like green tasks, asynchronous channels are not
appropriate for all situations.

[1] - https://mail.mozilla.org/pipermail/rust-dev/2014-January/007924.html
2014-03-24 21:56:50 -07:00
Alex Crichton
56cae9b3c0 comm: Implement synchronous channels
This commit contains an implementation of synchronous, bounded channels for
Rust. This is an implementation of the proposal made last January [1]. These
channels are built on mutexes, and currently focus on a working implementation
rather than speed. Receivers for sync channels have select() implemented for
them, but there is currently no implementation of select() for sync senders.

Rust will continue to provide both synchronous and asynchronous channels as part
of the standard distribution, there is no intent to remove asynchronous
channels. This flavor of channels is meant to provide an alternative to
asynchronous channels because like green tasks, asynchronous channels are not
appropriate for all situations.

[1] - https://mail.mozilla.org/pipermail/rust-dev/2014-January/007924.html
2014-03-24 20:06:37 -07:00
bors
6bf3fca8ff auto merge of #12900 : alexcrichton/rust/rewrite-sync, r=brson
* Remove clone-ability from all primitives. All shared state will now come
  from the usage of the primitives being shared, not the primitives being
  inherently shareable. This allows for fewer allocations for stack-allocated
  primitives.
* Add `Mutex<T>` and `RWLock<T>` which are stack-allocated primitives for purely
  wrapping a piece of data
* Remove `RWArc<T>` in favor of `Arc<RWLock<T>>`
* Remove `MutexArc<T>` in favor of `Arc<Mutex<T>>`
* Shuffle around where things are located
  * The `arc` module now only contains `Arc`
  * A new `lock` module contains `Mutex`, `RWLock`, and `Barrier`
  * A new `raw` module contains the primitive implementations of `Semaphore`,
    `Mutex`, and `RWLock`
* The Deref/DerefMut trait was implemented where appropriate
* `CowArc` was removed, the functionality is now part of `Arc` and is tagged
  with `#[experimental]`.
* The crate now has #[deny(missing_doc)]
* `Arc` now supports weak pointers

This is not a large-scale rewrite of the functionality contained within the
`sync` crate, but rather a shuffling of who does what an a thinner hierarchy of
ownership to allow for better composability.
2014-03-24 18:11:51 -07:00
Brian Anderson
218461d010 std: Unignore atomic tests 2014-03-24 17:17:46 -07:00
Alex Crichton
5163a26d30 test: Update all tests with the sync changes 2014-03-24 17:17:46 -07:00
Alex Crichton
eff025797a sync: Wire up all of the previous commits
This updates the exports and layout of the crate
2014-03-24 17:17:46 -07:00
Alex Crichton
64a52de823 sync: Update the arc module
This removes the now-outdated MutexArc and RWArc types. These are superseded by
Arc<Mutex<T>> and Arc<RWLock<T>>. The only remaining arc is the one true Arc.
Additionally, the arc now has weak pointers implemented for it to assist in
breaking cycles.

This commit brings the arc api up to parity with the sibling Rc api, making them
nearly interchangeable for inter and intra task communication.
2014-03-24 17:17:46 -07:00
bors
bcaaffbe1e auto merge of #13080 : alexcrichton/rust/possible-osx-deadlock, r=brson
The OSX bots have been deadlocking recently in the rustdoc tests. I have only
been able to rarely reproduce the deadlock on my local setup. When reproduced,
it looks like the child process is spinning on the malloc mutex, which I
presume is locked with no other threads to unlock it.

I'm not convinced that this is what's happening, because OSX should protect
against this with pthread_atfork by default. Regardless, running as little code
as possible in the child after fork() is normally a good idea anyway, so this
commit moves all allocation to the parent process to run before the child
executes.

After running 6k iterations of rustdoc tests, this deadlocked twice before, and
after 20k iterations afterwards, it never deadlocked. I draw the conclusion that
this is either sweeping the bug under the rug, or it did indeed fix the
underlying problem.
2014-03-24 14:32:09 -07:00
Brian Anderson
39b48fb883 mk: Make distcheck depend on dist-docs 2014-03-24 14:29:23 -07:00
Brian Anderson
d62163188a Revert "mk: Run 'make install' through install.sh"
This reverts commit e93709a911637194835268420e67d768ee19b5df.
2014-03-24 14:29:22 -07:00
Brian Anderson
c796f89dbc mk: Fix prepare.mk
The way it was formulated you could only 'prepare' one directory per build.
2014-03-24 14:29:20 -07:00
Brian Anderson
70a10758de mk: Fix a minor UI bug 2014-03-24 14:29:19 -07:00
Brian Anderson
a2e8e30b11 mk: Don't rm 'dist' during clean, just its contents
This is not for temporaries now
2014-03-24 14:29:19 -07:00
Brian Anderson
ba98689f09 mk: Remove some debug logging 2014-03-24 14:29:19 -07:00
Brian Anderson
fe5bd8857d install: Don't try to run binaries on install
I think there are likely to be scenarios where this script is run
to move files to the correct place during cross-compiles.
2014-03-24 14:29:18 -07:00
Brian Anderson
eed808b532 install: Improve error handling 2014-03-24 14:29:18 -07:00
Brian Anderson
169f08dd59 mk: Cleanup dist.mk yet more 2014-03-24 14:29:18 -07:00
Brian Anderson
c2e5e62135 mk: Fix some dist deps for parallel builds 2014-03-24 14:29:18 -07:00
Brian Anderson
cc5fae720a install: Error on uninstall if manifest can't be found 2014-03-24 14:29:18 -07:00
Brian Anderson
8694c28762 mk: Run 'make install' through install.sh 2014-03-24 14:29:17 -07:00
Brian Anderson
805d0e53fd mk: Fix location of man pages in prepare.mk 2014-03-24 14:29:17 -07:00
Brian Anderson
b8138e0cf2 mk: Wire up everything to dist and distcheck
Fix some misc bugs
2014-03-24 14:29:17 -07:00
Brian Anderson
dd7a60e0c3 mk: Fix distcheck
Also, add more distcheck tests
2014-03-24 14:29:17 -07:00
Brian Anderson
ae0e47a6eb mk: Add FIXME about making windows installer support all hosts 2014-03-24 14:29:17 -07:00
Brian Anderson
116ebe5af8 mk: Add docs to dist prep
For integrating doc upload into the dist-snap process
2014-03-24 14:29:16 -07:00
Brian Anderson
92d8181bde mk: Put win installer in correct dir 2014-03-24 14:29:16 -07:00
Brian Anderson
44842db533 mk: Cleanup version handling and add support for nightly dists 2014-03-24 14:29:16 -07:00
Brian Anderson
669a0554da mk: Make OS X .pkg for all arches 2014-03-24 14:29:16 -07:00
Brian Anderson
4176cf47df mk: Cleanup 2014-03-24 14:29:15 -07:00
Brian Anderson
df141e624d mk: Reorder definitions in dist.mk
Just to be more logical, put big headers between different installers
2014-03-24 14:29:15 -07:00
Brian Anderson
e30ab71e08 mk: Stop building OS X .pkg as part of 'make dist'
This doesn't work quite right yet (we need to build packages for all hosts)
and I'm not ready to turn on new dist artifacts yet, but I want to start doing
dry runs for 0.10, so I'm turning this off for now.
2014-03-24 14:29:15 -07:00
bors
e06348ea55 auto merge of #13049 : alexcrichton/rust/io-fill, r=huonw
This method can be used to fill a byte slice of data entirely, and it's considered an error if any error happens before its entirely filled.
2014-03-24 12:06:58 -07:00
bors
e6468a8215 auto merge of #13113 : pnkfelix/rust/correct-static-kind-doc, r=huonw
While double-checking my understanding of the meaning of `'static`, I made the following test program:

```rust
fn foo<X:'static>(_x: X) { }

#[cfg(not(acceptable))]
fn bar() {
    let a = 3;
    let b = &a;
    foo(b);
}

#[cfg(acceptable)]
fn bar() {
    static c : int = 4;;
    let d : &'static int = &c;
    foo(d);
}

fn main() {
    bar();
}
```

Transcript of compiling above program, illustrating that the `--cfg acceptable` variant of `bar` compiles successfully, showing that the`'static` kind bound only disallows non-`static` references, not *all* references:

```
% rustc --version
/Users/fklock/opt/rust-dbg/bin/rustc 0.10-pre (caf17fe 2014-03-21 02:21:50 -0700)
host: x86_64-apple-darwin
% rustc /tmp/s.rs
/tmp/s.rs:7:5: 7:8 error: instantiating a type parameter with an incompatible type `&int`, which does not fulfill `'static`
/tmp/s.rs:7     foo(b);
                ^~~
error: aborting due to previous error
% rustc --cfg acceptable /tmp/s.rs
% ./s
%
```

(Note that the explicit type annotation on `let d : &'static int` is necessary; it did not suffice for me to just write `let d = &'static c;`. That might be a latent bug, I am not sure yet.)

Anyway, a fix to the documentation seemed prudent.
2014-03-24 10:01:57 -07:00
bors
f8f60d80bf auto merge of #12998 : huonw/rust/log_syntax, r=alexcrichton
syntax: allow `trace_macros!` and `log_syntax!` in item position.

Previously

    trace_macros!(true)
    fn main() {}

would complain about `trace_macros` being an expression macro in item
position. This is a pointless limitation, because the macro is purely
compile-time, with no runtime effect. (And similarly for log_syntax.)

This also changes the behaviour of `trace_macros!` very slightly, it
used to be equivalent to

    macro_rules! trace_macros {
        (true $($_x: tt)*) => { true };
        (false $($_x: tt)*) => { false }
    }

I.e. you could invoke it with arbitrary trailing arguments, which were
ignored. It is changed to accept only exactly `true` or `false` (with no
trailing arguments) and expands to `()`.
2014-03-24 07:11:59 -07:00
Felix S. Klock II
57ac379a63 Correct overly broad definition of 'static kind bound.
While double-checking my understanding of the meaning of `'static`,
I made the following test program:

```rust
fn foo<X:'static>(_x: X) { }

#[cfg(not(acceptable))]
fn bar() {
    let a = 3;
    let b = &a;
    foo(b);
}

#[cfg(acceptable)]
fn bar() {
    static c : int = 4;;
    let d : &'static int = &c;
    foo(d);
}

fn main() {
    bar();
}
```

Transcript of compiling above program, illustrating that the `--cfg
acceptable` variant of `bar` compiles successfully, showing that the
`'static` kind bound only disallows non-`static` references, not *all*
references:

```
% rustc --version
/Users/fklock/opt/rust-dbg/bin/rustc 0.10-pre (caf17fe 2014-03-21 02:21:50 -0700)
host: x86_64-apple-darwin
% rustc /tmp/s.rs
/tmp/s.rs:7:5: 7:8 error: instantiating a type parameter with an incompatible type `&int`, which does not fulfill `'static`
/tmp/s.rs:7     foo(b);
                ^~~
error: aborting due to previous error
% rustc --cfg acceptable /tmp/s.rs
% ./s
%
```

(Note that the explicit type annotation on `let d : &'static int` is
necessary; it did not suffice for me to just write `let d = &'static
c;`.  That might be a latent bug, I am not sure yet.)

Anyway, a fix to the documentation seemed prudent.
2014-03-24 13:03:43 +01:00
bors
11d9483d58 auto merge of #12948 : olleolleolle/rust/master, r=huonw
Rust doc sprint: adding doc strings to the Terminfo library.

This is my very first Rust repository PR, so please do not hold back any formatting, nit-picky commentary. I need it.
2014-03-24 04:41:53 -07:00
Olle Jonsson
a6c14dda21 Documentation sprint: Terminfo 2014-03-24 12:16:15 +01:00
bors
2c7f3b850c auto merge of #13096 : sstewartgallus/rust/cleanup-test-warnings, r=huonw 2014-03-23 16:31:52 -07:00
bors
1599ac9cf2 auto merge of #13095 : alexcrichton/rust/serialize-tuple, r=huonw
This commit moves from {read,emit}_seq for tuples to {read,emit}_tuple, as well
as providing a generalized macro for generating these implementations from one
invocation.

Closes #13086
2014-03-23 15:16:48 -07:00
Steven Stewart-Gallus
8feb2ddf12 This commit cleans up a few test warnings 2014-03-23 14:22:17 -07:00
bors
841f31ecf9 auto merge of #13074 : pczarn/rust/build-rlib, r=alexcrichton
Fixes #12992

I tried to increase the number of deflate's probes. Reduction of 0.5% or 2% is not enough.
2014-03-23 14:01:52 -07:00
bors
bc37b8fde5 auto merge of #13103 : mozilla-servo/rust/url-totaleq, r=alexcrichton 2014-03-23 11:56:54 -07:00
Alex Crichton
e46e9332d9 serialize: Read/emit tuples with {read,emit}_tuple
This commit moves from {read,emit}_seq for tuples to {read,emit}_tuple, as well
as providing a generalized macro for generating these implementations from one
invocation.

Closes #13086
2014-03-23 10:10:13 -07:00
Alex Crichton
4d5aafd3a6 sync: Introduce new wrapper types for locking
This introduces new synchronization types which are meant to be the foundational
building blocks for sharing data among tasks. The new Mutex and RWLock types
have a type parameter which is the internal data that is accessed. Access to the
data is all performed through the guards returned, and the guards all have
autoderef implemented for easy access.
2014-03-23 09:45:20 -07:00
Alex Crichton
ae049e82f8 sync: Rewrite the base primitives
This commit rewrites the core primitives of the sync library: Mutex, RWLock, and
Semaphore. These primitives now have updated, more modernized apis:

* Guards are returned instead of locking with closures. All condition variables
  have moved inside the guards and extraneous methods have been removed.
* Downgrading on an rwlock is now done through the guard instead of the rwlock
  itself.

These types are meant to be general locks, not locks of an internal type (for
external usage). New types will be introduced for locking shared data.
2014-03-23 09:45:20 -07:00
Alex Crichton
53e451f410 sync: Move Once to using &self
Similarly to the rest of the previous commits, this moves the once primitive to
using &self instead of &mut self for proper sharing among many threads now.
2014-03-23 09:45:20 -07:00
Alex Crichton
3572a30e7a sync: Move the Mutex type to using &self
This also uses the Unsafe type for any interior mutability in the type to avoid
transmutes.
2014-03-23 09:45:20 -07:00
Alex Crichton
d6b3f1f231 sync: Move the concurrent queue to using &self
This commit also lifts it up a level in the module hierarchy in the soon-to-come
reorganization of libsync.
2014-03-23 09:45:19 -07:00
Alex Crichton
dd64bd83b7 std: Move NativeMutex from &mut self to &self
The proper usage of shared types is now sharing through `&self` rather than
`&mut self` because the mutable version will provide stronger guarantees (no
aliasing on *any* thread).
2014-03-23 09:45:19 -07:00