]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agorollup merge of #19880: sanxiyn/assoc-resolve-lifetime
Alex Crichton [Wed, 17 Dec 2014 16:34:56 +0000 (08:34 -0800)]
rollup merge of #19880: sanxiyn/assoc-resolve-lifetime

Fix #18790.
Fix #19862.

9 years agorollup merge of #19873: drewm1980/master
Alex Crichton [Wed, 17 Dec 2014 16:34:49 +0000 (08:34 -0800)]
rollup merge of #19873: drewm1980/master

In US english, "that" is used in restrictive clauses in place of
"which", and often affects the meaning of sentences.

In UK english and many dialects, no distinction is
made.

While Rust devs want to avoid unproductive pedanticism, it is worth at
least being uniform in documentation such as:

http://doc.rust-lang.org/std/iter/index.html

and also in cases where correct usage of US english clarifies the
sentence.

9 years agorollup merge of #19871: pczarn/ring_buf-remove
Alex Crichton [Wed, 17 Dec 2014 16:34:48 +0000 (08:34 -0800)]
rollup merge of #19871: pczarn/ring_buf-remove

Includes a fix for a small mistake in `fn insert` which is caught by test_insert for len=15, but not len=7.

Part of #18424

r? @Gankro @csherratt @huonw

9 years agorollup merge of #19869: sfackler/free-stdin
Alex Crichton [Wed, 17 Dec 2014 16:34:44 +0000 (08:34 -0800)]
rollup merge of #19869: sfackler/free-stdin

r? @aturon

9 years agorollup merge of #19868: sourcefrog/master
Alex Crichton [Wed, 17 Dec 2014 16:34:43 +0000 (08:34 -0800)]
rollup merge of #19868: sourcefrog/master

The rendered form in http://doc.rust-lang.org/nightly/std/rand/struct.OsRng.html looks wrong.

9 years agorollup merge of #19860: japaric/copy-markers
Alex Crichton [Wed, 17 Dec 2014 16:34:35 +0000 (08:34 -0800)]
rollup merge of #19860: japaric/copy-markers

Necessary to implement `Copy` on structs like this one:

``` rust
struct Slice<'a, T> {
    _contravariant: marker::ContravariantLifetime<'a>,
    _nosend: marker::NoSend,
    data: *const T,
    length: uint,
}
```

r? @alexcrichton

9 years agorollup merge of #19859: alexcrichton/flaky-test
Alex Crichton [Wed, 17 Dec 2014 16:34:34 +0000 (08:34 -0800)]
rollup merge of #19859: alexcrichton/flaky-test

This test would read with a timeout and then send a UDP message, expecting the
message to be received. The receiving port, however, was bound in the child
thread so it could be the case that the timeout and send happens before the
child thread runs. To remedy this we just bind the port before the child thread
runs, moving it into the child later on.

cc #19120

9 years agorollup merge of #19857: japaric/test-19129
Alex Crichton [Wed, 17 Dec 2014 16:34:28 +0000 (08:34 -0800)]
rollup merge of #19857: japaric/test-19129

Closes #19129

9 years agorollup merge of #19856: iKevinY/faq-fixes
Alex Crichton [Wed, 17 Dec 2014 16:34:16 +0000 (08:34 -0800)]
rollup merge of #19856: iKevinY/faq-fixes

- Change long inline code to code block
- Replace double-hyphens with en dash
- Miscellaneous rephrasings for clarity

**Edit**: Trivial `commit --amend` to change the commit message slightly.

9 years agorollup merge of #19849: alexcrichton/second-pass-option
Alex Crichton [Wed, 17 Dec 2014 16:34:14 +0000 (08:34 -0800)]
rollup merge of #19849: alexcrichton/second-pass-option

This commit takes a second pass through the `std::option` module to fully
stabilize any lingering methods inside of it.

These items were made stable as-is

* Some
* None
* as_mut
* expect
* unwrap
* unwrap_or
* unwrap_or_else
* map
* map_or
* map_or_else
* and_then
* or_else
* unwrap_or_default
* Default implementation
* FromIterator implementation
* Copy implementation

These items were made stable with modifications

* iter - now returns a struct called Iter
* iter_mut - now returns a struct called IterMut
* into_iter - now returns a struct called IntoIter, Clone is never implemented

This is a breaking change due to the modifications to the names of the iterator
types returned. Code referencing the old names should updated to referencing the
newer names instead. This is also a breaking change due to the fact that
`IntoIter` no longer implements the `Clone` trait.

These items were explicitly not stabilized

* as_slice - waiting on indexing conventions
* as_mut_slice - waiting on conventions with as_slice as well
* cloned - the API was still just recently added
* ok_or - API remains experimental
* ok_or_else - API remains experimental

[breaking-change]

9 years agorollup merge of #19846: nicholasbishop/bishops_magical_intuition
Alex Crichton [Wed, 17 Dec 2014 16:34:12 +0000 (08:34 -0800)]
rollup merge of #19846: nicholasbishop/bishops_magical_intuition

9 years agorollup merge of #19845: jbranchaud/fix-indentation-in-ownership-guide
Alex Crichton [Wed, 17 Dec 2014 16:34:11 +0000 (08:34 -0800)]
rollup merge of #19845: jbranchaud/fix-indentation-in-ownership-guide

For reference, this is what the code example looks like before the change:

![screen shot 2014-12-14 at 12 12 58 pm](https://cloud.githubusercontent.com/assets/694063/5428475/ade24176-838a-11e4-870b-c7d4f55bc8d7.png)

9 years agorollup merge of #19838: shepmaster/invariant-lifetime-copy
Alex Crichton [Wed, 17 Dec 2014 16:34:10 +0000 (08:34 -0800)]
rollup merge of #19838: shepmaster/invariant-lifetime-copy

Both ContravariantLifetime and CovariantLifetime are marked as Copy,
so it makes sense for InvariantLifetime to be as well.

9 years agorollup merge of #19832: japaric/no-nocopy
Alex Crichton [Wed, 17 Dec 2014 16:34:09 +0000 (08:34 -0800)]
rollup merge of #19832: japaric/no-nocopy

r? @aturon / @alexcrichton

9 years agorollup merge of #19831: luqmana/deriving-where
Alex Crichton [Wed, 17 Dec 2014 16:34:08 +0000 (08:34 -0800)]
rollup merge of #19831: luqmana/deriving-where

Fixes #19358.

9 years agorollup merge of #19830: mchaput/patch-1
Alex Crichton [Wed, 17 Dec 2014 16:34:07 +0000 (08:34 -0800)]
rollup merge of #19830: mchaput/patch-1

Error message has wrong spelling ("radix is to high").

9 years agorollup merge of #19827: japaric/clone-uc
Alex Crichton [Wed, 17 Dec 2014 16:34:06 +0000 (08:34 -0800)]
rollup merge of #19827: japaric/clone-uc

closes #12677 (cc @Valloric)
cc #15294

r? @aturon / @alexcrichton

(Because of #19358 I had to move the struct bounds from the `where` clause into the parameter list)

9 years agorollup merge of #19821: bkoropoff/issue-19791
Alex Crichton [Wed, 17 Dec 2014 16:34:04 +0000 (08:34 -0800)]
rollup merge of #19821: bkoropoff/issue-19791

Normalize late-bound regions in bare functions, stack closures, and traits and include them in the generated hash.

Closes #19791

r? @nikomatsakis (does my normalization make sense?)
cc @alexcrichton

9 years agorollup merge of #19820: alexcrichton/deprecate-some-more-libs
Alex Crichton [Wed, 17 Dec 2014 16:34:03 +0000 (08:34 -0800)]
rollup merge of #19820: alexcrichton/deprecate-some-more-libs

This commit deprecates a few more in-tree libs for their crates.io counterparts.
Note that this commit does not make use of the #[deprecated] tag to prevent
warnings from being generated for in-tree usage. Once #[unstable] warnings are
turned on then all external users will be warned to move.

These crates have all been duplicated in rust-lang/$crate repositories so
development can happen independently of the in-tree copies. We can explore at a
later date replacing the in-tree copies with the external copies, but at this
time the libraries have changed very little over the past few months so it's
unlikely for changes to be sent to both repos.

cc #19260

9 years agorollup merge of #19818: emk/regex_at_name_opt
Alex Crichton [Wed, 17 Dec 2014 16:34:01 +0000 (08:34 -0800)]
rollup merge of #19818: emk/regex_at_name_opt

Hello! This is my first Rust patch, and I fear that I've probably skipped at least 7 critical steps. I'd appreciate your feedback and advice about how to contribute to Rust.

This patch is based on a discussion with @BurntSushi in #14602 a while back. I'm happy to revise it as needed to fit into the modern world. :-)

As discussed in that issue, the existing `at` and `name` functions represent two different results with the empty string:

1. Matched the empty string.
2. Did not match anything.

Consider the following example.  This regex has two named matched groups, `key` and `value`. `value` is optional:

```rust
// Matches "foo", "foo;v=bar" and "foo;v=".
regex!(r"(?P<key>[a-z]+)(;v=(?P<value>[a-z]*))?");
```

We can access `value` using `caps.name("value")`, but there's no way for us to distinguish between the `"foo"` and `"foo;v="` cases.

Early this year, @BurntSushi recommended modifying the existing `at` and `name` functions to return `Option`, instead of adding new functions to the API.

This is a [breaking-change], but the fix is easy:

- `refs.at(1)` becomes `refs.at(1).unwrap_or("")`.
- `refs.name(name)` becomes `refs.name(name).unwrap_or("")`.

9 years agorollup merge of #19770: csouth3/iterator-wrapperstructs
Alex Crichton [Wed, 17 Dec 2014 16:33:58 +0000 (08:33 -0800)]
rollup merge of #19770: csouth3/iterator-wrapperstructs

Using a type alias for iterator implementations is fragile since this exposes the implementation to users of the iterator, and any changes could break existing code.

This PR changes the iterators of `BTreeMap`, `BTreeSet`, `HashMap`, and `HashSet` to use proper new types, rather than type aliases.  However, since it is fair-game to treat a type-alias as the aliased type, this is a:

[breaking-change].

9 years agorollup merge of #19766: nick29581/coerce-raw
Alex Crichton [Wed, 17 Dec 2014 16:33:57 +0000 (08:33 -0800)]
rollup merge of #19766: nick29581/coerce-raw

r?

9 years agorollup merge of #19764: lifthrasiir/that-stray-nul
Alex Crichton [Wed, 17 Dec 2014 16:33:54 +0000 (08:33 -0800)]
rollup merge of #19764: lifthrasiir/that-stray-nul

Fixes #19719.

9 years agorollup merge of #19755: alexcrichton/rust-serialize
Alex Crichton [Wed, 17 Dec 2014 16:33:53 +0000 (08:33 -0800)]
rollup merge of #19755: alexcrichton/rust-serialize

The primary focus of Rust's stability story at 1.0 is the standard library.
All other libraries distributed with the Rust compiler are planned to
be #[unstable] and therfore only accessible on the nightly channel of Rust. One
of the more widely used libraries today is libserialize, Rust's current solution
for encoding and decoding types.

The current libserialize library, however, has a number of drawbacks:

* The API is not ready to be stabilize as-is and we will likely not have enough
  resources to stabilize the API for 1.0.
* The library is not necessarily the speediest implementations with alternatives
  being developed out-of-tree (e.g. serde from erickt).
* It is not clear how the API of Encodable/Decodable can evolve over time while
  maintaining backwards compatibility.

One of the major pros to the current libserialize, however, is
`deriving(Encodable, Decodable)` as short-hands for enabling serializing and
deserializing a type. This is unambiguously useful functionality, so we cannot
simply deprecate the in-tree libserialize in favor of an external crates.io
implementation.

For these reasons, this commit starts off a stability story for libserialize by
following these steps:

1. The deriving(Encodable, Decodable) modes will be deprecated in favor of a
   renamed deriving(RustcEncodable, RustcDecodable).
2. The in-tree libserialize will be deprecated in favor of an external
   rustc-serialize crate shipped on crates.io. The contents of the crate will be
   the same for now (but they can evolve separately).
3. At 1.0 serialization will be performed through
   deriving(RustcEncodable, RustcDecodable) and the rustc-serialize crate. The
   expansions for each deriving mode will change from `::serialize::foo` to
   `::rustc_serialize::foo`.

This story will require that the compiler freezes its implementation of
`RustcEncodable` deriving for all of time, but this should be a fairly minimal
maintenance burden. Otherwise the crate in crates.io must always maintain the
exact definition of its traits, but the implementation of json, for example, can
continue to evolve in the semver-sense.

The major goal for this stabilization effort is to pave the road for a new
official serialization crate which can replace the current one, solving many of
its downsides in the process. We are not assuming that this will exist for 1.0,
hence the above measures. Some possibilities for replacing libserialize include:

* If plugins have a stable API, then any crate can provide a custom `deriving`
  mode (will require some compiler work). This means that any new serialization
  crate can provide its own `deriving` with its own backing
  implementation, entirely obsoleting the current libserialize and fully
  replacing it.

* Erick is exploring the possibility of code generation via preprocessing Rust
  source files in the near term until plugins are stable. This strategy would
  provide the same ergonomic benefit that `deriving` does today in theory.

So, in summary, the current libserialize crate is being deprecated in favor of
the crates.io-based rustc-serialize crate where the `deriving` modes are
appropriately renamed. This opens up space for a later implementation of
serialization in a more official capacity while allowing alternative
implementations to be explored in the meantime.

Concretely speaking, this change adds support for the `RustcEncodable` and
`RustcDecodable` deriving modes. After a snapshot is made warnings will be
turned on for usage of `Encodable` and `Decodable` as well as deprecating the
in-tree libserialize crate to encurage users to use rustc-serialize instead.

9 years agorollup merge of #19753: brson/rust-installer
Alex Crichton [Wed, 17 Dec 2014 16:33:52 +0000 (08:33 -0800)]
rollup merge of #19753: brson/rust-installer

This is just a refactoring of the current installer so that Rust and Cargo
use the same codebase.

cc #16456

9 years agorollup merge of #19743: steveklabnik/gh16143
Alex Crichton [Wed, 17 Dec 2014 16:33:50 +0000 (08:33 -0800)]
rollup merge of #19743: steveklabnik/gh16143

This will hopefully help people with their first steps in Rust.

Fixes #16143.

/cc @jvns

9 years agorollup merge of #19729: vhbit/ios-oibit-fix
Alex Crichton [Wed, 17 Dec 2014 16:33:46 +0000 (08:33 -0800)]
rollup merge of #19729: vhbit/ios-oibit-fix

9 years agorollup merge of #19720: csouth3/vecmap-newtypes
Alex Crichton [Wed, 17 Dec 2014 16:33:44 +0000 (08:33 -0800)]
rollup merge of #19720: csouth3/vecmap-newtypes

Using a type alias for iterator implementations is fragile since this
exposes the implementation to users of the iterator, and any changes
could break existing code.

This commit changes the iterators of `VecMap` to use
proper new types, rather than type aliases.  However, since it is
fair-game to treat a type-alias as the aliased type, this is a:

[breaking-change].

9 years agoauto merge of #19800 : sfackler/rust/core-hash, r=alexcrichton
bors [Wed, 17 Dec 2014 16:43:20 +0000 (16:43 +0000)]
auto merge of #19800 : sfackler/rust/core-hash, r=alexcrichton

r? @alexcrichton

9 years agoauto merge of #19799 : alexcrichton/rust/stop-panicking, r=huonw
bors [Wed, 17 Dec 2014 14:33:12 +0000 (14:33 +0000)]
auto merge of #19799 : alexcrichton/rust/stop-panicking, r=huonw

Fix a panic where the compiler was looking at stale or old metadata.

See #19798, #19772, #19757, #19744, #19718, #19691.

9 years agoauto merge of #19789 : nick29581/rust/assoc-ufcs2, r=nikomatsakis
bors [Wed, 17 Dec 2014 08:13:07 +0000 (08:13 +0000)]
auto merge of #19789 : nick29581/rust/assoc-ufcs2, r=nikomatsakis

Closes #18433

9 years agoauto merge of #19761 : nick29581/rust/coerce-double, r=nikomatsakis
bors [Wed, 17 Dec 2014 02:42:57 +0000 (02:42 +0000)]
auto merge of #19761 : nick29581/rust/coerce-double, r=nikomatsakis

Part of #18469

[breaking-change]

A receiver will only ever get a single auto-reference. Previously arrays and strings would get two, e.g., [T] would be auto-ref'ed to &&[T]. This is usually apparent when a trait is implemented for `&[T]` and has a method takes self by reference. The usual solution is to implement the trait for `[T]` (the DST form).

r? @nikomatsakis (or anyone else, really)

9 years agoMinor changes to Rust Language FAQ
Kevin Yap [Mon, 15 Dec 2014 02:10:34 +0000 (18:10 -0800)]
Minor changes to Rust Language FAQ

- Change long inline code to code block
- Replace double-hyphens with en dash
- Miscellaneous rephrasings for clarity

9 years agoImplement remove for RingBuf
Piotr Czarnecki [Tue, 16 Dec 2014 23:37:55 +0000 (00:37 +0100)]
Implement remove for RingBuf

9 years agoauto merge of #19921 : FlaPer87/rust/snapshot, r=nikomatsakis
bors [Tue, 16 Dec 2014 17:51:23 +0000 (17:51 +0000)]
auto merge of #19921 : FlaPer87/rust/snapshot, r=nikomatsakis

r? @nikomatsakis

9 years agoFixed iOS build after oibit
Valerii Hiora [Thu, 11 Dec 2014 09:51:25 +0000 (11:51 +0200)]
Fixed iOS build after oibit

9 years agoauto merge of #19647 : nielsegberts/rust/master, r=pnkfelix
bors [Tue, 16 Dec 2014 14:50:58 +0000 (14:50 +0000)]
auto merge of #19647 : nielsegberts/rust/master, r=pnkfelix

The names expected and actual are not used anymore in the output. It also
removes the confusion that the argument order is the opposite of junit.

Bug #7330 is relevant.

9 years agoCreate a snapshot on top of 1b97cd3
Flavio Percoco [Tue, 16 Dec 2014 13:39:00 +0000 (14:39 +0100)]
Create a snapshot on top of 1b97cd3

9 years agoauto merge of #19782 : gereeter/rust/cleanup-btree-node, r=Gankro
bors [Tue, 16 Dec 2014 11:02:56 +0000 (11:02 +0000)]
auto merge of #19782 : gereeter/rust/cleanup-btree-node, r=Gankro

Before:
```
test btree::map::bench::find_rand_100                      ... bench:        12 ns/iter (+/- 0)
test btree::map::bench::find_rand_10_000                   ... bench:        13 ns/iter (+/- 1)
test btree::map::bench::find_seq_100                       ... bench:        11 ns/iter (+/- 0)
test btree::map::bench::find_seq_10_000                    ... bench:        11 ns/iter (+/- 1)
test btree::map::bench::insert_rand_100                    ... bench:       106 ns/iter (+/- 1)
test btree::map::bench::insert_rand_10_000                 ... bench:       326 ns/iter (+/- 8)
test btree::map::bench::insert_seq_100                     ... bench:       198 ns/iter (+/- 1)
test btree::map::bench::insert_seq_10_000                  ... bench:       312 ns/iter (+/- 3)
test btree::map::bench::iter_1000                          ... bench:     16563 ns/iter (+/- 173)
test btree::map::bench::iter_100000                        ... bench:   1686508 ns/iter (+/- 108592)
test btree::map::bench::iter_20                            ... bench:       365 ns/iter (+/- 25)
```

After:
```
test btree::map::bench::find_rand_100                      ... bench:        12 ns/iter (+/- 0)
test btree::map::bench::find_rand_10_000                   ... bench:        12 ns/iter (+/- 0)
test btree::map::bench::find_seq_100                       ... bench:        11 ns/iter (+/- 0)
test btree::map::bench::find_seq_10_000                    ... bench:        11 ns/iter (+/- 0)
test btree::map::bench::insert_rand_100                    ... bench:        89 ns/iter (+/- 1)
test btree::map::bench::insert_rand_10_000                 ... bench:       121 ns/iter (+/- 3)
test btree::map::bench::insert_seq_100                     ... bench:       149 ns/iter (+/- 0)
test btree::map::bench::insert_seq_10_000                  ... bench:       228 ns/iter (+/- 1)
test btree::map::bench::iter_1000                          ... bench:     16965 ns/iter (+/- 220)
test btree::map::bench::iter_100000                        ... bench:   1687836 ns/iter (+/- 18746)
test btree::map::bench::iter_20                            ... bench:       366 ns/iter (+/- 21)
```

9 years agoauto merge of #19777 : nikomatsakis/rust/warn-on-shadowing, r=acrichto
bors [Tue, 16 Dec 2014 08:42:40 +0000 (08:42 +0000)]
auto merge of #19777 : nikomatsakis/rust/warn-on-shadowing, r=acrichto

per rfc 459
cc https://github.com/rust-lang/rust/issues/19390

One question is: should we start by warning, and only switch to hard error later? I think we discussed something like this in the meeting.

r? @alexcrichton

9 years agoMove hash module from collections to core
Steven Fackler [Sat, 13 Dec 2014 02:43:07 +0000 (18:43 -0800)]
Move hash module from collections to core

9 years agoauto merge of #19478 : nick29581/rust/assoc-ice-test, r=nikomatsakis
bors [Tue, 16 Dec 2014 06:22:40 +0000 (06:22 +0000)]
auto merge of #19478 : nick29581/rust/assoc-ice-test, r=nikomatsakis

closes #19121

r?

This won't actually pass until https://github.com/rust-lang/rust/pull/19391 lands

9 years agoTest for associated types ICE
Nick Cameron [Tue, 2 Dec 2014 23:06:39 +0000 (15:06 -0800)]
Test for associated types ICE

closes #19121

9 years agoRemove the double auto-ref on arrays/strings as receivers
Nick Cameron [Fri, 12 Dec 2014 00:23:21 +0000 (13:23 +1300)]
Remove the double auto-ref on arrays/strings as receivers

Part of #18469

[breaking-change]

A receiver will only ever get a single auto-reference. Previously arrays and strings would get two, e.g., [T] would be auto-ref'ed to &&[T]. This is usually apparent when a trait is implemented for `&[T]` and has a method takes self by reference. The usual solution is to implement the trait for `[T]` (the DST form).

9 years agoFix pretty printing of HRTB syntax
Brian Koropoff [Sun, 14 Dec 2014 03:11:04 +0000 (19:11 -0800)]
Fix pretty printing of HRTB syntax

9 years agoAdd regression test for #19791
Brian Koropoff [Sat, 13 Dec 2014 22:42:38 +0000 (14:42 -0800)]
Add regression test for #19791

9 years agoHandle higher-rank lifetimes when generating type IDs
Brian Koropoff [Sat, 13 Dec 2014 22:40:38 +0000 (14:40 -0800)]
Handle higher-rank lifetimes when generating type IDs

Normalize late-bound regions in bare functions, stack closures,
and traits and include them in the generated hash.

Closes #19791

9 years agoauto merge of #19747 : alexcrichton/rust/slice-one-trait, r=brson
bors [Tue, 16 Dec 2014 01:32:33 +0000 (01:32 +0000)]
auto merge of #19747 : alexcrichton/rust/slice-one-trait, r=brson

This commit collapses the various prelude traits for slices into just one trait:

* SlicePrelude/SliceAllocPrelude => SliceExt
* CloneSlicePrelude/CloneSliceAllocPrelude => CloneSliceExt
* OrdSlicePrelude/OrdSliceAllocPrelude => OrdSliceExt
* PartialEqSlicePrelude => PartialEqSliceExt

9 years agoUse wrapper structs for `HashSet`'s iterators.
Chase Southwood [Sat, 13 Dec 2014 18:36:05 +0000 (12:36 -0600)]
Use wrapper structs for `HashSet`'s iterators.

Using a type alias for iterator implementations is fragile since this
exposes the implementation to users of the iterator, and any changes
could break existing code.

This commit changes the iterators of `HashSet` to use
proper new types, rather than type aliases.  However, since it is
fair-game to treat a type-alias as the aliased type, this is a:

[breaking-change].

9 years agoUse wrapper structs for `HashMap`'s iterators.
Chase Southwood [Fri, 12 Dec 2014 07:02:19 +0000 (01:02 -0600)]
Use wrapper structs for `HashMap`'s iterators.

Using a type alias for iterator implementations is fragile since this
exposes the implementation to users of the iterator, and any changes
could break existing code.

This commit changes the keys and values iterators of `HashMap` to use
proper new types, rather than type aliases.  However, since it is
fair-game to treat a type-alias as the aliased type, this is a:

[breaking-change].

9 years agoUse wrapper structs for `BTreeSet`'s iterators.
Chase Southwood [Sat, 13 Dec 2014 05:14:57 +0000 (23:14 -0600)]
Use wrapper structs for `BTreeSet`'s iterators.

Using a type alias for iterator implementations is fragile since this
exposes the implementation to users of the iterator, and any changes
could break existing code.

This commit changes the iterators of `BTreeSet` to use
proper new types, rather than type aliases.  However, since it is
fair-game to treat a type-alias as the aliased type, this is a:

[breaking-change].

9 years agoUse wrapper structs for `BTreeMap`'s iterators.
Chase Southwood [Fri, 12 Dec 2014 06:04:47 +0000 (00:04 -0600)]
Use wrapper structs for `BTreeMap`'s iterators.

Using a type alias for iterator implementations is fragile since this
exposes the implementation to users of the iterator, and any changes
could break existing code.

This commit changes the keys and values iterators of `BTreeMap` to use
proper new types, rather than type aliases.  However, since it is
fair-game to treat a type-alias as the aliased type, this is a:

[breaking-change].

9 years agoReview changes
Nick Cameron [Tue, 16 Dec 2014 00:48:18 +0000 (13:48 +1300)]
Review changes

9 years agoPath types to associated types with form `T::A`
Nick Cameron [Thu, 4 Dec 2014 19:58:52 +0000 (11:58 -0800)]
Path types to associated types with form `T::A`

Closes #18433

9 years agoauto merge of #19448 : japaric/rust/binops-by-value, r=nikomatsakis
bors [Mon, 15 Dec 2014 22:11:44 +0000 (22:11 +0000)]
auto merge of #19448 : japaric/rust/binops-by-value, r=nikomatsakis

- The following operator traits now take their arguments by value: `Add`, `Sub`, `Mul`, `Div`, `Rem`, `BitAnd`, `BitOr`, `BitXor`, `Shl`, `Shr`. This breaks all existing implementations of these traits.

- The binary operation `a OP b` now "desugars" to `OpTrait::op_method(a, b)` and consumes both arguments.

- `String` and `Vec` addition have been changed to reuse the LHS owned value, and to avoid internal cloning. Only the following asymmetric operations are available: `String + &str` and `Vec<T> + &[T]`, which are now a short-hand for the "append" operation.

[breaking-change]

---

This passes `make check` locally. I haven't touch the unary operators in this PR, but converting them to by value should be very similar to this PR. I can work on them after this gets the thumbs up.

@nikomatsakis r? the compiler changes
@aturon r? the library changes. I think the only controversial bit is the semantic change of the `Vec`/`String` `Add` implementation.
cc #19148

9 years agolibstd: add a dummy field to `OsRng` to avoid out of module construction
Jorge Aparicio [Mon, 15 Dec 2014 20:35:34 +0000 (15:35 -0500)]
libstd: add a dummy field to `OsRng` to avoid out of module construction

9 years agoRemove internal uses of `marker::NoCopy`
Jorge Aparicio [Sun, 14 Dec 2014 04:06:44 +0000 (23:06 -0500)]
Remove internal uses of `marker::NoCopy`

9 years agoauto merge of #19882 : steveklabnik/rust/fix_download, r=nikomatsakis
bors [Mon, 15 Dec 2014 19:12:44 +0000 (19:12 +0000)]
auto merge of #19882 : steveklabnik/rust/fix_download, r=nikomatsakis

Thank you, @Ap0ph1s.

9 years agoauto merge of #19785 : brson/rust/rollup, r=brson
bors [Mon, 15 Dec 2014 15:33:11 +0000 (15:33 +0000)]
auto merge of #19785 : brson/rust/rollup, r=brson

9 years agoRemove all shadowed lifetimes.
Niko Matsakis [Fri, 12 Dec 2014 16:09:32 +0000 (11:09 -0500)]
Remove all shadowed lifetimes.

9 years agoEmit warning when lifetime names are shadowed.
Niko Matsakis [Fri, 12 Dec 2014 16:09:24 +0000 (11:09 -0500)]
Emit warning when lifetime names are shadowed.

This is not technically a [breaking-change], but it will be soon, so
you should update your code. Typically, shadowing is accidental, and
the shadowing lifetime can simply be removed. This frequently occurs
in constructor patterns:

```rust
// Old:
impl<'a> SomeStruct<'a> { fn new<'a>(..) -> SomeStruct<'a> { ... } }

// Should be:
impl<'a> SomeStruct<'a> { fn new(..) -> SomeStruct<'a> { ... } }
```

Otherwise, you should rename the inner lifetime to something
else. Note though that lifetime elision frequently applies:

```rust
// Old
impl<'a> SomeStruct<'a> {
    fn get<'a>(x: &'a self) -> &'a T { &self.field }
}

// Should be:
impl<'a> SomeStruct<'a> {
    fn get(x: &self) -> &T { &self.field }
}
``

9 years agoFix windows download links
Steve Klabnik [Mon, 15 Dec 2014 14:55:56 +0000 (09:55 -0500)]
Fix windows download links

Thank you, @Ap0ph1s.

9 years agorollup merge of #19814: jbranchaud/fix-a-typo-in-ownership-guide
Brian Anderson [Sun, 14 Dec 2014 02:24:45 +0000 (18:24 -0800)]
rollup merge of #19814: jbranchaud/fix-a-typo-in-ownership-guide

9 years agorollup merge of #19812: frewsxcv/expansion-include-enum
Brian Anderson [Sun, 14 Dec 2014 02:24:42 +0000 (18:24 -0800)]
rollup merge of #19812: frewsxcv/expansion-include-enum

In preparation for [removing the `std::cmp::Ordering` reexport](https://github.com/rust-lang/rust/issues/19253), this needs to be done to prevent errors like:

```
note: in expansion of #[deriving]
note: expansion site
error: unresolved name `std::cmp::Equal`
#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Show)]
                                             ^~~
```

9 years agorollup merge of #19804: kballard/vim-new-unicode-escapes
Brian Anderson [Sun, 14 Dec 2014 02:24:18 +0000 (18:24 -0800)]
rollup merge of #19804: kballard/vim-new-unicode-escapes

9 years agorollup merge of #19802: jbranchaud/add-btreeset-new-doctest
Brian Anderson [Sun, 14 Dec 2014 02:24:15 +0000 (18:24 -0800)]
rollup merge of #19802: jbranchaud/add-btreeset-new-doctest

9 years agorollup merge of #19793: tomjakubowski/metadata-const-attrs
Brian Anderson [Sun, 14 Dec 2014 02:24:13 +0000 (18:24 -0800)]
rollup merge of #19793: tomjakubowski/metadata-const-attrs

Fix #19773

Together with #19774 (which this is rebased on):

Fix #18156, fix #19722, fix #19185

r? @alexcrichton (since this was your suggestion!)

9 years agorollup merge of #19787: akiss77/fix-i8-c_char
Brian Anderson [Sun, 14 Dec 2014 02:24:05 +0000 (18:24 -0800)]
rollup merge of #19787: akiss77/fix-i8-c_char

On AArch64, libc::c_char is u8. There are some places in the code where i8 is assumed, which causes compilation errors.

(AArch64 is not officially supported yet, but this change does not hurt any other targets and makes the code future-proof.)

9 years agorollup merge of #19784: csouth3/vim-syntax-iter
Brian Anderson [Sun, 14 Dec 2014 02:23:41 +0000 (18:23 -0800)]
rollup merge of #19784: csouth3/vim-syntax-iter

Vim still incorrectly highlights just `ExactSize` as a valid trait name, but the trait has been renamed to `ExactSizeIterator`.

9 years agorollup merge of #19779: Noctune/master
Brian Anderson [Sun, 14 Dec 2014 02:23:30 +0000 (18:23 -0800)]
rollup merge of #19779: Noctune/master

The old PartialOrd impl for raw pointers would always return Some(_), so It might as well implement Ord too.

9 years agorollup merge of #19775: SimonSapin/gedit-new-unicode-escape
Brian Anderson [Sun, 14 Dec 2014 02:23:19 +0000 (18:23 -0800)]
rollup merge of #19775: SimonSapin/gedit-new-unicode-escape

9 years agorollup merge of #19774: tomjakubowski/rustdoc-consts-statics
Brian Anderson [Sun, 14 Dec 2014 02:23:13 +0000 (18:23 -0800)]
rollup merge of #19774: tomjakubowski/rustdoc-consts-statics

Build `clean::ConstantItem` values in the `inline` module and
pretty-print the AST for inlined const items.

Doc strings are still missing from inlined constants (see #19773).

Partially address #18156, #19722, #19185

Fix #15821

r? @alexcrichton

9 years agorollup merge of #19771: jbranchaud/add-btreeset-iter-doctests
Brian Anderson [Sun, 14 Dec 2014 02:23:09 +0000 (18:23 -0800)]
rollup merge of #19771: jbranchaud/add-btreeset-iter-doctests

9 years agorollup merge of #19763: csouth3/remove-featuregates
Brian Anderson [Sun, 14 Dec 2014 02:23:00 +0000 (18:23 -0800)]
rollup merge of #19763: csouth3/remove-featuregates

This is a revival of #19517 (per request of @alexcrichton) now that the new snapshots have landed.  We can now remove the last feature gates for if_let, while_let, and tuple_indexing scattered throughout the test sources since these features have been added to Rust.

Closes #19473.

9 years agorollup merge of #19754: steveklabnik/remove_sundown
Brian Anderson [Sun, 14 Dec 2014 02:22:55 +0000 (18:22 -0800)]
rollup merge of #19754: steveklabnik/remove_sundown

9 years agorollup merge of #19746: steveklabnik/gh9266
Brian Anderson [Sun, 14 Dec 2014 02:22:44 +0000 (18:22 -0800)]
rollup merge of #19746: steveklabnik/gh9266

Fixes #9266

9 years agorollup merge of #19738: steveklabnik/gh19717
Brian Anderson [Sun, 14 Dec 2014 02:22:25 +0000 (18:22 -0800)]
rollup merge of #19738: steveklabnik/gh19717

Fixes #19717

9 years agorollup merge of #19735: sethpollack/patch-1
Brian Anderson [Sun, 14 Dec 2014 02:22:23 +0000 (18:22 -0800)]
rollup merge of #19735: sethpollack/patch-1

9 years agorollup merge of #19714: steveklabnik/gh16219
Brian Anderson [Sun, 14 Dec 2014 02:22:14 +0000 (18:22 -0800)]
rollup merge of #19714: steveklabnik/gh16219

These should be properly annotated instead.

Fixes #16219.

9 years agorollup merge of #19710: steveklabnik/gh15449
Brian Anderson [Sun, 14 Dec 2014 02:22:09 +0000 (18:22 -0800)]
rollup merge of #19710: steveklabnik/gh15449

Fixes #15499.

9 years agorollup merge of #19709: steveklabnik/po4a_fix
Brian Anderson [Sun, 14 Dec 2014 02:22:06 +0000 (18:22 -0800)]
rollup merge of #19709: steveklabnik/po4a_fix

This line was declared twice, which causes the build of i10n docs to
fail.

9 years agoResolve lifetimes in associated types
Seo Sanghyeon [Mon, 15 Dec 2014 13:31:38 +0000 (22:31 +0900)]
Resolve lifetimes in associated types

9 years agoauto merge of #19778 : aochagavia/rust/ice, r=alexcrichton
bors [Mon, 15 Dec 2014 11:17:44 +0000 (11:17 +0000)]
auto merge of #19778 : aochagavia/rust/ice, r=alexcrichton

Fixes #19734

9 years agoStandardize some usages of "which" in docstrings
Andrew Wagner [Mon, 15 Dec 2014 09:22:49 +0000 (10:22 +0100)]
Standardize some usages of "which" in docstrings

In US english, "that" is used in restrictive clauses in place of
"which", and often affects the meaning of sentences.

In UK english and many dialects, no distinction is
made.

While Rust devs want to avoid unproductive pedanticism, it is worth at
least being uniform in documentation such as:

http://doc.rust-lang.org/std/iter/index.html

and also in cases where correct usage of US english clarifies the
sentence.

9 years agoauto merge of #19750 : murarth/rust/rusti-support, r=brson
bors [Mon, 15 Dec 2014 08:32:45 +0000 (08:32 +0000)]
auto merge of #19750 : murarth/rust/rusti-support, r=brson

Makes a couple changes that support the implementation of a REPL:

* Implementation of wrapper code for LLVM ExecutionEngine API
* Fixing a change I made earlier to reset compiler state in `phase_1_[...]`
  instead of `compile_input` as the latter is not used in a REPL

9 years agoFree stdin on exit
Steven Fackler [Mon, 15 Dec 2014 07:36:50 +0000 (23:36 -0800)]
Free stdin on exit

9 years agoFix Markdown syntax in docs for OsRng
Martin Pool [Mon, 15 Dec 2014 06:26:09 +0000 (22:26 -0800)]
Fix Markdown syntax in docs for OsRng

9 years agoimpl `Copy` for `NoSend`/`NoSync`
Jorge Aparicio [Mon, 15 Dec 2014 03:21:43 +0000 (22:21 -0500)]
impl `Copy` for `NoSend`/`NoSync`

9 years agostd: Collapse SlicePrelude traits
Alex Crichton [Thu, 11 Dec 2014 17:44:17 +0000 (09:44 -0800)]
std: Collapse SlicePrelude traits

This commit collapses the various prelude traits for slices into just one trait:

* SlicePrelude/SliceAllocPrelude => SliceExt
* CloneSlicePrelude/CloneSliceAllocPrelude => CloneSliceExt
* OrdSlicePrelude/OrdSliceAllocPrelude => OrdSliceExt
* PartialEqSlicePrelude => PartialEqSliceExt

9 years agostd: Bind port early to make a test more reliable
Alex Crichton [Mon, 15 Dec 2014 02:56:19 +0000 (18:56 -0800)]
std: Bind port early to make a test more reliable

This test would read with a timeout and then send a UDP message, expecting the
message to be received. The receiving port, however, was bound in the child
thread so it could be the case that the timeout and send happens before the
child thread runs. To remedy this we just bind the port before the child thread
runs, moving it into the child later on.

cc #19120

9 years agoAdd test for #19129
Jorge Aparicio [Mon, 15 Dec 2014 02:10:51 +0000 (21:10 -0500)]
Add test for #19129

Closes #19129

9 years agoauto merge of #19742 : vhbit/rust/copy-for-bitflags, r=alexcrichton
bors [Mon, 15 Dec 2014 00:07:35 +0000 (00:07 +0000)]
auto merge of #19742 : vhbit/rust/copy-for-bitflags, r=alexcrichton

9 years agostd: Fully stabilize Option<T>
Alex Crichton [Sun, 14 Dec 2014 18:34:23 +0000 (10:34 -0800)]
std: Fully stabilize Option<T>

This commit takes a second pass through the `std::option` module to fully
stabilize any lingering methods inside of it.

These items were made stable as-is

* Some
* None
* as_mut
* expect
* unwrap
* unwrap_or
* unwrap_or_else
* map
* map_or
* map_or_else
* and_then
* or_else
* unwrap_or_default
* Default implementation
* FromIterator implementation
* Copy implementation

These items were made stable with modifications

* iter - now returns a struct called Iter
* iter_mut - now returns a struct called IterMut
* into_iter - now returns a struct called IntoIter, Clone is never implemented

This is a breaking change due to the modifications to the names of the iterator
types returned. Code referencing the old names should updated to referencing the
newer names instead. This is also a breaking change due to the fact that
`IntoIter` no longer implements the `Clone` trait.

These items were explicitly not stabilized

* as_slice - waiting on indexing conventions
* as_mut_slice - waiting on conventions with as_slice as well
* cloned - the API was still just recently added
* ok_or - API remains experimental
* ok_or_else - API remains experimental

[breaking-change]

9 years agoauto merge of #19703 : nikomatsakis/rust/unsafe-trait, r=acrichto
bors [Sun, 14 Dec 2014 19:07:29 +0000 (19:07 +0000)]
auto merge of #19703 : nikomatsakis/rust/unsafe-trait, r=acrichto

This PR allows declaring traits and impls as `unsafe`. An `unsafe` trait requires an `unsafe` impl. An `unsafe` impl does not permit unsafe code within its interior (unless that code is contained within an unsafe block or unsafe fn, as normal). The commits are standalone.

r? @alexcrichton
cc #13231

9 years agoFix typo: intuitive -> unintuitive
Nicholas Bishop [Sun, 14 Dec 2014 18:38:46 +0000 (13:38 -0500)]
Fix typo: intuitive -> unintuitive

9 years agoFix indentation in a code example in the ownership guide.
jbranchaud [Sun, 14 Dec 2014 18:09:42 +0000 (12:09 -0600)]
Fix indentation in a code example in the ownership guide.

9 years agoAdd a bunch of new tests per Alex's suggestion.
Niko Matsakis [Wed, 10 Dec 2014 22:24:10 +0000 (17:24 -0500)]
Add a bunch of new tests per Alex's suggestion.

9 years agoImplement `unsafe trait` semantics.
Niko Matsakis [Wed, 10 Dec 2014 15:59:20 +0000 (10:59 -0500)]
Implement `unsafe trait` semantics.

9 years agoParse `unsafe impl` but don't do anything particularly interesting with the results.
Niko Matsakis [Wed, 10 Dec 2014 11:15:06 +0000 (06:15 -0500)]
Parse `unsafe impl` but don't do anything particularly interesting with the results.

9 years agoParse `unsafe trait` but do not do anything with it beyond parsing and integrating...
Niko Matsakis [Wed, 10 Dec 2014 00:59:20 +0000 (19:59 -0500)]
Parse `unsafe trait` but do not do anything with it beyond parsing and integrating into rustdoc etc.