Commit Graph

35356 Commits

Author SHA1 Message Date
Alex Crichton
75a84f9a3e rollup merge of #19857: japaric/test-19129
Closes #19129
2014-12-17 11:50:27 -08:00
Alex Crichton
991bd049c9 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.
2014-12-17 11:50:26 -08:00
Alex Crichton
137a3dbffd 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]
2014-12-17 11:50:26 -08:00
Alex Crichton
dea69e66b8 rollup merge of #19846: nicholasbishop/bishops_magical_intuition 2014-12-17 11:50:26 -08:00
Alex Crichton
f7cb5b6c20 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)
2014-12-17 11:50:26 -08:00
Alex Crichton
924cd5a6d6 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.
2014-12-17 11:50:26 -08:00
Alex Crichton
dbd68c70cd rollup merge of #19832: japaric/no-nocopy
r? @aturon / @alexcrichton
2014-12-17 11:50:25 -08:00
Alex Crichton
bdb1146181 rollup merge of #19831: luqmana/deriving-where
Fixes #19358.
2014-12-17 11:50:25 -08:00
Alex Crichton
823cd7a8d5 rollup merge of #19830: mchaput/patch-1
Error message has wrong spelling ("radix is to high").
2014-12-17 11:50:25 -08:00
Alex Crichton
f9ff55e4d0 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)
2014-12-17 11:50:25 -08:00
Alex Crichton
b5302217f0 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
2014-12-17 11:50:25 -08:00
Alex Crichton
be0c8fb507 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
2014-12-17 11:50:24 -08:00
Alex Crichton
5294ceb312 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("")`.
2014-12-17 11:50:24 -08:00
Alex Crichton
974e17b9ea 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].
2014-12-17 11:50:24 -08:00
Alex Crichton
126a83f433 rollup merge of #19766: nick29581/coerce-raw
r?
2014-12-17 11:50:24 -08:00
Alex Crichton
6089699411 rollup merge of #19764: lifthrasiir/that-stray-nul
Fixes #19719.
2014-12-17 11:50:24 -08:00
Alex Crichton
fc1b4379eb 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.
2014-12-17 11:50:23 -08:00
Alex Crichton
58020d38b1 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
2014-12-17 11:50:23 -08:00
Alex Crichton
bfb5f8b931 rollup merge of #19743: steveklabnik/gh16143
This will hopefully help people with their first steps in Rust.

Fixes #16143.

/cc @jvns
2014-12-17 11:50:23 -08:00
Alex Crichton
c43a807d25 rollup merge of #19729: vhbit/ios-oibit-fix 2014-12-17 11:50:23 -08:00
Alex Crichton
71201234d2 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].
2014-12-17 11:50:23 -08:00
bors
66c297d847 auto merge of #19800 : sfackler/rust/core-hash, r=alexcrichton
r? @alexcrichton
2014-12-17 16:43:20 +00:00
bors
2c533efd09 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.
2014-12-17 14:33:12 +00:00
bors
4e8ba4955c auto merge of #19789 : nick29581/rust/assoc-ufcs2, r=nikomatsakis
Closes #18433
2014-12-17 08:13:07 +00:00
Vadim Chugunov
b3b7185bed Fix typo 2014-12-16 21:44:54 -08:00
Chase Southwood
9caa66f9c8 Implement BorrowFrom<Arc<T>> for T 2014-12-16 22:12:40 -06:00
bors
4265e86844 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)
2014-12-17 02:42:57 +00:00
Kevin Yap
2ba2843b49 Minor changes to Rust Language FAQ
- Change long inline code to code block
- Replace double-hyphens with en dash
- Miscellaneous rephrasings for clarity
2014-12-16 18:25:38 -08:00
Steve Klabnik
18c420ed62 Improve docs for std::vec 2014-12-16 21:20:58 -05:00
Piotr Czarnecki
59d4153457 Implement remove for RingBuf 2014-12-17 00:37:55 +01:00
Steve Klabnik
033a79203e Document std::mem 2014-12-16 18:23:55 -05:00
Philipp Gesang
c1b69c7a82
guide-ownership.md, guide-testing.md: fix typos
Signed-off-by: Philipp Gesang <phg@phi-gamma.net>
2014-12-16 23:50:42 +01:00
Clark Gaebel
c42e2f604e Small cleanups in HashMap based off of new rust features. 2014-12-16 17:45:16 -05:00
P1start
570325dd3c Use the sugary syntax to print the Fn traits in error messages 2014-12-17 09:33:09 +13:00
Sean Collins
73d395e6db Change 'if' to lowercase, so it displays better on the site 2014-12-16 13:55:34 -05:00
bors
42deaa5e42 auto merge of #19921 : FlaPer87/rust/snapshot, r=nikomatsakis
r? @nikomatsakis
2014-12-16 17:51:23 +00:00
Alex Crichton
df5404cfa8 std: Change escape_unicode to use new escapes
This changes the `escape_unicode` method on a `char` to use the new style of
unicode escapes in the language.

Closes #19811
Closes #19879
2014-12-16 08:09:37 -08:00
Felix S. Klock II
8f4e9c2357 Fix make TAGS.emacs. 2014-12-16 17:08:49 +01:00
Felix S. Klock II
375b79a0fb Followup fixes that I missed during an earlier rebase. 2014-12-16 17:07:26 +01:00
Valerii Hiora
b7ba69d4dd Fixed iOS build after oibit 2014-12-16 18:07:05 +02:00
bors
4375be65a4 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.
2014-12-16 14:50:58 +00:00
Flavio Percoco
8a5698834e Create a snapshot on top of 1b97cd3 2014-12-16 14:39:18 +01:00
Felix S. Klock II
7d4e7f0795 AST refactor: make the place in ExprBox an option.
This is to allow us to migrate away from UnUniq in a followup commit,
and thus unify the code paths related to all forms of `box`.
2014-12-16 14:30:30 +01:00
bors
59287b0170 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)
```
2014-12-16 11:02:56 +00:00
Flavio Percoco
127dac4990 Don't make unboxed closures implicitly copiable
The fix just checks if the bound is `Copy` and returns an `Err` if so.

Closes: #19817
2014-12-16 11:44:10 +01:00
bors
41f5907fa6 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
2014-12-16 08:42:40 +00:00
mdinger
3a073e3127 Tuple test no longer needed. Is already in run-pass tests 2014-12-16 02:42:25 -05:00
Steven Fackler
24a8ef63ff Move hash module from collections to core 2014-12-15 22:48:54 -08:00
bors
cdd8b5b5ea 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
2014-12-16 06:22:40 +00:00
Aaron Friel
4ecad89636 Add probe and var for file
Was testing rustup on a very minimal Debian installation and got errors during the install process (error occurred in `install.sh` of the Rust nightly.)

Noticed that Rustup was downloading the i686 nightly instead of x86-64. Installing `file` fixed the problem, and this patch adds the probe to ensure file is installed before attempting to use it.

There may still be an issue with the i686 installation, I did not investigate further.
2014-12-15 22:45:12 -06:00