]> git.lizzy.rs Git - rust.git/log
rust.git
10 years agoauto merge of #13034 : edwardw/rust/match, r=nikomatsakis
bors [Thu, 27 Mar 2014 09:17:02 +0000 (02:17 -0700)]
auto merge of #13034 : edwardw/rust/match, r=nikomatsakis

The `_match.rs` takes advantage of passes prior to `trans` and
aggressively prunes the sub-match tree based on exact equality. When it
comes to literal or range, the strategy may lead to wrong result if
there's guard function or multiple patterns inside tuple.

Closes #12582.
Closes #13027.

10 years ago_match.rs: prune sub-match tree too aggressively
Edward Wang [Sat, 22 Mar 2014 12:55:46 +0000 (20:55 +0800)]
_match.rs: prune sub-match tree too aggressively

The `_match.rs` takes advantage of passes prior to `trans` and
aggressively prunes the sub-match tree based on exact equality. When it
comes to literal or range, the strategy may lead to wrong result if
there's guard function or multiple patterns inside tuple.

Closes #12582.
Closes #13027.

10 years agoauto merge of #13079 : alexcrichton/rust/colons, r=cmr
bors [Thu, 27 Mar 2014 02:32:01 +0000 (19:32 -0700)]
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

10 years agoauto merge of #13145 : alexcrichton/rust/flip-some-defaults, r=brson
bors [Wed, 26 Mar 2014 23:37:03 +0000 (16:37 -0700)]
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.

10 years agosyntax: Tweak parsing bounds on generics paths
Alex Crichton [Sat, 22 Mar 2014 16:20:22 +0000 (09:20 -0700)]
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

10 years agoauto merge of #13152 : huonw/rust/wtf-are-things-in-spans, r=alexcrichton
bors [Wed, 26 Mar 2014 20:36:52 +0000 (13:36 -0700)]
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).

10 years agoauto merge of #13071 : ktt3ja/rust/deterministic-lifetime-suggestion, r=cmr
bors [Wed, 26 Mar 2014 17:26:55 +0000 (10:26 -0700)]
auto merge of #13071 : ktt3ja/rust/deterministic-lifetime-suggestion, r=cmr

Close #13057

10 years agosyntax: Permit visibility on tuple fields
Alex Crichton [Tue, 25 Mar 2014 23:53:52 +0000 (16:53 -0700)]
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

10 years agorustc: Relax restriction on privacy for fields
Alex Crichton [Tue, 25 Mar 2014 22:59:33 +0000 (15:59 -0700)]
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

10 years agoauto merge of #13135 : alexcrichton/rust/dox, r=alexcrichton
bors [Wed, 26 Mar 2014 16:11:57 +0000 (09:11 -0700)]
auto merge of #13135 : alexcrichton/rust/dox, r=alexcrichton

I touched up the documentation from @pcwalton found in #12952.

10 years agosyntax: add a missing span rewrite in fold.
Huon Wilson [Wed, 26 Mar 2014 13:47:14 +0000 (00:47 +1100)]
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.

10 years agosyntax: add a some docs/clarification to the fields of ExpnInfo.
Huon Wilson [Wed, 26 Mar 2014 13:40:51 +0000 (00:40 +1100)]
syntax: add a some docs/clarification to the fields of ExpnInfo.

10 years agoauto merge of #13134 : alexcrichton/rust/freebsd-libm, r=thestinger
bors [Wed, 26 Mar 2014 11:16:52 +0000 (04:16 -0700)]
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.

10 years agoauto merge of #13133 : alexcrichton/rust/issue-13130, r=brson
bors [Wed, 26 Mar 2014 10:01:56 +0000 (03:01 -0700)]
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

10 years agoauto merge of #13117 : alexcrichton/rust/no-crate-map, r=brson
bors [Wed, 26 Mar 2014 08:41:57 +0000 (01:41 -0700)]
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)

10 years agoauto merge of #13039 : Kimundi/rust/iter_by_value_extend, r=alexcrichton
bors [Wed, 26 Mar 2014 06:41:57 +0000 (23:41 -0700)]
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)

10 years agoauto merge of #13106 : CLUSTERfoo/rust/docs/labelled_breaks, r=brson
bors [Wed, 26 Mar 2014 04:51:58 +0000 (21:51 -0700)]
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.

10 years agoauto merge of #13141 : brson/rust/fix-make-install, r=cmr
bors [Wed, 26 Mar 2014 00:16:59 +0000 (17:16 -0700)]
auto merge of #13141 : brson/rust/fix-make-install, r=cmr

10 years agomk: Fix 'make install'. Closes #13128
Brian Anderson [Tue, 25 Mar 2014 22:26:51 +0000 (15:26 -0700)]
mk: Fix 'make install'. Closes #13128

10 years agoauto merge of #12961 : cmr/rust/rustdoc-impls, r=alexcrichton
bors [Tue, 25 Mar 2014 20:51:52 +0000 (13:51 -0700)]
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.

10 years agoChanged `iter::Extendable` and `iter::FromIterator` to take a `Iterator` by value
Marvin Löbel [Thu, 20 Mar 2014 13:12:56 +0000 (14:12 +0100)]
Changed `iter::Extendable` and `iter::FromIterator` to take a `Iterator` by value

10 years agorustdoc: render derived impls separately
Corey Richardson [Mon, 17 Mar 2014 00:00:56 +0000 (20:00 -0400)]
rustdoc: render derived impls separately

10 years agorustdoc: add some docs for item types
Corey Richardson [Sun, 16 Mar 2014 23:12:00 +0000 (19:12 -0400)]
rustdoc: add some docs for item types

10 years agorustdoc: html: use raw strings for great justice
Corey Richardson [Sun, 16 Mar 2014 22:29:51 +0000 (18:29 -0400)]
rustdoc: html: use raw strings for great justice

10 years agoauto merge of #13070 : huonw/rust/share-doc, r=alexcrichton
bors [Tue, 25 Mar 2014 17:46:57 +0000 (10:46 -0700)]
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.

10 years agostd: Touch various I/O documentation blocks
Alex Crichton [Tue, 25 Mar 2014 17:23:51 +0000 (10:23 -0700)]
std: Touch various I/O documentation blocks

These are mostly touchups from the previous commit.

10 years agolibstd: Document the following modules:
Patrick Walton [Sun, 16 Mar 2014 22:59:04 +0000 (15:59 -0700)]
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

10 years agostd: Explicitly link to libm for freebsd
Alex Crichton [Tue, 25 Mar 2014 16:47:22 +0000 (09:47 -0700)]
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.

10 years agorustuv: Handle short writes in uv_fs_write
Alex Crichton [Tue, 25 Mar 2014 16:37:36 +0000 (09:37 -0700)]
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

10 years agoauto merge of #13122 : sstewartgallus/rust/cleanup-10734-workarounds, r=alexcrichton
bors [Tue, 25 Mar 2014 13:36:55 +0000 (06:36 -0700)]
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.

10 years agostd: expand the `Share` docs to make them more precise.
Huon Wilson [Sat, 22 Mar 2014 07:12:22 +0000 (18:12 +1100)]
std: expand the `Share` docs to make them more precise.

And give some examples about exactly what's `Share` and what's not.

10 years agoauto merge of #13083 : FlaPer87/rust/issue-13005-borrow-unsafe-static, r=nikomatsakis
bors [Tue, 25 Mar 2014 10:01:48 +0000 (03:01 -0700)]
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?

10 years agoauto merge of #13063 : brson/rust/dist, r=alexcrichton
bors [Tue, 25 Mar 2014 07:01:52 +0000 (00:01 -0700)]
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

10 years agoauto merge of #12991 : alexcrichton/rust/sync-chan, r=brson
bors [Tue, 25 Mar 2014 04:56:50 +0000 (21:56 -0700)]
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

10 years agocomm: Implement synchronous channels
Alex Crichton [Mon, 17 Mar 2014 21:34:25 +0000 (14:34 -0700)]
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

10 years agoauto merge of #12900 : alexcrichton/rust/rewrite-sync, r=brson
bors [Tue, 25 Mar 2014 01:11:51 +0000 (18:11 -0700)]
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.

10 years agostd: Unignore atomic tests
Brian Anderson [Sat, 22 Mar 2014 07:15:47 +0000 (00:15 -0700)]
std: Unignore atomic tests

10 years agotest: Update all tests with the sync changes
Alex Crichton [Sat, 22 Mar 2014 07:55:50 +0000 (00:55 -0700)]
test: Update all tests with the sync changes

10 years agosync: Wire up all of the previous commits
Alex Crichton [Sat, 22 Mar 2014 07:55:27 +0000 (00:55 -0700)]
sync: Wire up all of the previous commits

This updates the exports and layout of the crate

10 years agosync: Update the arc module
Alex Crichton [Sat, 22 Mar 2014 07:53:58 +0000 (00:53 -0700)]
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.

10 years agoCorrect issue workaround references
Steven Stewart-Gallus [Mon, 24 Mar 2014 23:58:12 +0000 (16:58 -0700)]
Correct issue workaround references

10 years agoCleanup fixed issue #10734 workaround
Steven Stewart-Gallus [Mon, 24 Mar 2014 23:10:20 +0000 (16:10 -0700)]
Cleanup fixed issue #10734 workaround

10 years agoPrefer lifetime suggestion over generic error
Kiet Tran [Sat, 22 Mar 2014 08:24:42 +0000 (04:24 -0400)]
Prefer lifetime suggestion over generic error

10 years agoauto merge of #13080 : alexcrichton/rust/possible-osx-deadlock, r=brson
bors [Mon, 24 Mar 2014 21:32:09 +0000 (14:32 -0700)]
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.

10 years agomk: Make distcheck depend on dist-docs
Brian Anderson [Mon, 24 Mar 2014 20:13:12 +0000 (13:13 -0700)]
mk: Make distcheck depend on dist-docs

10 years agoRevert "mk: Run 'make install' through install.sh"
Brian Anderson [Mon, 24 Mar 2014 19:04:27 +0000 (12:04 -0700)]
Revert "mk: Run 'make install' through install.sh"

This reverts commit e93709a911637194835268420e67d768ee19b5df.

10 years agomk: Fix prepare.mk
Brian Anderson [Mon, 24 Mar 2014 19:03:47 +0000 (12:03 -0700)]
mk: Fix prepare.mk

The way it was formulated you could only 'prepare' one directory per build.

10 years agomk: Fix a minor UI bug
Brian Anderson [Mon, 24 Mar 2014 17:42:50 +0000 (10:42 -0700)]
mk: Fix a minor UI bug

10 years agomk: Don't rm 'dist' during clean, just its contents
Brian Anderson [Mon, 24 Mar 2014 01:26:35 +0000 (18:26 -0700)]
mk: Don't rm 'dist' during clean, just its contents

This is not for temporaries now

10 years agomk: Remove some debug logging
Brian Anderson [Mon, 24 Mar 2014 01:24:51 +0000 (18:24 -0700)]
mk: Remove some debug logging

10 years agoinstall: Don't try to run binaries on install
Brian Anderson [Sat, 22 Mar 2014 08:44:10 +0000 (01:44 -0700)]
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.

10 years agoinstall: Improve error handling
Brian Anderson [Sat, 22 Mar 2014 03:12:51 +0000 (20:12 -0700)]
install: Improve error handling

10 years agomk: Cleanup dist.mk yet more
Brian Anderson [Sat, 22 Mar 2014 02:20:44 +0000 (19:20 -0700)]
mk: Cleanup dist.mk yet more

10 years agomk: Fix some dist deps for parallel builds
Brian Anderson [Sat, 22 Mar 2014 01:55:31 +0000 (18:55 -0700)]
mk: Fix some dist deps for parallel builds

10 years agoinstall: Error on uninstall if manifest can't be found
Brian Anderson [Sat, 22 Mar 2014 00:31:18 +0000 (17:31 -0700)]
install: Error on uninstall if manifest can't be found

10 years agomk: Run 'make install' through install.sh
Brian Anderson [Sat, 22 Mar 2014 00:25:02 +0000 (17:25 -0700)]
mk: Run 'make install' through install.sh

10 years agomk: Fix location of man pages in prepare.mk
Brian Anderson [Fri, 21 Mar 2014 22:47:19 +0000 (15:47 -0700)]
mk: Fix location of man pages in prepare.mk

10 years agomk: Wire up everything to dist and distcheck
Brian Anderson [Fri, 21 Mar 2014 22:21:45 +0000 (15:21 -0700)]
mk: Wire up everything to dist and distcheck

Fix some misc bugs

10 years agomk: Fix distcheck
Brian Anderson [Fri, 21 Mar 2014 22:15:45 +0000 (15:15 -0700)]
mk: Fix distcheck

Also, add more distcheck tests

10 years agomk: Add FIXME about making windows installer support all hosts
Brian Anderson [Fri, 21 Mar 2014 21:02:08 +0000 (14:02 -0700)]
mk: Add FIXME about making windows installer support all hosts

10 years agomk: Add docs to dist prep
Brian Anderson [Fri, 21 Mar 2014 20:37:09 +0000 (13:37 -0700)]
mk: Add docs to dist prep

For integrating doc upload into the dist-snap process

10 years agomk: Put win installer in correct dir
Brian Anderson [Fri, 21 Mar 2014 20:01:21 +0000 (13:01 -0700)]
mk: Put win installer in correct dir

10 years agomk: Cleanup version handling and add support for nightly dists
Brian Anderson [Fri, 21 Mar 2014 19:50:29 +0000 (12:50 -0700)]
mk: Cleanup version handling and add support for nightly dists

10 years agomk: Make OS X .pkg for all arches
Brian Anderson [Fri, 21 Mar 2014 22:31:52 +0000 (15:31 -0700)]
mk: Make OS X .pkg for all arches

10 years agomk: Cleanup
Brian Anderson [Fri, 21 Mar 2014 18:40:31 +0000 (11:40 -0700)]
mk: Cleanup

10 years agomk: Reorder definitions in dist.mk
Brian Anderson [Fri, 21 Mar 2014 17:48:13 +0000 (10:48 -0700)]
mk: Reorder definitions in dist.mk

Just to be more logical, put big headers between different installers

10 years agomk: Stop building OS X .pkg as part of 'make dist'
Brian Anderson [Thu, 20 Mar 2014 23:44:49 +0000 (16:44 -0700)]
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.

10 years agoauto merge of #13049 : alexcrichton/rust/io-fill, r=huonw
bors [Mon, 24 Mar 2014 19:06:58 +0000 (12:06 -0700)]
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.

10 years agodoc: Update the runtime guide with green changes
Alex Crichton [Mon, 24 Mar 2014 17:51:13 +0000 (10:51 -0700)]
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.

10 years agorustc: Remove all crate map support
Alex Crichton [Mon, 24 Mar 2014 17:41:43 +0000 (10:41 -0700)]
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

10 years agogreen: Remove the dependence on the crate map
Alex Crichton [Mon, 24 Mar 2014 17:40:36 +0000 (10:40 -0700)]
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`.

10 years agorustc: Completely forbid borrows of unsafe statics
Flavio Percoco [Sat, 22 Mar 2014 18:49:25 +0000 (19:49 +0100)]
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

10 years agoauto merge of #13113 : pnkfelix/rust/correct-static-kind-doc, r=huonw
bors [Mon, 24 Mar 2014 17:01:57 +0000 (10:01 -0700)]
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.

10 years agoauto merge of #12998 : huonw/rust/log_syntax, r=alexcrichton
bors [Mon, 24 Mar 2014 14:11:59 +0000 (07:11 -0700)]
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 `()`.

10 years agoCorrect overly broad definition of `'static` kind bound.
Felix S. Klock II [Mon, 24 Mar 2014 12:03:43 +0000 (13:03 +0100)]
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.

10 years agoauto merge of #12948 : olleolleolle/rust/master, r=huonw
bors [Mon, 24 Mar 2014 11:41:53 +0000 (04:41 -0700)]
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.

10 years agoDocumentation sprint: Terminfo
Olle Jonsson [Sun, 16 Mar 2014 22:15:55 +0000 (23:15 +0100)]
Documentation sprint: Terminfo

10 years agoAdded suggested notes
noam [Mon, 24 Mar 2014 01:24:17 +0000 (21:24 -0400)]
Added suggested notes

* Note on while loop not supporting named breaks.
* Note on hygienic macros (and example of such within loops)

10 years agoauto merge of #13096 : sstewartgallus/rust/cleanup-test-warnings, r=huonw
bors [Sun, 23 Mar 2014 23:31:52 +0000 (16:31 -0700)]
auto merge of #13096 : sstewartgallus/rust/cleanup-test-warnings, r=huonw

10 years agodocs: named lifetimes
noam [Sun, 23 Mar 2014 20:05:01 +0000 (16:05 -0400)]
docs: named lifetimes

* 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.

10 years agoauto merge of #13095 : alexcrichton/rust/serialize-tuple, r=huonw
bors [Sun, 23 Mar 2014 22:16:48 +0000 (15:16 -0700)]
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

10 years agoThis commit cleans up a few test warnings
Steven Stewart-Gallus [Sun, 23 Mar 2014 05:20:27 +0000 (22:20 -0700)]
This commit cleans up a few test warnings

10 years agoauto merge of #13074 : pczarn/rust/build-rlib, r=alexcrichton
bors [Sun, 23 Mar 2014 21:01:52 +0000 (14:01 -0700)]
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.

10 years agoauto merge of #13103 : mozilla-servo/rust/url-totaleq, r=alexcrichton
bors [Sun, 23 Mar 2014 18:56:54 +0000 (11:56 -0700)]
auto merge of #13103 : mozilla-servo/rust/url-totaleq, r=alexcrichton

10 years agoserialize: Read/emit tuples with {read,emit}_tuple
Alex Crichton [Sun, 23 Mar 2014 04:58:51 +0000 (21:58 -0700)]
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

10 years agosync: Introduce new wrapper types for locking
Alex Crichton [Sat, 22 Mar 2014 07:52:33 +0000 (00:52 -0700)]
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.

10 years agosync: Rewrite the base primitives
Alex Crichton [Sat, 22 Mar 2014 07:50:19 +0000 (00:50 -0700)]
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.

10 years agosync: Move Once to using &self
Alex Crichton [Sat, 22 Mar 2014 07:49:16 +0000 (00:49 -0700)]
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.

10 years agosync: Move the Mutex type to using &self
Alex Crichton [Sat, 22 Mar 2014 07:47:43 +0000 (00:47 -0700)]
sync: Move the Mutex type to using &self

This also uses the Unsafe type for any interior mutability in the type to avoid
transmutes.

10 years agosync: Move the concurrent queue to using &self
Alex Crichton [Sat, 22 Mar 2014 07:46:57 +0000 (00:46 -0700)]
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.

10 years agostd: Move NativeMutex from &mut self to &self
Alex Crichton [Sat, 22 Mar 2014 07:45:41 +0000 (00:45 -0700)]
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).

10 years agoSnapshot cleanup
Alex Crichton [Sat, 22 Mar 2014 14:53:15 +0000 (07:53 -0700)]
Snapshot cleanup

10 years agoauto merge of #13102 : huonw/rust/totaleq-deriving, r=thestinger
bors [Sun, 23 Mar 2014 15:36:51 +0000 (08:36 -0700)]
auto merge of #13102 : huonw/rust/totaleq-deriving, r=thestinger

std: remove the `equals` method from `TotalEq`.

`TotalEq` is now just an assertion about the `Eq` impl of a
type (i.e. `==` is a total equality if a type implements `TotalEq`) so
the extra method is just confusing.

Also, a new method magically appeared as a hack to allow deriving to
assert that the contents of a struct/enum are also TotalEq, because the
deriving infrastructure makes it very hard to do anything but create a
trait method. (You didn't hear about this horrible work-around from me
:(.)

10 years agoMake url::Url derive TotalEq.
Ms2ger [Sun, 23 Mar 2014 14:32:18 +0000 (15:32 +0100)]
Make url::Url derive TotalEq.

10 years agoauto merge of #13099 : FlaPer87/rust/master, r=huonw
bors [Sun, 23 Mar 2014 14:21:55 +0000 (07:21 -0700)]
auto merge of #13099 : FlaPer87/rust/master, r=huonw

10 years agoauto merge of #13093 : Havvy/rust/master, r=sfackler
bors [Sun, 23 Mar 2014 13:06:54 +0000 (06:06 -0700)]
auto merge of #13093 : Havvy/rust/master, r=sfackler

This will make the types more readable in the documentation, since the letters correspond with what you should either be sending or expecting to receive.

10 years agostd: remove the `equals` method from `TotalEq`.
Huon Wilson [Sun, 23 Mar 2014 11:54:42 +0000 (22:54 +1100)]
std: remove the `equals` method from `TotalEq`.

`TotalEq` is now just an assertion about the `Eq` impl of a
type (i.e. `==` is a total equality if a type implements `TotalEq`) so
the extra method is just confusing.

Also, a new method magically appeared as a hack to allow deriving to
assert that the contents of a struct/enum are also TotalEq, because the
deriving infrastructure makes it very hard to do anything but create a
trait method. (You didn't hear about this horrible work-around from me
:(.)

10 years agorustc: Change the filename of compressed bitcode
Piotr Czarnecki [Sun, 23 Mar 2014 07:59:18 +0000 (08:59 +0100)]
rustc: Change the filename of compressed bitcode

Fixes #12992
Store compressed bitcode files in rlibs with a different extension. Compression doesn't interfere with --emit=bc.
Regression test compares outputs.

10 years agoauto merge of #13092 : sfackler/rust/buffer-vec, r=thestinger
bors [Sun, 23 Mar 2014 11:01:59 +0000 (04:01 -0700)]
auto merge of #13092 : sfackler/rust/buffer-vec, r=thestinger

`Vec` is now used for the internal buffer instead of `~[]`. Some module
level documentation somehow ended up attached to `BufferedReader` so I
fixed that as well.

10 years agoRegister new snapshots
Flavio Percoco [Sun, 23 Mar 2014 10:37:31 +0000 (11:37 +0100)]
Register new snapshots