Commit Graph

27808 Commits

Author SHA1 Message Date
bors
de4473201a auto merge of #13070 : huonw/rust/share-doc, r=alexcrichton
std: expand the `Share` docs to make them more precise.

And give some examples about exactly what's `Share` and what's not.
2014-03-25 10:46:57 -07:00
Alex Crichton
fad77175e1 std: Touch various I/O documentation blocks
These are mostly touchups from the previous commit.
2014-03-25 10:27:24 -07:00
Patrick Walton
a424e84a3e libstd: Document the following modules:
* native::io
* std::char
* std::fmt
* std::fmt::parse
* std::io
* std::io::extensions
* std::io::net::ip
* std::io::net::udp
* std::io::net::unix
* std::io::pipe
* std::num
* std::num::f32
* std::num::f64
* std::num::strconv
* std::os
2014-03-25 10:12:49 -07:00
Alex Crichton
d1f8fb26f5 std: Explicitly link to libm for freebsd
Apparently we had forgotten to do this for freebsd, causing possible problems
on FreeBSD 10. The discussion in #12324 has some more details about how it's
missing.
2014-03-25 09:47:22 -07:00
Alex Crichton
5fddb4280e rustuv: Handle short writes in uv_fs_write
The libuv fs wrappers are very thin wrappers around the syscalls they correspond
to, and a notable worrisome case is the write syscall. This syscall is not
guaranteed to write the entire buffer provided, so we may have to continue
calling uv_fs_write if a short write occurs.

Closes #13130
2014-03-25 09:37:36 -07:00
bors
1f5571abc2 auto merge of #13122 : sstewartgallus/rust/cleanup-10734-workarounds, r=alexcrichton
Cleanup old issue references. One of these workarounds no longer need to be used anymore and the others are out of date.
2014-03-25 06:36:55 -07:00
Huon Wilson
e9475b57be std: expand the Share docs to make them more precise.
And give some examples about exactly what's `Share` and what's not.
2014-03-26 00:25:17 +11:00
bors
5d5634ace0 auto merge of #13083 : FlaPer87/rust/issue-13005-borrow-unsafe-static, r=nikomatsakis
It was possible to borrow unsafe static items in static initializers.
This patch implements a small `Visitor` that walks static initializer's
expressions and checks borrows aliasability.

Fixes #13005

cc @nikomatsakis r?
2014-03-25 03:01:48 -07:00
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
Steven Stewart-Gallus
ff2f2e839e Correct issue workaround references 2014-03-24 16:58:12 -07:00
Steven Stewart-Gallus
451160fbfa Cleanup fixed issue #10734 workaround 2014-03-24 16:10:20 -07:00
Kiet Tran
19d913bf25 Prefer lifetime suggestion over generic error 2014-03-24 18:58:37 -04: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
Alex Crichton
e2ae458548 doc: Update the runtime guide with green changes
This updates a few code examples about booting libgreen/libnative and also
spells out how the event loop factory is required.
2014-03-24 11:19:28 -07:00
Alex Crichton
3ccad75641 rustc: Remove all crate map support
The crate map is no longer necessary now that logging and event loop factories
have been moved out.

Closes #11617
Closes #11731
2014-03-24 11:19:28 -07:00
Alex Crichton
b19261a749 green: Remove the dependence on the crate map
This is the final nail in the coffin for the crate map. The `start` function for
libgreen now has a new added parameter which is the event loop factory instead
of inferring it from the crate map. The two current valid values for this
parameter are `green::basic::event_loop` and `rustuv::event_loop`.
2014-03-24 11:19:28 -07:00
Flavio Percoco
9021a3f988 rustc: Completely forbid borrows of unsafe statics
Summary:
It was possible to borrow unsafe static items in static initializers.
This patch implements a small `Visitor` that walks static initializer's
expressions and checks borrows aliasability.

Fixes #13005

Test Plan: make check

Differential Revision: http://phabricator.octayn.net/D2
2014-03-24 18:04:10 +01: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