Commit graph

35580 commits

Author SHA1 Message Date
James Miller
f1a3ff047e Use type-alignment-sized integer for discriminant types
The previous behaviour of using the smallest type possible caused LLVM
to treat padding too conservatively, causing poor codegen. This commit
changes the behaviour to use an type-alignment-sized integer as the
discriminant. This keeps types the same size, but helps LLVM understand
the data structure a little better, resulting in better codegen.
2014-12-23 12:29:52 +13:00
bors
2f3cff6956 auto merge of #20132 : alexcrichton/rust/revert-20027, r=sfackler
The introduced issue https://github.com/rust-lang/rust/issues/20127 seems serious enough that we may want to enqueue a reversion for now. Feel free to beat me with a fix though @michaelwoerister!
2014-12-22 17:11:37 +00:00
Alex Crichton
c5aaa8cc05 Revert "debuginfo: Create debuginfo for for-loop variables again."
This reverts commit b048114718.
2014-12-22 08:25:44 -08:00
Alex Crichton
8e2d952c68 Revert "debuginfo: Clean the debuginfo module up a bit."
This reverts commit 34a6fcf195.
2014-12-22 08:25:34 -08:00
Alex Crichton
f450695183 Revert "debuginfo: Add test case for destructured for-loop variable."
This reverts commit 87c5927b79.
2014-12-22 08:25:11 -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