]> git.lizzy.rs Git - rust.git/log
rust.git
9 years agorollup merge of #19972: alexcrichton/snapshots
Alex Crichton [Sun, 21 Dec 2014 08:07:29 +0000 (00:07 -0800)]
rollup merge of #19972: alexcrichton/snapshots

Conflicts:
src/libcollections/string.rs
src/libcollections/vec.rs
src/snapshots.txt

9 years agorollup merge of #20100: alexcrichton/issue-20091
Alex Crichton [Sun, 21 Dec 2014 08:04:30 +0000 (00:04 -0800)]
rollup merge of #20100: alexcrichton/issue-20091

Instead, just pass everything through as a Vec<u8> to get worried about later.

Closes #20091

9 years agorollup merge of #20090: FlaPer87/snapshot
Alex Crichton [Sun, 21 Dec 2014 08:04:30 +0000 (00:04 -0800)]
rollup merge of #20090: FlaPer87/snapshot

r? @nikomatsakis

9 years agostd: Don't parse argv as a String
Alex Crichton [Sun, 21 Dec 2014 07:21:27 +0000 (23:21 -0800)]
std: Don't parse argv as a String

Instead, just pass everything through as a Vec<u8> to get worried about later.

Closes #20091

9 years agorollup merge of #20086: shepmaster/random-typo
Alex Crichton [Sun, 21 Dec 2014 08:04:29 +0000 (00:04 -0800)]
rollup merge of #20086: shepmaster/random-typo

9 years agoCreate a snapshot for 8443b09
Flavio Percoco [Sat, 20 Dec 2014 23:37:07 +0000 (00:37 +0100)]
Create a snapshot for 8443b09

9 years agorollup merge of #20081: tomjakubowski/issue-19646
Alex Crichton [Sun, 21 Dec 2014 08:04:28 +0000 (00:04 -0800)]
rollup merge of #20081: tomjakubowski/issue-19646

Encode foreign item attributes and stability levels and visit foreign
items in the stability visitor.

cc @Gankro

9 years agorollup merge of #20080: seanmonstar/new-show-syntax
Alex Crichton [Sun, 21 Dec 2014 08:04:27 +0000 (00:04 -0800)]
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

9 years agorollup merge of #20079: SimonSapin/string_push_ascii_fast_path
Alex Crichton [Sun, 21 Dec 2014 08:04:26 +0000 (00:04 -0800)]
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')`.)

9 years agorollup merge of #20077: shepmaster/stdin-typo
Alex Crichton [Sun, 21 Dec 2014 08:04:25 +0000 (00:04 -0800)]
rollup merge of #20077: shepmaster/stdin-typo

9 years agorollup merge of #20070: aturon/stab-2-clone
Alex Crichton [Sun, 21 Dec 2014 08:04:25 +0000 (00:04 -0800)]
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

9 years agorollup merge of #20069: jarod/bitflags
Alex Crichton [Sun, 21 Dec 2014 08:04:23 +0000 (00:04 -0800)]
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)

9 years agorollup merge of #20066: aturon/stab-2-cell
Alex Crichton [Sun, 21 Dec 2014 08:04:22 +0000 (00:04 -0800)]
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

9 years agorollup merge of #20062: aturon/stab-2-ints
Alex Crichton [Sun, 21 Dec 2014 08:04:21 +0000 (00:04 -0800)]
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

9 years agorollup merge of #20059: nick29581/self-impl
Alex Crichton [Sun, 21 Dec 2014 08:04:20 +0000 (00:04 -0800)]
rollup merge of #20059: nick29581/self-impl

r? @sfackler

closes #20000

9 years agorollup merge of #20057: nick29581/array-syntax
Alex Crichton [Sun, 21 Dec 2014 08:04:19 +0000 (00:04 -0800)]
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

9 years agorollup merge of #20054: bheesham/nomet
Alex Crichton [Sun, 21 Dec 2014 08:04:16 +0000 (00:04 -0800)]
rollup merge of #20054: bheesham/nomet

#19145

9 years agorollup merge of #20052: barosl/deref-for-box
Alex Crichton [Sun, 21 Dec 2014 08:04:14 +0000 (00:04 -0800)]
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. :blush:

Fixes #18624.

9 years agorollup merge of #20044: csouth3/vec-resize
Alex Crichton [Sun, 21 Dec 2014 08:04:14 +0000 (00:04 -0800)]
rollup merge of #20044: csouth3/vec-resize

This PR adds `resize()` to `Vec` in accordance with RFC 509.

9 years agorollup merge of #20039: barosl/if-let-friendly-error
Alex Crichton [Sun, 21 Dec 2014 08:04:13 +0000 (00:04 -0800)]
rollup merge of #20039: barosl/if-let-friendly-error

Fixes #19991.

9 years agorollup merge of #20029: vhbit/ios-no-rt
Alex Crichton [Sun, 21 Dec 2014 08:04:11 +0000 (00:04 -0800)]
rollup merge of #20029: vhbit/ios-no-rt

9 years agorollup merge of #20027: michaelwoerister/for-loop-var
Alex Crichton [Sun, 21 Dec 2014 08:04:10 +0000 (00:04 -0800)]
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

9 years agorollup merge of #20014: kballard/unsized-marker-type-params
Alex Crichton [Sun, 21 Dec 2014 08:04:09 +0000 (00:04 -0800)]
rollup merge of #20014: kballard/unsized-marker-type-params

Tweak CovariantType, ContravariantType, and InvariantType to allow their
type parameter to be unsized.

9 years agorollup merge of #20006: alexcrichton/no-more-empty-modules
Alex Crichton [Sun, 21 Dec 2014 08:04:08 +0000 (00:04 -0800)]
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.

9 years agorollup merge of #19996: th0114nd/boolean-inden
Alex Crichton [Sun, 21 Dec 2014 08:04:08 +0000 (00:04 -0800)]
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.

9 years agorollup merge of #19994: bluss/doc-ownership
Alex Crichton [Sun, 21 Dec 2014 08:04:08 +0000 (00:04 -0800)]
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.

9 years agorollup merge of #19993: bluss/setalgebraitems
Alex Crichton [Sun, 21 Dec 2014 08:04:07 +0000 (00:04 -0800)]
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

9 years agorollup merge of #19989: th0114nd/quotes-around-as
Alex Crichton [Sun, 21 Dec 2014 08:04:07 +0000 (00:04 -0800)]
rollup merge of #19989: th0114nd/quotes-around-as

9 years agorollup merge of #19983: Munksgaard/fix-19981
Alex Crichton [Sun, 21 Dec 2014 08:04:05 +0000 (00:04 -0800)]
rollup merge of #19983: Munksgaard/fix-19981

The use of `+a+x` is deprecated.

Fixes #19981.

9 years agorollup merge of #19980: erickt/cleanup-serialize
Alex Crichton [Sun, 21 Dec 2014 08:04:05 +0000 (00:04 -0800)]
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.

9 years agorollup merge of #19979: Munksgaard/19978
Alex Crichton [Sun, 21 Dec 2014 08:04:04 +0000 (00:04 -0800)]
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.

9 years agorollup merge of #19977: pnkfelix/add-test-for-issue-19811
Alex Crichton [Sun, 21 Dec 2014 08:04:04 +0000 (00:04 -0800)]
rollup merge of #19977: pnkfelix/add-test-for-issue-19811

Add regression test for Issue 19811.

(Thanks for @emk for providing this.)

Fix #19811.

9 years agorollup merge of #19974: vhbit/json-unicode-literals
Alex Crichton [Sun, 21 Dec 2014 08:04:03 +0000 (00:04 -0800)]
rollup merge of #19974: vhbit/json-unicode-literals

9 years agorollup merge of #19973: vhbit/ios-no-copy
Alex Crichton [Sun, 21 Dec 2014 08:04:03 +0000 (00:04 -0800)]
rollup merge of #19973: vhbit/ios-no-copy

9 years agorollup merge of #19969: aturon/inherit-trait-stab
Alex Crichton [Sun, 21 Dec 2014 08:04:02 +0000 (00:04 -0800)]
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

9 years agorollup merge of #19967: apasel422/binary_heap
Alex Crichton [Sun, 21 Dec 2014 08:04:02 +0000 (00:04 -0800)]
rollup merge of #19967: apasel422/binary_heap

Just a few simplifications and a missing `assert!`.

9 years agorollup merge of #19966: steveklabnik/remove_l10n
Alex Crichton [Sun, 21 Dec 2014 08:04:02 +0000 (00:04 -0800)]
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.

9 years agorollup merge of #19965: japaric/remove-wrong-add
Alex Crichton [Sun, 21 Dec 2014 08:04:01 +0000 (00:04 -0800)]
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

9 years agorollup merge of #19961: alexcrichton/second-pass-result
Alex Crichton [Sun, 21 Dec 2014 08:04:01 +0000 (00:04 -0800)]
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.

9 years agorollup merge of #19957: tshepang/patch-1
Alex Crichton [Sun, 21 Dec 2014 08:04:01 +0000 (00:04 -0800)]
rollup merge of #19957: tshepang/patch-1

9 years agorollup merge of #19944: steveklabnik/doc_sync_arc
Alex Crichton [Sun, 21 Dec 2014 08:04:00 +0000 (00:04 -0800)]
rollup merge of #19944: steveklabnik/doc_sync_arc

Take the docs from Rc<T>, apply them to Arc<T>, and fix some line lengths.

9 years agorollup merge of #19932: elszben/master
Alex Crichton [Sun, 21 Dec 2014 08:04:00 +0000 (00:04 -0800)]
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.

9 years agorollup merge of #19926: eddyb/less-sty
Alex Crichton [Sun, 21 Dec 2014 08:04:00 +0000 (00:04 -0800)]
rollup merge of #19926: eddyb/less-sty

r? @nikomatsakis

9 years agorollup merge of #19898: Aatch/issue-19684
Alex Crichton [Sun, 21 Dec 2014 08:03:59 +0000 (00:03 -0800)]
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.

9 years agorollup merge of #19842: frewsxcv/rm-reexports
Alex Crichton [Sun, 21 Dec 2014 08:03:59 +0000 (00:03 -0800)]
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]

9 years agorollup merge of #19838: shepmaster/invariant-lifetime-copy
Alex Crichton [Sun, 21 Dec 2014 08:03:59 +0000 (00:03 -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 agoRemove a ton of public reexports
Corey Farwell [Sat, 13 Dec 2014 16:15:18 +0000 (11:15 -0500)]
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]

9 years agorollup merge of #19823: iKevinY/doc-fixes
Alex Crichton [Sun, 21 Dec 2014 08:03:58 +0000 (00:03 -0800)]
rollup merge of #19823: iKevinY/doc-fixes

I was reading through the Rust Guide (hopefully looking to learn some Rust), and I figured it would be a good idea to open a pull request with some of the errata I noticed along the way. Most of the changes are pretty mundane, but there are a couple that might raise a bit of discussion.

### Punctuation outside of 'key term' quotes

This is something that was inconsistent in the Guide. While the convention in American English is to place punctuation immediately following a quotation mark *inside* the quotation mark, it seems strange to do this with 'key terms', considering they are not a true quotation.

### Changed comment placement in 17.2 code block

This is what the code block in [17.2 â€” Ownership, borrowing, and lifetimes](http://doc.rust-lang.org/guide.html#ownership,-borrowing,-and-lifetimes) looks like in fullscreened Safari 8:

![screen shot 2014-12-13 at 2 48 47 pm](https://cloud.githubusercontent.com/assets/2434728/5425704/2fff3bf0-82d7-11e4-8c8f-d594acde8937.png)

Some of the comments extend *just* too far, causing them to bleed into the next line, so I moved a few of them above the relevant lines of code to avoid this.

9 years agorollup merge of #19727: lfairy/patch-1
Alex Crichton [Sun, 21 Dec 2014 08:03:58 +0000 (00:03 -0800)]
rollup merge of #19727: lfairy/patch-1

Closes #19323.

9 years agorollup merge of #19651: Gankro/ptr-docs
Alex Crichton [Sun, 21 Dec 2014 08:03:58 +0000 (00:03 -0800)]
rollup merge of #19651: Gankro/ptr-docs

r? @steveklabnik @thestinger

9 years agoauto merge of #19953 : sanxiyn/rust/privacy-span, r=alexcrichton
bors [Sun, 21 Dec 2014 13:22:48 +0000 (13:22 +0000)]
auto merge of #19953 : sanxiyn/rust/privacy-span, r=alexcrichton

Fix #19062.

9 years agoauto merge of #19946 : cgaebel/rust/hashmap-drain-iter, r=gankro
bors [Sun, 21 Dec 2014 07:22:45 +0000 (07:22 +0000)]
auto merge of #19946 : cgaebel/rust/hashmap-drain-iter, r=gankro

It is useful to move all the elements out of a hashmap without deallocating
the underlying buffer. It came up in IRC, and this patch implements it as
`drain`.

r? @Gankro
cc: @frankmcsherry

9 years agoFix small typos in std::rand documentation
Jake Goulding [Sat, 20 Dec 2014 22:13:13 +0000 (17:13 -0500)]
Fix small typos in std::rand documentation

9 years agoauto merge of #19903 : cgaebel/rust/ringbuf-as-slice, r=Gankro
bors [Sat, 20 Dec 2014 20:00:36 +0000 (20:00 +0000)]
auto merge of #19903 : cgaebel/rust/ringbuf-as-slice, r=Gankro

See: https://github.com/rust-lang/rfcs/pull/509

Not sure if this is allowed to land before the RFC. Either way,
it's here for review.

r? @Gankro
cc: @bfops

9 years agoVisit + encode stability for foreign items
Tom Jakubowski [Sat, 20 Dec 2014 18:08:16 +0000 (10:08 -0800)]
Visit + encode stability for foreign items

Fix #19649

9 years agoMerge String::push_with_ascii_fast_path into String::push.
Simon Sapin [Sat, 20 Dec 2014 17:29:02 +0000 (17:29 +0000)]
Merge String::push_with_ascii_fast_path into String::push.

9 years agoAdd String::push_with_ascii_fast_path, bench it against String::push
Simon Sapin [Sat, 20 Dec 2014 17:17:58 +0000 (17:17 +0000)]
Add String::push_with_ascii_fast_path, bench it against String::push

`String::push(&mut self, ch: char)` currently has a single code path
that calls `Char::encode_utf8`.
Perhaps it could be faster for ASCII `char`s, which are represented as
a single byte in UTF-8.

This commit leaves the method unchanged,
adds a copy of it with the fast path,
and adds benchmarks to compare them.

Results 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).

Output of `make check-stage1-collections NO_REBUILD=1 PLEASE_BENCH=1 TESTNAME=string::tests::bench_push`

```
test string::tests::bench_push_char_one_byte                 ... bench:     59552 ns/iter (+/- 2132) = 167 MB/s
test string::tests::bench_push_char_one_byte_with_fast_path  ... bench:      6563 ns/iter (+/- 658) = 1523 MB/s
test string::tests::bench_push_char_two_bytes                ... bench:     71520 ns/iter (+/- 3541) = 279 MB/s
test string::tests::bench_push_char_two_bytes_with_slow_path ... bench:     71452 ns/iter (+/- 4202) = 279 MB/s
test string::tests::bench_push_str                           ... bench:        24 ns/iter (+/- 2)
test string::tests::bench_push_str_one_byte                  ... bench:     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
instead of `s.push('x')`.)

9 years agometadata: Encode attrs for foreign items.
Tom Jakubowski [Sat, 20 Dec 2014 17:29:38 +0000 (09:29 -0800)]
metadata: Encode attrs for foreign items.

Related to #19649 and #16289

9 years agoauto merge of #20073 : nikomatsakis/rust/generalized-where-clause-parser, r=nikomatsakis
bors [Sat, 20 Dec 2014 16:12:37 +0000 (16:12 +0000)]
auto merge of #20073 : nikomatsakis/rust/generalized-where-clause-parser, r=nikomatsakis

This is the same branch as #20002 but with the pretty-printing test fixed.

9 years agoCorrect typo in doc for StdinReaderGuard
Jake Goulding [Sat, 20 Dec 2014 16:08:51 +0000 (11:08 -0500)]
Correct typo in doc for StdinReaderGuard

9 years agoauto merge of #19900 : alexcrichton/rust/compiler-flags, r=cmr
bors [Sat, 20 Dec 2014 13:52:27 +0000 (13:52 +0000)]
auto merge of #19900 : alexcrichton/rust/compiler-flags, r=cmr

This commit shuffles around some CLI flags of the compiler to some more stable
locations with some renamings. The changes made were:

* The `-v` flag has been repurposes as the "verbose" flag. The version flag has
  been renamed to `-V`.
* The `-h` screen has been split into two parts. Most top-level options (not
  all) show with `-h`, and the remaining options (generally obscure) can be
  shown with `--help -v` which is a "verbose help screen"
* The `-V` flag (version flag now) has lost its argument as it is now requested
  with `rustc -vV` "verbose version".
* The `--emit` option has had its `ir` and `bc` variants renamed to `llvm-ir`
  and `llvm-bc` to emphasize that they are LLVM's IR/bytecode.
* The `--emit` option has grown a new variant, `dep-info`, which subsumes the
  `--dep-info` CLI argument. The `--dep-info` flag is now deprecated.
* The `--parse-only`, `--no-trans`, `--no-analysis`, and `--pretty` flags have
  moved behind the `-Z` family of flags.
* The `--debuginfo` and `--opt-level` flags were moved behind the top-level `-C`
  flag.
* The `--print-file-name` and `--print-crate-name` flags were moved behind one
  global `--print` flag which now accepts one of `crate-name`, `file-names`, or
  `sysroot`. This global `--print` flag is intended to serve as a mechanism for
  learning various metadata about the compiler itself.
* The top-level `--pretty` flag was moved to a number of `-Z` options.

No warnings are currently enabled to allow tools like Cargo to have time to
migrate to the new flags before spraying warnings to all users.

cc https://github.com/rust-lang/rust/issues/19051

9 years agopatch up pretty-printing test
Niko Matsakis [Sat, 20 Dec 2014 13:41:33 +0000 (08:41 -0500)]
patch up pretty-printing test

9 years agoAdd support for multiple region bounds in where clauses
Jared Roesch [Sat, 20 Dec 2014 10:48:43 +0000 (02:48 -0800)]
Add support for multiple region bounds in where clauses

9 years agoAdd parser support for generalized where clauses
Jared Roesch [Sat, 20 Dec 2014 10:29:19 +0000 (02:29 -0800)]
Add parser support for generalized where clauses

Implement support in the parser for generalized where clauses,
as well as the conversion of ast::WherePredicates to
ty::Predicate in `collect.rs`.

9 years agoStabilize clone
Aaron Turon [Sat, 20 Dec 2014 08:35:06 +0000 (00:35 -0800)]
Stabilize 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`.

9 years agoadd {:?} fmt syntax
Sean McArthur [Sat, 20 Dec 2014 08:32:07 +0000 (00:32 -0800)]
add {:?} fmt syntax

9 years agoAllow `Self` in impls.
Nick Cameron [Sun, 14 Dec 2014 02:42:41 +0000 (15:42 +1300)]
Allow `Self` in impls.

9 years agoauto merge of #19511 : eddyb/rust/no-shadow, r=alexcrichton
bors [Sat, 20 Dec 2014 08:10:23 +0000 (08:10 +0000)]
auto merge of #19511 : eddyb/rust/no-shadow, r=alexcrichton

r? @erickt

9 years agouse binary literals to better reflect "bitflags"
Jarod Liu [Sat, 20 Dec 2014 08:07:03 +0000 (16:07 +0800)]
use binary literals to better reflect "bitflags"

9 years agoStabilize cell
Aaron Turon [Sat, 20 Dec 2014 07:47:46 +0000 (23:47 -0800)]
Stabilize 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.)

9 years agoStabilize integer modules
Aaron Turon [Sat, 20 Dec 2014 06:28:12 +0000 (22:28 -0800)]
Stabilize integer modules

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.

9 years agoauto merge of #19995 : eddyb/rust/split-resolve, r=nikomatsakis
bors [Sat, 20 Dec 2014 05:52:18 +0000 (05:52 +0000)]
auto merge of #19995 : eddyb/rust/split-resolve, r=nikomatsakis

r? @nikomatsakis

9 years agoFix fallout of removing import_shadowing in tests.
Eduard Burtescu [Fri, 19 Dec 2014 12:02:22 +0000 (14:02 +0200)]
Fix fallout of removing import_shadowing in tests.

9 years agoFix more import_shadowing fallout in collections.
Eduard Burtescu [Thu, 18 Dec 2014 04:15:39 +0000 (06:15 +0200)]
Fix more import_shadowing fallout in collections.

9 years agoFix the fallout of removing feature(import_shadowing).
Eduard Burtescu [Mon, 15 Dec 2014 04:03:00 +0000 (06:03 +0200)]
Fix the fallout of removing feature(import_shadowing).

9 years agorustc_resolve: move export recording into its own module.
Eduard Burtescu [Fri, 19 Dec 2014 07:14:42 +0000 (09:14 +0200)]
rustc_resolve: move export recording into its own module.

9 years agorustc_resolve: move unused import checking into its own module.
Eduard Burtescu [Fri, 19 Dec 2014 07:13:54 +0000 (09:13 +0200)]
rustc_resolve: move unused import checking into its own module.

9 years agoSplit resolve from rustc::middle into rustc_resolve.
Eduard Burtescu [Thu, 18 Dec 2014 22:46:26 +0000 (00:46 +0200)]
Split resolve from rustc::middle into rustc_resolve.

9 years agorustc: middle: move some types from resolve to privacy.
Eduard Burtescu [Thu, 18 Dec 2014 22:26:54 +0000 (00:26 +0200)]
rustc: middle: move some types from resolve to privacy.

9 years agorustc: middle: move TraitItemKind from resolve to def.
Eduard Burtescu [Thu, 18 Dec 2014 22:17:58 +0000 (00:17 +0200)]
rustc: middle: move TraitItemKind from resolve to def.

9 years agorustc: middle: move Export and ExportMap from resolve to def.
Eduard Burtescu [Thu, 18 Dec 2014 22:03:00 +0000 (00:03 +0200)]
rustc: middle: move Export and ExportMap from resolve to def.

9 years agorustc: middle: use cheaper Name in resolve::Export instead of String.
Eduard Burtescu [Thu, 18 Dec 2014 21:21:30 +0000 (23:21 +0200)]
rustc: middle: use cheaper Name in resolve::Export instead of String.

9 years agorustc: middle: move TraitMap from resolve to ty.
Eduard Burtescu [Thu, 18 Dec 2014 19:04:28 +0000 (21:04 +0200)]
rustc: middle: move TraitMap from resolve to ty.

9 years agorustc: middle: move DefMap from resolve to def.
Eduard Burtescu [Thu, 18 Dec 2014 19:03:56 +0000 (21:03 +0200)]
rustc: middle: move DefMap from resolve to def.

9 years agomiddle: resolve: fix inconsistencies around ExportMap and remove the 2 suffix.
Eduard Burtescu [Thu, 18 Dec 2014 18:27:17 +0000 (20:27 +0200)]
middle: resolve: fix inconsistencies around ExportMap and remove the 2 suffix.

9 years agorustc: don't allow(non_camel_case_types) in resolve.
Eduard Burtescu [Thu, 18 Dec 2014 17:17:41 +0000 (19:17 +0200)]
rustc: don't allow(non_camel_case_types) in resolve.

9 years agorustc: use Ty instead of passing ty::sty around.
Eduard Burtescu [Tue, 16 Dec 2014 16:38:06 +0000 (18:38 +0200)]
rustc: use Ty instead of passing ty::sty around.

9 years agoRemove feature(import_shadowing) from all crates.
Eduard Burtescu [Wed, 3 Dec 2014 23:58:26 +0000 (01:58 +0200)]
Remove feature(import_shadowing) from all crates.

9 years agoAllow use of `[_ ; n]` syntax for fixed length and repeating arrays.
Nick Cameron [Sat, 20 Dec 2014 02:20:51 +0000 (15:20 +1300)]
Allow use of `[_ ; n]` syntax for fixed length and repeating arrays.

This does NOT break any existing programs because the `[_, ..n]` syntax is also supported.

9 years agoauto merge of #19640 : aliblong/rust/power_of_two_reform, r=Gankro
bors [Sat, 20 Dec 2014 01:12:19 +0000 (01:12 +0000)]
auto merge of #19640 : aliblong/rust/power_of_two_reform, r=Gankro

The `is_power_of_two()` method of the `UnsignedInt` trait currently returns `true` for `self == 0`. Zero is not a power of two, assuming an integral exponent `k >= 0`. I've therefore moved this functionality to the new method `is_power_of_two_or_zero()` and reformed `is_power_of_two()` to return false for `self == 0`.

To illustrate the usefulness of the existence of both functions, consider `HashMap`. Its capacity must be zero or a power of two; conversely, it also requires a (non-zero) power of two for key and val alignment.

Also, added a small amount of documentation regarding #18604.

9 years agoDrop the Match prefix from the MatchSource variants
Barosl Lee [Fri, 19 Dec 2014 22:58:02 +0000 (07:58 +0900)]
Drop the Match prefix from the MatchSource variants

9 years agoPrint a friendly error for the if-let construct without an else block
Barosl Lee [Fri, 19 Dec 2014 16:42:21 +0000 (01:42 +0900)]
Print a friendly error for the if-let construct without an else block

Fixes #19991.

9 years agoImplement Deref for Box
Barosl Lee [Fri, 19 Dec 2014 22:44:21 +0000 (07:44 +0900)]
Implement Deref for Box

Fixes #18624.

9 years agoReform power_of_two methods for perf increase & semantic change to consider 0 not...
Aaron Liblong [Mon, 8 Dec 2014 06:03:35 +0000 (01:03 -0500)]
Reform power_of_two methods for perf increase & semantic change to consider 0 not a power of 2.

Vec panics when attempting to reserve capacity > int::MAX (uint::MAX / 2).

9 years agostd: Second pass stabilization of Result<T, E>
Alex Crichton [Wed, 17 Dec 2014 20:10:13 +0000 (12:10 -0800)]
std: Second pass stabilization of Result<T, E>

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.

9 years agoImplement resize for Vec
Chase Southwood [Fri, 19 Dec 2014 20:30:51 +0000 (14:30 -0600)]
Implement resize for Vec

This commit adds `resize` to `Vec` in accordance with RFC 509.

9 years agohashset: Clean up and rename the HashSet iterators
bluss [Fri, 19 Dec 2014 20:54:50 +0000 (21:54 +0100)]
hashset: Clean up and rename the HashSet iterators

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

[breaking-change]

9 years agoauto merge of #19463 : kali/rust/master, r=alexcrichton
bors [Fri, 19 Dec 2014 20:22:17 +0000 (20:22 +0000)]
auto merge of #19463 : kali/rust/master, r=alexcrichton

parse_ty() no longer takes a boolean parameter. quote_ty! implementation has not yet been modified accordingly.

As a matter of fact, quote_ty! was not covered by tests. One test (called qquotes) references it, but it has been ignored for nearly one year and now need heavy refactoring.

quote_token.rs seemed like a good place to test quote_ty!, many other quote_*! macros were asserted there.

9 years agorustc: Start "stabilizing" some flags
Alex Crichton [Tue, 16 Dec 2014 00:03:39 +0000 (16:03 -0800)]
rustc: Start "stabilizing" some flags

This commit shuffles around some CLI flags of the compiler to some more stable
locations with some renamings. The changes made were:

* The `-v` flag has been repurposes as the "verbose" flag. The version flag has
  been renamed to `-V`.
* The `-h` screen has been split into two parts. Most top-level options (not
  all) show with `-h`, and the remaining options (generally obscure) can be
  shown with `--help -v` which is a "verbose help screen"
* The `-V` flag (version flag now) has lost its argument as it is now requested
  with `rustc -vV` "verbose version".
* The `--emit` option has had its `ir` and `bc` variants renamed to `llvm-ir`
  and `llvm-bc` to emphasize that they are LLVM's IR/bytecode.
* The `--emit` option has grown a new variant, `dep-info`, which subsumes the
  `--dep-info` CLI argument. The `--dep-info` flag is now deprecated.
* The `--parse-only`, `--no-trans`, and `--no-analysis` flags have
  moved behind the `-Z` family of flags.
* The `--debuginfo` and `--opt-level` flags were moved behind the top-level `-C`
  flag.
* The `--print-file-name` and `--print-crate-name` flags were moved behind one
  global `--print` flag which now accepts one of `crate-name`, `file-names`, or
  `sysroot`. This global `--print` flag is intended to serve as a mechanism for
  learning various metadata about the compiler itself.

No warnings are currently enabled to allow tools like Cargo to have time to
migrate to the new flags before spraying warnings to all users.

9 years agoMiscellaneous changes to Rust Guide
Kevin Yap [Sat, 13 Dec 2014 22:36:53 +0000 (14:36 -0800)]
Miscellaneous changes to Rust Guide

- Various grammatical changes
- Place punctuation outside of key term quotes
- Change comment placement in 17.2 code block
- Replace double hyphens with en dashes