Commit Graph

27482 Commits

Author SHA1 Message Date
Huon Wilson
0e8c949786 rand: bubble up IO errors when creating an OSRng. 2014-04-01 20:46:09 +11:00
Huon Wilson
119289b0f2 std: migrate the errno -> IoError converter from libnative.
This also adds a direct `errno` -> `~str` converter, rather than only
being possible to get a string for the very last error.
2014-04-01 20:46:09 +11:00
bors
c329a17461 auto merge of #13079 : alexcrichton/rust/colons, r=cmr
The previous syntax was `Foo:Bound<trait-parameters>`, but this is a little
ambiguous because it was being parsed as `Foo: (Bound<trait-parameters)` rather
than `Foo: (Bound) <trait-parameters>`

This commit changes the syntax to `Foo<trait-parameters>: Bound` in order to be
clear where the trait parameters are going.

Closes #9265
2014-03-26 19:32:01 -07:00
bors
c83994e0f4 auto merge of #13145 : alexcrichton/rust/flip-some-defaults, r=brson
This change prepares `rustc` to accept private fields by default. These changes will have to go through a snapshot before the rest of the changes can happen.
2014-03-26 16:37:03 -07:00
Alex Crichton
8118406ecf syntax: Tweak parsing bounds on generics paths
The previous syntax was `Foo:Bound<trait-parameters>`, but this is a little
ambiguous because it was being parsed as `Foo: (Bound<trait-parameters)` rather
than `Foo: (Bound) <trait-parameters>`

This commit changes the syntax to `Foo<trait-parameters>: Bound` in order to be
clear where the trait parameters are going.

Closes #9265
2014-03-26 14:51:41 -07:00
bors
533a526327 auto merge of #13152 : huonw/rust/wtf-are-things-in-spans, r=alexcrichton
Add some docs to ExpnInfo. Add a single overlooked `new_span` call to the folder (I'm pretty sure nothing reads this span, though, so it's probably pointless).
2014-03-26 13:36:52 -07:00
bors
2c71cdf64b auto merge of #13071 : ktt3ja/rust/deterministic-lifetime-suggestion, r=cmr
Close #13057
2014-03-26 10:26:55 -07:00
Alex Crichton
7de48419ee syntax: Permit visibility on tuple fields
This change is in preparation for #8122. Nothing is currently done with these
visibility qualifiers, they are just parsed and accepted by the compiler.

RFC: 0004-private-fields
2014-03-26 10:20:15 -07:00
Alex Crichton
104aaa44e8 rustc: Relax restriction on privacy for fields
This is a necessary change in preparation for switching the defaults as part
of #8122.

RFC: 0004-private-fields
2014-03-26 10:20:12 -07:00
bors
5da14c08a9 auto merge of #13135 : alexcrichton/rust/dox, r=alexcrichton
I touched up the documentation from @pcwalton found in #12952.
2014-03-26 09:11:57 -07:00
Huon Wilson
6419848e66 syntax: add a missing span rewrite in fold.
This was leaving Decls without the new spans; this is a minor change,
since literally nothing reads in the code base reads the span of a Decl
itself, always just its contents.
2014-03-27 01:19:07 +11:00
Huon Wilson
85ff90c86c syntax: add a some docs/clarification to the fields of ExpnInfo. 2014-03-27 01:19:07 +11:00
bors
0908ffa660 auto merge of #13134 : alexcrichton/rust/freebsd-libm, r=thestinger
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-26 04:16:52 -07:00
bors
82c8cb2abf auto merge of #13133 : alexcrichton/rust/issue-13130, r=brson
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-26 03:01:56 -07:00
bors
de85948ac0 auto merge of #13117 : alexcrichton/rust/no-crate-map, r=brson
This can be done now that logging has been moved out and libnative is the default (not libgreen)
2014-03-26 01:41:57 -07:00
bors
6bac5607c9 auto merge of #13039 : Kimundi/rust/iter_by_value_extend, r=alexcrichton
# Summary 
Changed `iter::Extendable` and `iter::FromIterator` to take a `Iterator` by value.
These functions always exhaust the passed `Iterator`, and are often used for transferring the values of a new `Iterator` directly into a data structure, so using them usually require the use of the `&mut` operator:

```
foo.extend(&mut bar.move_iter()); // Transfer content from bar into foo

let mut iter = ...;
foo.extend(&mut iter); // iter is now empty
```
This patch changes both the `FromIterator` and `Extendable` traits to take the iterator by value instead, which makes the common case of using these traits less heavy:

```
foo.extend(bar.move_iter()); // Transfer content from bar into foo

let iter = ...;
foo.extend(iter);
// iter is now inaccessible if it moved
// or unchanged if it was Pod and copied.
```
# Composability
This technically makes the traits less flexible from a type system pov, because they now require ownership. 

However, because `Iterator` provides the `ByRef` adapter, there is no loss of functionality:
```
foo.extend(iter.by_ref()); // Same semantic as today, for the few situations where you need it.
```

# Motivation
This change makes it less painful to use iterators for shuffling values around between collections, which makes it more acceptable to always use them for this, enabling more flexibility.

For example, `foo.extend(bar.move_iter())` can generally be the fastest way to append an collections content to another one, without both needing to have the same type. Making this easy to use would allow the removal of special cased methods like `push_all()` on vectors. (See https://github.com/mozilla/rust/issues/12456)

I opened https://github.com/mozilla/rust/issues/13038 as well, to discuss this change in general if people object to it.

# Further work
This didn't change the `collect()` method to take by value `self`, nor any of the other adapters that also exhaust their iterator argument. For consistency this should probably happen in the long term, but for now this is too much trouble, as every use of them would need to be checked for accidentally changed semantic by going `&mut self -> self`. (which allows for the possibility that a `Pod` iterator got copied instead of exhausted without generating a type error by the change)
2014-03-25 23:41:57 -07:00
bors
e28f081cc2 auto merge of #13106 : CLUSTERfoo/rust/docs/labelled_breaks, r=brson
* Include tip given by Leo Testard in mailing list about labeled `break`
and `continue`:
https://mail.mozilla.org/pipermail/rust-dev/2014-March/009145.html
* cross-reference named lifetimes in tutorial -> lifetimes guide
* Broke named lifetimes section into two sub-sections.
* Added mention of `'static` lifetime.
2014-03-25 21:51:58 -07:00
bors
60531025ab auto merge of #13141 : brson/rust/fix-make-install, r=cmr 2014-03-25 17:16:59 -07:00
Brian Anderson
1f35f834be mk: Fix 'make install'. Closes #13128 2014-03-25 15:27:47 -07:00
bors
d130d8798d auto merge of #12961 : cmr/rust/rustdoc-impls, r=alexcrichton
Rendered form available at http://docs.octayn.net/doc/

This moves derived impls to the bottom of the list, separate from the rest,
and collapses default methods that aren't overridden into an expandible
accordion.
2014-03-25 13:51:52 -07:00
Marvin Löbel
6200e761f0 Changed iter::Extendable and iter::FromIterator to take a Iterator by value 2014-03-25 21:49:55 +01:00
Corey Richardson
1f937fa79e rustdoc: render derived impls separately 2014-03-25 15:32:27 -04:00
Corey Richardson
e88387a947 rustdoc: add some docs for item types 2014-03-25 15:01:27 -04:00
Corey Richardson
6f6b099f5d rustdoc: html: use raw strings for great justice 2014-03-25 15:01:27 -04:00
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