Commit Graph

35237 Commits

Author SHA1 Message Date
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
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
bors
42deaa5e42 auto merge of #19921 : FlaPer87/rust/snapshot, r=nikomatsakis
r? @nikomatsakis
2014-12-16 17:51:23 +00: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
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
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
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
Nick Cameron
98c4d4b7f4 Test for associated types ICE
closes #19121
2014-12-16 17:20:28 +13:00
Nick Cameron
769aa0a7b3 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).
2014-12-16 17:05:33 +13:00
bors
b497f05008 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
2014-12-16 01:32:33 +00:00
Nick Cameron
743d6a4132 Review changes 2014-12-16 13:50:24 +13:00
Nick Cameron
65616644af Path types to associated types with form T::A
Closes #18433
2014-12-16 13:50:24 +13:00
bors
0669a432a2 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
2014-12-15 22:11:44 +00:00
bors
92e9e70d15 auto merge of #19882 : steveklabnik/rust/fix_download, r=nikomatsakis
Thank you, @Ap0ph1s.
2014-12-15 19:12:44 +00:00
bors
1b97cd338b auto merge of #19785 : brson/rust/rollup, r=brson 2014-12-15 15:33:11 +00:00
Niko Matsakis
1718cd6ee0 Remove all shadowed lifetimes. 2014-12-15 10:23:48 -05:00
Niko Matsakis
b60de4bfc2 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 }
}
``
2014-12-15 10:23:48 -05:00
Steve Klabnik
bd776b5090 Fix windows download links
Thank you, @Ap0ph1s.
2014-12-15 09:55:56 -05:00
Brian Anderson
1cb7e9fc63 rollup merge of #19814: jbranchaud/fix-a-typo-in-ownership-guide 2014-12-15 06:45:37 -08:00
Brian Anderson
f0bf34de9f 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)]
                                             ^~~
```
2014-12-15 06:45:36 -08:00
Brian Anderson
e52efe262d rollup merge of #19804: kballard/vim-new-unicode-escapes 2014-12-15 06:45:36 -08:00
Brian Anderson
74fde5e10d rollup merge of #19802: jbranchaud/add-btreeset-new-doctest 2014-12-15 06:45:36 -08:00
Brian Anderson
77d2a116c4 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!)
2014-12-15 06:45:36 -08:00
Brian Anderson
53982b64f3 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.)
2014-12-15 06:45:35 -08:00
Brian Anderson
0b214bfee0 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`.
2014-12-15 06:45:35 -08:00
Brian Anderson
e8e8677072 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.
2014-12-15 06:45:35 -08:00
Brian Anderson
5691c0f49a rollup merge of #19775: SimonSapin/gedit-new-unicode-escape 2014-12-15 06:45:35 -08:00
Brian Anderson
3673486c6d 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
2014-12-15 06:45:34 -08:00
Brian Anderson
7afee3a1ab rollup merge of #19771: jbranchaud/add-btreeset-iter-doctests 2014-12-15 06:45:34 -08:00
Brian Anderson
e717362ce5 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.
2014-12-15 06:45:34 -08:00
Brian Anderson
1f349f6c71 rollup merge of #19754: steveklabnik/remove_sundown 2014-12-15 06:45:33 -08:00
Brian Anderson
8404ea66d9 rollup merge of #19746: steveklabnik/gh9266
Fixes #9266
2014-12-15 06:45:33 -08:00
Brian Anderson
cb2119823d rollup merge of #19738: steveklabnik/gh19717
Fixes #19717
2014-12-15 06:45:33 -08:00
Brian Anderson
36f7f1e301 rollup merge of #19735: sethpollack/patch-1 2014-12-15 06:45:33 -08:00
Brian Anderson
42f4d636fa rollup merge of #19714: steveklabnik/gh16219
These should be properly annotated instead.

Fixes #16219.
2014-12-15 06:44:21 -08:00
Brian Anderson
6c4a2bc55f rollup merge of #19710: steveklabnik/gh15449
Fixes #15499.
2014-12-15 06:44:20 -08:00
Brian Anderson
34dfa7addb rollup merge of #19709: steveklabnik/po4a_fix
This line was declared twice, which causes the build of i10n docs to
fail.
2014-12-15 06:44:20 -08:00
bors
ef0bc464af auto merge of #19778 : aochagavia/rust/ice, r=alexcrichton
Fixes #19734
2014-12-15 11:17:44 +00:00
bors
b677746b1e 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
2014-12-15 08:32:45 +00:00