Commit Graph

35576 Commits

Author SHA1 Message Date
Alex Crichton a76a802768 serialize: Fully deprecate the library
This commit completes the deprecation story for the in-tree serialization
library. The compiler will now emit a warning whenever it encounters
`deriving(Encodable)` or `deriving(Decodable)`, and the library itself is now
marked `#[unstable]` for when feature staging is enabled.

All users of serialization can migrate to the `rustc-serialize` crate on
crates.io which provides the exact same interface as the libserialize library
in-tree. The new deriving modes are named `RustcEncodable` and `RustcDecodable`
and require `extern crate "rustc-serialize" as rustc_serialize` at the crate
root in order to expand correctly.

To migrate all crates, add the following to your `Cargo.toml`:

    [dependencies]
    rustc-serialize = "0.1.1"

And then add the following to your crate root:

    extern crate "rustc-serialize" as rustc_serialize;

Finally, rename `Encodable` and `Decodable` deriving modes to `RustcEncodable`
and `RustcDecodable`.

[breaking-change]
2014-12-22 00:14:56 -08:00
bors 34d6800092 auto merge of #20104 : alexcrichton/rust/rollup, r=alexcrichton 2014-12-22 00:12:47 +00:00
Alex Crichton fb7c08876e Test fixes and rebase conflicts 2014-12-21 13:49:04 -08:00
Alex Crichton dbeef0edb2 rollup merge of #19972: alexcrichton/snapshots
Conflicts:
	src/libcollections/string.rs
	src/libcollections/vec.rs
	src/snapshots.txt
2014-12-21 09:28:07 -08:00
Alex Crichton b084cda4e9 rollup merge of #20100: alexcrichton/issue-20091
Instead, just pass everything through as a Vec<u8> to get worried about later.

Closes #20091
2014-12-21 09:27:38 -08:00
Alex Crichton 08ac8d7972 rollup merge of #20090: FlaPer87/snapshot
r? @nikomatsakis
2014-12-21 09:27:38 -08:00
Alex Crichton a666105b4c std: Don't parse argv as a String
Instead, just pass everything through as a Vec<u8> to get worried about later.

Closes #20091
2014-12-21 09:27:38 -08:00
Alex Crichton 2135712a82 rollup merge of #20086: shepmaster/random-typo 2014-12-21 09:27:37 -08:00
Flavio Percoco 1c80446d1b Create a snapshot for 8443b09 2014-12-21 09:27:37 -08:00
Alex Crichton 97f605e858 rollup merge of #20081: tomjakubowski/issue-19646
Encode foreign item attributes and stability levels and visit foreign
items in the stability visitor.

cc @Gankro
2014-12-21 09:27:37 -08:00
Alex Crichton 40e1f7c6ba rollup merge of #20080: seanmonstar/new-show-syntax
First step of #20013. This will allow (after a snapshot) to change all the debug strings from `{}` to `{:?}`.

r? @alexcrichton
2014-12-21 09:27:37 -08:00
Alex Crichton 3e5257f68f rollup merge of #20079: SimonSapin/string_push_ascii_fast_path
`String::push(&mut self, ch: char)` currently has a single code path that calls `Char::encode_utf8`. This adds a fast path for ASCII `char`s, which are represented as a single byte in UTF-8.

Benchmarks of stage1 libcollections at the intermediate commit show that the fast path very significantly improves the performance of repeatedly pushing an ASCII `char`, but does not significantly affect the performance for a non-ASCII `char` (where the fast path is not taken).

```
bench_push_char_one_byte                  59552 ns/iter (+/- 2132) = 167 MB/s
bench_push_char_one_byte_with_fast_path    6563 ns/iter (+/- 658) = 1523 MB/s
bench_push_char_two_bytes                 71520 ns/iter (+/- 3541) = 279 MB/s
bench_push_char_two_bytes_with_slow_path  71452 ns/iter (+/- 4202) = 279 MB/s
bench_push_str_one_byte                   38910 ns/iter (+/- 2477) = 257 MB/s
```

A benchmark of pushing a one-byte-long `&str` is added for comparison, but its performance [has varied a lot lately](https://github.com/rust-lang/rust/pull/19640#issuecomment-67741561). (When the input is fixed, `s.push_str("x")` could be used just as well as `s.push('x')`.)
2014-12-21 09:27:37 -08:00
Alex Crichton 0191dce41d rollup merge of #20077: shepmaster/stdin-typo 2014-12-21 09:27:36 -08:00
Alex Crichton 1dc5e6312f rollup merge of #20070: aturon/stab-2-clone
This patch marks `clone` stable, as well as the `Clone` trait, but
leaves `clone_from` unstable. The latter will be decided by the beta.

The patch also marks most manual implementations of `Clone` as stable,
except where the APIs are otherwise deprecated or where there is
uncertainty about providing `Clone`.

r? @alexcrichton
2014-12-21 09:27:36 -08:00
Alex Crichton 6495c27ee6 rollup merge of #20069: jarod/bitflags
Although using hex literals is not wrong, but I think use binary literals will be better.(especially in examples)
2014-12-21 09:27:36 -08:00
Alex Crichton b187ae55aa rollup merge of #20066: aturon/stab-2-cell
This patch finalizes stabilization for the `cell` module, settling on
the current names `Cell`, `RefCell`, `UnsafeCell`, `Ref` and `RefMut`.

While we had considered improving these names, no one was able to
produce a truly compelling alternative.

There is one substantive change here: the `get` method of `UnsafeSell`
is now marked `unsafe`. Merely getting a raw pointer to the contents is
not, by itself, an unsafe operation. (Consider that you can always
safely turn a reference into a raw pointer, and that raw pointer may
then be aliased by subsequent references.)

r? @alexcrichton
2014-12-21 09:27:36 -08:00
Alex Crichton f6a7388210 rollup merge of #20062: aturon/stab-2-ints
This small patch stabilizes the names of all integer modules (including
`int` and `uint`) and the `MIN` and `MAX` constants. The `BITS` and
`BYTES` constants are left unstable for now.

r? @alexcrichton
2014-12-21 09:27:35 -08:00
Alex Crichton e1d09766ad rollup merge of #20059: nick29581/self-impl
r? @sfackler

closes #20000
2014-12-21 09:27:35 -08:00
Alex Crichton bc1d818b83 rollup merge of #20057: nick29581/array-syntax
This does NOT break any existing programs because the `[_, ..n]` syntax is also supported.

Part of #19999

r? @nikomatsakis
2014-12-21 09:27:35 -08:00
Alex Crichton 7e62684bb4 rollup merge of #20054: bheesham/nomet
#19145
2014-12-21 09:27:35 -08:00
Alex Crichton 40d59e9467 rollup merge of #20052: barosl/deref-for-box
As the previous pull request (#19023) was closed due to inactivity, I steal the chance and open this pull request. 😊

Fixes #18624.
2014-12-21 09:27:35 -08:00
Alex Crichton fb6ff04994 rollup merge of #20044: csouth3/vec-resize
This PR adds `resize()` to `Vec` in accordance with RFC 509.
2014-12-21 09:27:34 -08:00
Alex Crichton eb47e1e446 rollup merge of #20039: barosl/if-let-friendly-error
Fixes #19991.
2014-12-21 09:27:34 -08:00
Alex Crichton cfc815bef4 rollup merge of #20029: vhbit/ios-no-rt 2014-12-21 09:27:34 -08:00
Alex Crichton a3dfaa62fe rollup merge of #20027: michaelwoerister/for-loop-var
Back when for-loop iteration variables were just de-sugared into `let` bindings, debuginfo for them was created like for any other `let` binding. When the implementation approach for for-loops changed, we ceased having debuginfo for the iteration variable. This PR fixes this omission and adds a more prominent test case for it.

Also contains some minor, general cleanup of the debuginfo module.

Fixes #19732
2014-12-21 09:27:34 -08:00
Alex Crichton de7abcf6d3 rollup merge of #20014: kballard/unsized-marker-type-params
Tweak CovariantType, ContravariantType, and InvariantType to allow their
type parameter to be unsized.
2014-12-21 09:27:34 -08:00
Alex Crichton fc40812b0f rollup merge of #20006: alexcrichton/no-more-empty-modules
This commit modifies rustdoc to not require these empty modules to be public in
the standard library. The modules still remain as a location to attach
documentation to, but the modules themselves are now private (don't have to
commit to an API). The documentation for the standard library now shows all of
the primitive types on the main index page.
2014-12-21 09:27:33 -08:00
Alex Crichton 4ae3107e72 rollup merge of #19996: th0114nd/boolean-inden
The current indentation level would indicate that Boolean literals are on the same level as Integer and Float literals under Number literals, unindenting moves it to the same scope as Character and string literals, Byte and byte string literals, and Number literals under Literals.
2014-12-21 09:27:33 -08:00
Alex Crichton 7e2ed4adc1 rollup merge of #19994: bluss/doc-ownership
Disambiguate maximally by using 'and' instead of '&' next to discussion
about references.

As a bonus, fix the spelling of the car too.
2014-12-21 09:27:33 -08:00
Alex Crichton 91b3232764 rollup merge of #19993: bluss/setalgebraitems
This removes the type SetAlgebraItems and replaces it with the
structs Intersection and Difference.

Rename the existing HashSet iterators according to RFC #344:

* SetItems -> Iter
* SetMoveItems -> IntoIter
* Remaining set combination iterators renamed to Union and SymmetricDifference
2014-12-21 09:27:31 -08:00
Alex Crichton 67ea1dc4bf rollup merge of #19989: th0114nd/quotes-around-as 2014-12-21 09:26:45 -08:00
Alex Crichton 576467b492 rollup merge of #19983: Munksgaard/fix-19981
The use of `+a+x` is deprecated.

Fixes #19981.
2014-12-21 09:26:44 -08:00
Alex Crichton 583112269a rollup merge of #19980: erickt/cleanup-serialize
This brings over some changes from [rustc-serialize](https://github.com/rust-lang/rustc-serialize). It makes sense to keep the two in sync until we finally remove libserialize, just to make sure they don't diverge from each other.
2014-12-21 09:26:44 -08:00
Alex Crichton ca521fb7a9 rollup merge of #19979: Munksgaard/19978
This fixes #19978. The bug was introduced by 570325d, where if the type
of an Fn has not been inferred (strs[0] is "_") we slice from 1 to 0.
2014-12-21 09:26:44 -08:00
Alex Crichton 1d34d93d11 rollup merge of #19977: pnkfelix/add-test-for-issue-19811
Add regression test for Issue 19811.

(Thanks for @emk for providing this.)

Fix #19811.
2014-12-21 09:26:44 -08:00
Alex Crichton 319ed81307 rollup merge of #19974: vhbit/json-unicode-literals 2014-12-21 09:26:44 -08:00
Alex Crichton 31800b38e6 rollup merge of #19973: vhbit/ios-no-copy 2014-12-21 09:26:43 -08:00
Alex Crichton ee1bb3f25b rollup merge of #19969: aturon/inherit-trait-stab
There is currently no way to specify the stability level for a trait
impl produced by `deriving`. This patch is a stopgap solution that:

* Turns of stability inheritance for trait impls, and
* Uses the stability level of the *trait* if no level is directly
  specified.

That is, manual trait impls may still provide a directly stability
level, but `deriving` will use the level of the trait. While not a
perfect solution, it should be good enough for 1.0 API stabilization, as
we will like *remove* any unwanted impls outright.

r? @alexcrichton
2014-12-21 09:26:43 -08:00
Alex Crichton b4f393ee8a rollup merge of #19967: apasel422/binary_heap
Just a few simplifications and a missing `assert!`.
2014-12-21 09:26:43 -08:00
Alex Crichton 8c030a87b3 rollup merge of #19966: steveklabnik/remove_l10n
@brson suggested that I remove this stuff in https://github.com/rust-lang/rust/pull/19897/files#r22014810, but it seems more appropriate to do separate from that.
2014-12-21 09:26:43 -08:00
Alex Crichton 9f4f6cf655 rollup merge of #19965: japaric/remove-wrong-add
TL;DR I wrongly implemented these two ops, namely `"prefix" + "suffix".to_string()` gives back `"suffixprefix"`. Let's remove them.

The correct implementation of these operations (`lhs.clone().push_str(rhs.as_slice())`) is really wasteful, because the lhs has to be cloned and the rhs gets moved/consumed just to be dropped (no buffer reuse). For this reason, I'd prefer to drop the implementation instead of fixing it. This leaves us with the fact that you'll be able to do `String + &str` but not `&str + String`, which may be unexpected.

r? @aturon
Closes #19952
2014-12-21 09:26:43 -08:00
Alex Crichton e8722691ab rollup merge of #19961: alexcrichton/second-pass-result
This commit, like the second pass of `Option`, largely just stablizes the
existing functionality after renaming a few iterators.

The specific actions taken were:

* The `Ok` and `Err` variants were marked `#[stable]` as the stability
  inheritance was since removed.
* The `as_mut` method is now stable.
* The `map` method is now stable
* The `map_err` method is now stable
* The `iter`, `iter_mut`, and `into_iter` methods now returned structures named
  after the method of iteration. The methods are also now all stable.
* The `and_then` method is now stable.
* The `or_else` method is now stable.
* The `unwrap` family of functions are now all stable: `unwrap_or`,
  `unwrap_or_else`, `unwrap`, and `unwrap_err`.

There is a possible open extension to `Result::{and, and_then}` to make the
return type further generic over `FromError` (as proposed in #19078), but this
is a backwards compatible change due to the usage of default type parameters,
which makes the two functions safe to stabilize now regardless of the outcome of
that issue.
2014-12-21 09:26:42 -08:00
Alex Crichton 5acb622f5b rollup merge of #19957: tshepang/patch-1 2014-12-21 09:26:42 -08:00
Alex Crichton c76590cb14 rollup merge of #19944: steveklabnik/doc_sync_arc
Take the docs from Rc<T>, apply them to Arc<T>, and fix some line lengths.
2014-12-21 09:26:42 -08:00
Alex Crichton 264088c1ee rollup merge of #19932: elszben/master
First attempt to contribute to rust (and using github). This commit adds a few examples to std::io::TempDir. The examples seem to look okay (in my browser) and make check also passes.
2014-12-21 09:26:42 -08:00
Alex Crichton e654491960 rollup merge of #19926: eddyb/less-sty
r? @nikomatsakis
2014-12-21 09:26:42 -08:00
Alex Crichton 2af8155bee rollup merge of #19898: Aatch/issue-19684
#16081 fixed an issue where a nested return statement would cause incorrect behaviour due to the inner return writing over the return stack slot that had already been written too. However, the check was very broad and picked many cases that wouldn't ever be affected by this issue.

As a result, the number of allocas increased dramatically and therefore stack-size increased. LLVM is not able to remove all of the extraneous allocas. Any code that had multiple return values in a compound expression at the end of a function (including loops) would be hit by the issue.

The check now uses a control-flow graph to only consider the case when the inner return is executed conditionally. By itself, this narrowed definition causes #15763 to return, so the control-flow graph is also used to avoid passing the return slot as a destination when the result won't be used.

This change allows the stack-size of the main rustc task to be reduced to 8MB from 32MB.
2014-12-21 09:26:41 -08:00
Alex Crichton 25f8051f2e rollup merge of #19842: frewsxcv/rm-reexports
Remove most of the public reexports mentioned in #19253

These are all leftovers from the enum namespacing transition

In particular:

* src/libstd/num/strconv.rs
 * ExponentFormat
 * SignificantDigits
 * SignFormat
* src/libstd/path/windows.rs
 * PathPrefix
* src/libstd/sys/windows/timer.rs
 * Req
* src/libcollections/str.rs
 * MaybeOwned
* src/libstd/collections/hash/map.rs
 * Entry
* src/libstd/collections/hash/table.rs
 * BucketState
* src/libstd/dynamic_lib.rs
 * Rtld
* src/libstd/os.rs
 * MemoryMapKind
 * MapOption
 * MapError
* src/libstd/sys/common/net.rs
 * SocketStatus
 * InAddr
* src/libstd/sys/unix/timer.rs
 * Req

[breaking-change]
2014-12-21 09:26:41 -08:00
Alex Crichton bc99ced570 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-21 09:26:41 -08:00
Corey Farwell 98af642f5c Remove a ton of public reexports
Remove most of the public reexports mentioned in #19253

These are all leftovers from the enum namespacing transition

In particular:

* src/libstd/num/strconv.rs
 * ExponentFormat
 * SignificantDigits
 * SignFormat
* src/libstd/path/windows.rs
 * PathPrefix
* src/libstd/sys/windows/timer.rs
 * Req
* src/libcollections/str.rs
 * MaybeOwned
* src/libstd/collections/hash/map.rs
 * Entry
* src/libstd/collections/hash/table.rs
 * BucketState
* src/libstd/dynamic_lib.rs
 * Rtld
* src/libstd/io/net/ip.rs
 * IpAddr
* src/libstd/os.rs
 * MemoryMapKind
 * MapOption
 * MapError
* src/libstd/sys/common/net.rs
 * SocketStatus
 * InAddr
* src/libstd/sys/unix/timer.rs
 * Req

[breaking-change]
2014-12-21 09:26:41 -08:00