]> git.lizzy.rs Git - rust.git/log
rust.git
7 years ago`as_bytes` is not the iterator, `bytes` is
Aidan Hobson Sayers [Fri, 21 Oct 2016 17:28:02 +0000 (18:28 +0100)]
`as_bytes` is not the iterator, `bytes` is

7 years agoAuto merge of #37290 - petrochenkov:pnp, r=jseyfried
bors [Fri, 21 Oct 2016 13:41:45 +0000 (06:41 -0700)]
Auto merge of #37290 - petrochenkov:pnp, r=jseyfried

syntax: Tweak path parsing logic

Associated paths starting with `<<` are parsed in patterns.

Paths like `self::foo::bar` are interpreted as paths and not as `self` arguments in methods (cc @matklad).
Now, I believe, *all* paths are consistently parsed greedily in case of ambiguity.
Detection of `&'a mut self::` requires pretty large (but still fixed) lookahead, so I had to increase the size of parser's lookahead buffer.
Curiously, if `lookahead_distance >= lookahead_buffer_size` was used previously, the parser hung forever, I fixed this as well, now it ICEs.

r? @jseyfried

7 years agoAuto merge of #37247 - jseyfried:future_proof_no_link, r=nrc
bors [Fri, 21 Oct 2016 08:48:31 +0000 (01:48 -0700)]
Auto merge of #37247 - jseyfried:future_proof_no_link, r=nrc

macros: Future proof `#[no_link]`

This PR future proofs `#[no_link]` for macro modularization (cc #35896).

First, we resolve all `#[no_link] extern crate`s. `#[no_link]` crates without `#[macro_use]` or `#[macro_reexport]` are not resolved today, this is a [breaking-change]. For example,
```rust
```
Any breakage can be fixed by simply removing the `#[no_link] extern crate`.

Second, `#[no_link] extern crate`s will define an empty module in type namespace to eventually allow importing the crate's macros with `use`. This is a [breaking-change], for example:
```rust
mod syntax {} //< This becomes a duplicate error.
```

r? @nrc

7 years agoAuto merge of #37280 - alexcrichton:debuginfo, r=brson
bors [Fri, 21 Oct 2016 05:34:29 +0000 (22:34 -0700)]
Auto merge of #37280 - alexcrichton:debuginfo, r=brson

Enable line number debuginfo in releases

This commit enables by default passing the `-C debuginfo=1` argument to the
compiler for the stable, beta, and nightly release channels. A new configure
option was also added, `--enable-debuginfo-lines`, to enable this behavior in
developer builds as well.

Closes #36452

7 years agoAuto merge of #37272 - cuviper:local_stage0-proc_macro, r=alexcrichton
bors [Fri, 21 Oct 2016 01:33:28 +0000 (18:33 -0700)]
Auto merge of #37272 - cuviper:local_stage0-proc_macro, r=alexcrichton

Add libproc_macro from local rust to stage0

This library is now required to run rustc 1.14.0.

7 years agoTweak path parsing logic
Vadim Petrochenkov [Wed, 19 Oct 2016 20:33:41 +0000 (23:33 +0300)]
Tweak path parsing logic

7 years agoRefactor parser lookahead buffer and increase its size
Vadim Petrochenkov [Wed, 19 Oct 2016 20:33:41 +0000 (23:33 +0300)]
Refactor parser lookahead buffer and increase its size

7 years agoAuto merge of #37261 - raphlinus:update_llvm, r=bluss
bors [Thu, 20 Oct 2016 15:18:13 +0000 (08:18 -0700)]
Auto merge of #37261 - raphlinus:update_llvm, r=bluss

LLVM: Add triple for Fuchsia

Update subproject commit.

Fixes #36920

7 years agoAuto merge of #37273 - cuviper:major-minor-rebuild, r=alexcrichton
bors [Thu, 20 Oct 2016 12:16:49 +0000 (05:16 -0700)]
Auto merge of #37273 - cuviper:major-minor-rebuild, r=alexcrichton

Detect local-rebuild by just the MAJOR.MINOR version

A new point-release shouldn't change any language semantics, so a local
stage0 that matches MAJOR.MINOR version should still be considered a
local-rebuild as far as `--cfg stageN` features go.

e.g. `1.14.0` should be considered a local-rebuild for any `1.14.X`.

(Bootstrap keys used to be an issue too, until #37265.)

7 years agoAuto merge of #36973 - nnethercote:dep_graph, r=nikomatsakis
bors [Thu, 20 Oct 2016 05:05:13 +0000 (22:05 -0700)]
Auto merge of #36973 - nnethercote:dep_graph, r=nikomatsakis

Don't enqueue onto a disabled dep_graph.

This commit guards all calls to `DepGraphThreadData::enqueue` with a
check to make sure it is enabled. This avoids some useless allocation
and vector manipulations when it is disabled (i.e. when incremental
compilation is off) which improves speed by 1--2% on most of the
rustc-benchmarks.

This commit has an observable functional change: when the dep_graph is
disabled its `shadow_graph` will no longer receive messages. This should
be ok because these message are only used when debug assertions are
enabled.

r? @nikomatsakis

7 years agoAuto merge of #37289 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Thu, 20 Oct 2016 00:41:49 +0000 (17:41 -0700)]
Auto merge of #37289 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 7 pull requests

- Successful merges: #37165, #37187, #37241, #37283, #37285, #37287, #37288
- Failed merges:

7 years agoRollup merge of #37288 - srinivasreddy:snapshot_map, r=eddyb
Guillaume Gomez [Wed, 19 Oct 2016 21:15:01 +0000 (23:15 +0200)]
Rollup merge of #37288 - srinivasreddy:snapshot_map, r=eddyb

run rustfmt on snapshot_map

7 years agoRollup merge of #37287 - srinivasreddy:unify, r=eddyb
Guillaume Gomez [Wed, 19 Oct 2016 21:15:01 +0000 (23:15 +0200)]
Rollup merge of #37287 - srinivasreddy:unify, r=eddyb

run rustfmt on unify folder

7 years agoRollup merge of #37285 - srinivasreddy:cfg, r=nikomatsakis
Guillaume Gomez [Wed, 19 Oct 2016 21:15:01 +0000 (23:15 +0200)]
Rollup merge of #37285 - srinivasreddy:cfg, r=nikomatsakis

run rustfmt on control_flow_graph folder

7 years agoRollup merge of #37283 - posborne:docs/tests-dir-grammar-fixes, r=steveklabnik
Guillaume Gomez [Wed, 19 Oct 2016 21:15:01 +0000 (23:15 +0200)]
Rollup merge of #37283 - posborne:docs/tests-dir-grammar-fixes, r=steveklabnik

Fix grammatical errors in `tests` directory docs

7 years agoRollup merge of #37241 - zackmdavis:if_let_over_none_spaced_empty_block_arm, r=nikoma...
Guillaume Gomez [Wed, 19 Oct 2016 21:15:00 +0000 (23:15 +0200)]
Rollup merge of #37241 - zackmdavis:if_let_over_none_spaced_empty_block_arm, r=nikomatsakis

prefer `if let` to match with `None => { }` arm in some places

In #34268 (8531d581), we replaced matches of None to the unit value `()`
with `if let`s in places where it was deemed that this made the code
unambiguously clearer and more idiomatic. In #34638 (d37edef9), we did
the same for matches of None to the empty block `{}`.

A casual observer, upon seeing these commits fly by, might suppose that
the matter was then settled, that no further pull requests on this
utterly trivial point of style could or would be made. Unless ...

It turns out that sometimes people write the empty block with a space in
between the braces. Who knew?

7 years agoRollup merge of #37187 - frewsxcv:cow-doc-example, r=kmcallister
Guillaume Gomez [Wed, 19 Oct 2016 21:15:00 +0000 (23:15 +0200)]
Rollup merge of #37187 - frewsxcv:cow-doc-example, r=kmcallister

Improve doc example for `std::borrow::Cow`.

None

7 years agoRollup merge of #37165 - GuillaumeGomez:bytes_url, r=kmcallister
Guillaume Gomez [Wed, 19 Oct 2016 21:15:00 +0000 (23:15 +0200)]
Rollup merge of #37165 - GuillaumeGomez:bytes_url, r=kmcallister

Add missing urls for io types

r? @steveklabnik

7 years agorun rustfmt on snapshot_map
Srinivas Reddy Thatiparthy [Wed, 19 Oct 2016 19:10:05 +0000 (00:40 +0530)]
run rustfmt on snapshot_map

7 years agorun rustfmt on unify folder
Srinivas Reddy Thatiparthy [Wed, 19 Oct 2016 19:08:55 +0000 (00:38 +0530)]
run rustfmt on unify folder

7 years agorun rustfmt on control_flow_graph folder
Srinivas Reddy Thatiparthy [Wed, 19 Oct 2016 18:55:19 +0000 (00:25 +0530)]
run rustfmt on control_flow_graph folder

7 years agoFix grammatical errors in `tests` directory docs
Paul Osborne [Wed, 19 Oct 2016 18:37:15 +0000 (13:37 -0500)]
Fix grammatical errors in `tests` directory docs

7 years agoUpdate llvm-auto-clean-trigger
Raph Levien [Tue, 18 Oct 2016 22:23:02 +0000 (15:23 -0700)]
Update llvm-auto-clean-trigger

Update the datestamp so that buildbots do a clean rebuild of llvm.

7 years agoLLVM: Add triple for Fuchsia
Raph Levien [Tue, 18 Oct 2016 20:52:22 +0000 (13:52 -0700)]
LLVM: Add triple for Fuchsia

Update subproject commit.

7 years agoEnable line number debuginfo in releases
Alex Crichton [Wed, 19 Oct 2016 16:48:46 +0000 (09:48 -0700)]
Enable line number debuginfo in releases

This commit enables by default passing the `-C debuginfo=1` argument to the
compiler for the stable, beta, and nightly release channels. A new configure
option was also added, `--enable-debuginfo-lines`, to enable this behavior in
developer builds as well.

Closes #36452

7 years agoAuto merge of #37220 - Mark-Simulacrum:arena-alloc-slice, r=eddyb
bors [Wed, 19 Oct 2016 16:52:48 +0000 (09:52 -0700)]
Auto merge of #37220 - Mark-Simulacrum:arena-alloc-slice, r=eddyb

alloc_slice in TypedArena

Added `TypedArena::alloc_slice`, and moved from using `TypedArena<Vec<T>>` to `TypedArena<T>`.

`TypedArena::alloc_slice` is implemented by copying the slices elements into the typed arena, requiring that `T: Copy` when using it. We allocate a new chunk when there's insufficient space remaining in the previous chunk, and we cannot resize the old chunk in place. This is non-optimal, since we may waste allocated space when allocating (especially longer) slices, but is considered good enough for the time being.

This change also reduces heap fragmentation, since the arena now directly stores objects instead of storing the Vec's length and pointer to its contents.

Performance:
```
futures-rs-test  5.048s vs  5.061s --> 0.997x faster (variance: 1.028x, 1.020x)
helloworld       0.284s vs  0.295s --> 0.963x faster (variance: 1.207x, 1.189x)
html5ever-2016-  8.396s vs  8.208s --> 1.023x faster (variance: 1.019x, 1.036x)
hyper.0.5.0      5.768s vs  5.797s --> 0.995x faster (variance: 1.027x, 1.028x)
inflate-0.1.0    5.213s vs  5.069s --> 1.028x faster (variance: 1.008x, 1.022x)
issue-32062-equ  0.428s vs  0.467s --> 0.916x faster (variance: 1.188x, 1.015x)
issue-32278-big  1.949s vs  2.010s --> 0.970x faster (variance: 1.112x, 1.049x)
jld-day15-parse  1.795s vs  1.877s --> 0.956x faster (variance: 1.037x, 1.015x)
piston-image-0. 13.554s vs 13.522s --> 1.002x faster (variance: 1.019x, 1.020x)
rust-encoding-0  2.489s vs  2.465s --> 1.010x faster (variance: 1.047x, 1.086x)
syntex-0.42.2   34.646s vs 34.593s --> 1.002x faster (variance: 1.007x, 1.005x)
syntex-0.42.2-i 17.181s vs 17.163s --> 1.001x faster (variance: 1.004x, 1.004x)
```

r? @eddyb

7 years agoDetect local-rebuild by just the MAJOR.MINOR version
Josh Stone [Wed, 19 Oct 2016 15:21:00 +0000 (08:21 -0700)]
Detect local-rebuild by just the MAJOR.MINOR version

A new point-release shouldn't change any language semantics, so a local
stage0 that matches MAJOR.MINOR version should still be considered a
local-rebuild as far as `--cfg stageN` features go.

e.g. `1.14.0` should be considered a local-rebuild for any `1.14.X`.

(Bootstrap keys used to be an issue too, until #37265.)

7 years agoUse TypedArena::alloc_slice in rustc.
Mark-Simulacrum [Mon, 17 Oct 2016 03:21:25 +0000 (21:21 -0600)]
Use TypedArena::alloc_slice in rustc.

7 years agoAuto merge of #37213 - jseyfried:refactor_crate_var, r=nrc
bors [Wed, 19 Oct 2016 13:33:10 +0000 (06:33 -0700)]
Auto merge of #37213 - jseyfried:refactor_crate_var, r=nrc

macros: improve `$crate`

This PR refactors the implementation of `$crate` so that
 - `$crate` is only allowed at the start of a path (like `super`),
 - we can make `$crate` work with inter-crate re-exports (groundwork for macro modularization), and
 - we can support importing macros from an extern crate that is not declared at the crate root (also groundwork for macro modularization).

This is a [breaking-change]. For example, the following would break:
```rust
fn foo() {}
macro_rules! m { () => {
    $crate foo $crate () $crate $crate;
    //^ Today, `$crate` is allowed just about anywhere in unexported macros.
} }
fn main() {
    m!();
}
```
r? @nrc

7 years agoAdd TypedArena::alloc_slice.
Mark-Simulacrum [Mon, 17 Oct 2016 21:03:40 +0000 (15:03 -0600)]
Add TypedArena::alloc_slice.

7 years agoFuture proof `#[no_link]`.
Jeffrey Seyfried [Tue, 18 Oct 2016 05:33:50 +0000 (05:33 +0000)]
Future proof `#[no_link]`.

7 years agoImprove `$crate`.
Jeffrey Seyfried [Sun, 16 Oct 2016 03:39:52 +0000 (03:39 +0000)]
Improve `$crate`.

7 years agoUse `Ident`s instead of `Name`s in `ImportDirective`'s paths.
Jeffrey Seyfried [Sun, 16 Oct 2016 03:06:09 +0000 (03:06 +0000)]
Use `Ident`s instead of `Name`s in `ImportDirective`'s paths.

7 years agonit: Import `Ident` in `resolve`.
Jeffrey Seyfried [Sun, 16 Oct 2016 02:38:08 +0000 (02:38 +0000)]
nit: Import `Ident` in `resolve`.

7 years agoAuto merge of #37259 - GuillaumeGomez:fix_io_urls, r=frewsxcv
bors [Wed, 19 Oct 2016 09:53:42 +0000 (02:53 -0700)]
Auto merge of #37259 - GuillaumeGomez:fix_io_urls, r=frewsxcv

Add more io urls

r? @steveklabnik

7 years agoAdd libproc_macro from local rust to stage0
Josh Stone [Wed, 19 Oct 2016 07:12:42 +0000 (00:12 -0700)]
Add libproc_macro from local rust to stage0

This library is now required to run rustc 1.14.0.

7 years agoAuto merge of #37269 - eddyb:rollup, r=eddyb
bors [Wed, 19 Oct 2016 05:13:09 +0000 (22:13 -0700)]
Auto merge of #37269 - eddyb:rollup, r=eddyb

Rollup of 23 pull requests

- Successful merges: #36964, #37108, #37117, #37124, #37161, #37176, #37182, #37193, #37198, #37202, #37208, #37218, #37221, #37224, #37230, #37231, #37233, #37236, #37240, #37254, #37257, #37265, #37267
- Failed merges: #37213, #37220, #37261

7 years agoRollup merge of #37267 - nnethercote:opt-write_metadata, r=eddyb
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 05:00:05 +0000 (08:00 +0300)]
Rollup merge of #37267 - nnethercote:opt-write_metadata, r=eddyb

Optimize `write_metadata`.

`write_metadata` currently generates metadata unnecessarily in some
cases, and also compresses it unnecessarily in some cases. This commit
fixes that. It speeds up three of the rustc-benchmarks by 1--4%.

r? @eddyb, who deserves much of the credit because he (a) identified the problem from the profile data I provided in #37086, and (b) explained to me how to fix it. Thank you, @eddyb!

7 years agoRollup merge of #37265 - brson:bootstrap, r=alexcrichton
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 05:00:04 +0000 (08:00 +0300)]
Rollup merge of #37265 - brson:bootstrap, r=alexcrichton

Allow bootstrapping without a key. Fixes #36548

This will make it easier for packagers to bootstrap rustc when they happen
to have a bootstrap compiler with a slightly different version number.

It's not ok for anything other than the build system to set this environment variable.

r? @alexcrichton

7 years agoRollup merge of #37257 - srinivasreddy:librustc_errors, r=eddyb
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 05:00:04 +0000 (08:00 +0300)]
Rollup merge of #37257 - srinivasreddy:librustc_errors, r=eddyb

run rustfmt on librustc_errors folder

7 years agoRollup merge of #37254 - srinivasreddy:master, r=alexcrichton
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 05:00:04 +0000 (08:00 +0300)]
Rollup merge of #37254 - srinivasreddy:master, r=alexcrichton

run rustfmt on libpanic_unwind

7 years agoRollup merge of #37240 - jethrogb:typeid_doc, r=sfackler
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 05:00:03 +0000 (08:00 +0300)]
Rollup merge of #37240 - jethrogb:typeid_doc, r=sfackler

Add stable example to TypeId

The old example is still available at [Any::get_type_id](https://doc.rust-lang.org/std/any/trait.Any.html#examples)

7 years agoRollup merge of #37236 - bluss:range-argument, r=alexcrichton
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 05:00:03 +0000 (08:00 +0300)]
Rollup merge of #37236 - bluss:range-argument, r=alexcrichton

std::collections: Reexport libcollections's range module

This is overdue, even if range and RangeArgument is still unstable.
The stability attributes are the same ones as the other unstable item
(Bound) here, they don't seem to matter.

7 years agoRollup merge of #37233 - michaelwoerister:blake2-for-ich, r=nikomatsakis
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 05:00:03 +0000 (08:00 +0300)]
Rollup merge of #37233 - michaelwoerister:blake2-for-ich, r=nikomatsakis

ICH: Use 128-bit Blake2b hash instead of 64-bit SipHash for incr. comp. fingerprints

This PR makes incr. comp. hashes 128 bits wide in order to push collision probability below a threshold that we need to worry about. It also replaces SipHash, which has been mentioned multiple times as not being built for fingerprinting, with the [BLAKE2b hash function](https://blake2.net/), an improved version of the BLAKE sha-3 finalist.

I was worried that using a cryptographic hash function would make ICH computation noticeably slower, but after doing some performance tests, I'm not any more. Most of the time BLAKE2b is actually faster than using two SipHashes (in order to get 128 bits):

```
SipHash
libcore: 0.199 seconds
libstd:  0.090 seconds

BLAKE2b
libcore: 0.162 seconds
libstd:  0.078 seconds
```

If someone can prove that something like MetroHash128 provides a comparably low collision probability as BLAKE2, I'm happy to switch. But for now we are at least not taking a performance hit.

I also suggest that we throw out the sha-256 implementation in the compiler and replace it with BLAKE2, since our sha-256 implementation is two to three times slower than the BLAKE2 implementation in this PR (cc @alexcrichton @eddyb @brson)

r? @nikomatsakis (although there's not much incr. comp. specific in here, so feel free to re-assign)

7 years agoRollup merge of #37231 - jonas-schievink:obligation-forest-the-quest-for-performance...
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 05:00:03 +0000 (08:00 +0300)]
Rollup merge of #37231 - jonas-schievink:obligation-forest-the-quest-for-performance, r=arielb1

[Obligation Forest] Don't process cycles when stalled

This improves the `inflate-0.1.0` benchmark by about 10% for me.

/me hopes this is sound

7 years agoRollup merge of #37230 - bluss:zip-specialization-for-map, r=alexcrichton
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 05:00:02 +0000 (08:00 +0300)]
Rollup merge of #37230 - bluss:zip-specialization-for-map, r=alexcrichton

Expand .zip() specialization to .map() and .cloned()

Implement .zip() specialization for Map and Cloned.

The crucial thing for transparent specialization is that we want to
preserve the potential side effects.

The simplest example is that in this code snippet:

`(0..6).map(f).zip((0..4).map(g)).count()`

`f` will be called five times, and `g` four times. The last time for `f`
is when the other iterator is at its end, so this element is unused.
This side effect can be preserved without disturbing code generation for
simple uses of `.map()`.

The `Zip::next_back()` case is even more complicated, unfortunately.

7 years agoRollup merge of #37224 - petrochenkov:nz, r=eddyb
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 05:00:02 +0000 (08:00 +0300)]
Rollup merge of #37224 - petrochenkov:nz, r=eddyb

Mark enums with non-zero discriminant as non-zero

cc https://github.com/rust-lang/rfcs/issues/1230
r? @eddyb

7 years agoRollup merge of #37221 - diwic:6a-readdir-debug, r=alexcrichton
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 05:00:02 +0000 (08:00 +0300)]
Rollup merge of #37221 - diwic:6a-readdir-debug, r=alexcrichton

impl Debug for ReadDir

It is good practice to implement Debug for public types, and
indicating what directory you're reading seems useful.

Signed-off-by: David Henningsson <diwic@ubuntu.com>
7 years agoRollup merge of #37218 - srinivasreddy:sync, r=nrc
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 05:00:02 +0000 (08:00 +0300)]
Rollup merge of #37218 - srinivasreddy:sync, r=nrc

Run rustfmt on libcore/sync folder

7 years agoRollup merge of #37208 - jseyfried:fix_partially_consumed_tokens_in_macros, r=nrc
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 05:00:01 +0000 (08:00 +0300)]
Rollup merge of #37208 - jseyfried:fix_partially_consumed_tokens_in_macros, r=nrc

macros: fix partially consumed tokens in macro matchers

Fixes #37175.

This PR also avoids re-transcribing the tokens consumed by a matcher (and cloning the `TtReader` once per matcher), which improves expansion performance of the test case from #34630 by ~8%.

r? @nrc

7 years agoRollup merge of #37202 - petrochenkov:pretty, r=nrc
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 05:00:01 +0000 (08:00 +0300)]
Rollup merge of #37202 - petrochenkov:pretty, r=nrc

Fix some pretty printing tests

Many pretty-printing tests are un-ignored.
Some issues in classification of comments (trailing/isolated) and blank line counting are fixed.
Some comments are printed more carefully.
Some minor refactoring in pprust.rs
`no-pretty-expanded` annotations are removed because this is the default now.
`pretty-expanded` annotations are removed from compile-fail tests, they are not tested with pretty-printer.

Closes https://github.com/rust-lang/rust/issues/23623 in favor of more specific https://github.com/rust-lang/rust/issues/37201 and https://github.com/rust-lang/rust/issues/37199
r? @nrc

7 years agoRollup merge of #37198 - jseyfried:future_proof_macros_11, r=nrc
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 05:00:00 +0000 (08:00 +0300)]
Rollup merge of #37198 - jseyfried:future_proof_macros_11, r=nrc

macros 1.1: future proofing and cleanup

This PR
 - uses the macro namespace for custom derives (instead of a dedicated custom derive namespace),
 - relaxes the shadowing rules for `#[macro_use]`-imported custom derives to match the shadowing rules for ordinary `#[macro_use]`-imported macros, and
 - treats custom derive `extern crate`s like empty modules so that we can eventually allow, for example, `extern crate serde_derive; use serde_derive::Serialize;` backwards compatibly.

r? @alexcrichton

7 years agoRollup merge of #37193 - zackmdavis:pluralization_of_expected_type_arguments, r=nrc
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 05:00:00 +0000 (08:00 +0300)]
Rollup merge of #37193 - zackmdavis:pluralization_of_expected_type_arguments, r=nrc

correct erroneous pluralization of '1 type argument' error messages

This is in the matter of #37042.

7 years agoRollup merge of #37182 - alexcrichton:appveyor, r=brson
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 05:00:00 +0000 (08:00 +0300)]
Rollup merge of #37182 - alexcrichton:appveyor, r=brson

Add AppVeyor configuration to the repo

We hope to move to AppVeyor in the near future off of Buildbot + EC2. This adds
an `appveyor.yml` configuration file which is ready to run builds on the auto
branch. This is also accompanied with a few minor fixes to the build system and
such to accomodate AppVeyor.

The intention is that we're not switching over to AppVeyor entirely just yet,
but rather we'll watch the builds for a week or so. If everything checks out
then we'll start gating on AppVeyor instead of Buildbot!

7 years agoRollup merge of #37176 - alexcrichton:no-write-to-root, r=brson
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 05:00:00 +0000 (08:00 +0300)]
Rollup merge of #37176 - alexcrichton:no-write-to-root, r=brson

test: Don't write files into the source tree

Tweak a few run-make tests to emit files in the output directories, not directly
in the source tree.

7 years agoRollup merge of #37161 - nnethercote:no-cfg-cloning, r=nrc
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 04:59:59 +0000 (07:59 +0300)]
Rollup merge of #37161 - nnethercote:no-cfg-cloning, r=nrc

Avoid many CrateConfig clones.

This commit changes `ExtCtx::cfg()` so it returns a `CrateConfig`
reference instead of a clone. As a result, it also changes all of the
`cfg()` callsites to explicitly clone... except one, because the commit
also changes `macro_parser::parse()` to take `&CrateConfig`. This is
good, because that function can be hot, and `CrateConfig` is expensive
to clone.

This change almost halves the number of heap allocations done by rustc
for `html5ever` in rustc-benchmarks suite, which makes compilation 1.20x
faster.

r? @nrc

7 years agoRollup merge of #37124 - nikomatsakis:incr-comp-benchmark, r=michaelwoerister
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 04:59:59 +0000 (07:59 +0300)]
Rollup merge of #37124 - nikomatsakis:incr-comp-benchmark, r=michaelwoerister

add test case for changing private methods

The goal of this test case is to ensure we are getting the reuse we expect. This targets a particular change where we modify the body of a private inherent method defined on a struct, and looks at different ways we can use that struct.

It checks for when type-checking would be needed as well as the actual reuse achieved.

cc https://github.com/rust-lang/rust/issues/37121
r? @michaelwoerister

7 years agoRollup merge of #37117 - pnkfelix:may-dangle-attr, r=nikomatsakis
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 04:59:59 +0000 (07:59 +0300)]
Rollup merge of #37117 - pnkfelix:may-dangle-attr, r=nikomatsakis

`#[may_dangle]` attribute

`#[may_dangle]` attribute

Second step of #34761. Last big hurdle before we can work in earnest towards Allocator integration (#32838)

Note: I am not clear if this is *also* a syntax-breaking change that needs to be part of a breaking-batch.

7 years agoRollup merge of #37108 - nnethercote:substs-experimentation, r=eddyb
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 04:59:59 +0000 (07:59 +0300)]
Rollup merge of #37108 - nnethercote:substs-experimentation, r=eddyb

Optimize `Substs::super_fold_with`.

This speeds up some of the rustc-benchmarks by up to ~4%.
```
futures-rs-test  4.467s vs  4.387s --> 1.018x faster (variance: 1.001x, 1.006x)
helloworld       0.242s vs  0.246s --> 0.980x faster (variance: 1.007x, 1.013x)
html5ever-2016-  7.664s vs  7.630s --> 1.004x faster (variance: 1.008x, 1.006x)
hyper.0.5.0      5.218s vs  5.133s --> 1.016x faster (variance: 1.013x, 1.008x)
inflate-0.1.0    5.040s vs  5.103s --> 0.988x faster (variance: 1.005x, 1.008x)
issue-32062-equ  0.361s vs  0.345s --> 1.047x faster (variance: 1.008x, 1.019x)
issue-32278-big  1.874s vs  1.850s --> 1.013x faster (variance: 1.020x, 1.018x)
jld-day15-parse  1.569s vs  1.508s --> 1.040x faster (variance: 1.009x, 1.003x)
piston-image-0. 12.210s vs 11.903s --> 1.026x faster (variance: 1.045x, 1.010x)
regex.0.1.30     2.568s vs  2.555s --> 1.005x faster (variance: 1.018x, 1.044x)
rust-encoding-0  2.139s vs  2.135s --> 1.001x faster (variance: 1.012x, 1.005x)
syntex-0.42.2   33.099s vs 32.353s --> 1.023x faster (variance: 1.003x, 1.028x)
syntex-0.42.2-i 17.989s vs 17.431s --> 1.032x faster (variance: 1.009x, 1.018x)
```
r? @eddyb. I don't know how this interacts with the changes that dikaiosune has been working on.

7 years agoRollup merge of #36964 - GuillaumeGomez:comment_error, r=jonathandturner
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 04:59:59 +0000 (07:59 +0300)]
Rollup merge of #36964 - GuillaumeGomez:comment_error, r=jonathandturner

Add invalid doc comment help message

Fixes #36946.

Any opinion on the message?

7 years agoFormat comment in a nicer way.
Eduard-Mihai Burtescu [Wed, 19 Oct 2016 04:37:20 +0000 (07:37 +0300)]
Format comment in a nicer way.

Just kidding I'm doing this only to unstuck @bors/homu/buildbot.

7 years agoOptimize `write_metadata`.
Nicholas Nethercote [Wed, 19 Oct 2016 01:06:46 +0000 (12:06 +1100)]
Optimize `write_metadata`.

`write_metadata` currently generates metadata unnecessarily in some
cases, and also compresses it unnecessarily in some cases. This commit
fixes that. It speeds up three of the rustc-benchmarks by 1--4%.

7 years agoAllow bootstrapping without a key. Fixes #36548
Brian Anderson [Tue, 18 Oct 2016 22:42:01 +0000 (22:42 +0000)]
Allow bootstrapping without a key. Fixes #36548

This will make it easier for packagers to bootstrap rustc when they happen
to have a bootstrap compiler with a slightly different version number.

It's not ok for anything other than the build system to set this environment variable.

7 years agoAdd invalid doc comment help message
Guillaume Gomez [Tue, 4 Oct 2016 17:10:33 +0000 (19:10 +0200)]
Add invalid doc comment help message

7 years agoFix some pretty printing tests
Vadim Petrochenkov [Wed, 12 Oct 2016 17:54:41 +0000 (20:54 +0300)]
Fix some pretty printing tests

7 years agoTypos in some linkage
Guillaume Gomez [Tue, 18 Oct 2016 18:36:44 +0000 (20:36 +0200)]
Typos in some linkage

7 years agorun rustfmt on librustc_errors folder
Srinivas Reddy Thatiparthy [Tue, 18 Oct 2016 17:43:02 +0000 (23:13 +0530)]
run rustfmt on librustc_errors folder

7 years agorun rustfmt on libpanic_unwind
Srinivas Reddy Thatiparthy [Tue, 18 Oct 2016 17:39:47 +0000 (23:09 +0530)]
run rustfmt on libpanic_unwind

7 years agoIncorporate review feedback: code formatting fixes, expand a comment.
Felix S. Klock II [Tue, 18 Oct 2016 12:46:55 +0000 (14:46 +0200)]
Incorporate review feedback: code formatting fixes, expand a comment.

7 years agoAuto merge of #37120 - srinivasreddy:librand, r=nrc
bors [Tue, 18 Oct 2016 12:09:12 +0000 (05:09 -0700)]
Auto merge of #37120 - srinivasreddy:librand, r=nrc

run rustfmt on librand

7 years agoOptimize `Substs::super_fold_with`.
Nicholas Nethercote [Wed, 12 Oct 2016 05:59:53 +0000 (16:59 +1100)]
Optimize `Substs::super_fold_with`.

This speeds up several rustc-benchmarks by 1--4%.

7 years agoAuto merge of #37083 - nnethercote:uleb128, r=eddyb
bors [Tue, 18 Oct 2016 08:49:13 +0000 (01:49 -0700)]
Auto merge of #37083 - nnethercote:uleb128, r=eddyb

Inline read_{un,}signed_leb128 and opaque::Decoder functions.

`read_unsigned_leb128` is hot within rustc because it's heavily used
during the reading of crate metadata. This commit tweaks its signature
(and that of `read_signed_leb128`, for consistency) so it can increment
the buffer index directly instead of maintaining its own copy, the
change in which is then used by the caller to advance the index.

This reduces the instruction count (as measured by Cachegrind) for some
benchmarks a bit, e.g. hyper-0.5.0 by 0.7%.

7 years agoAuto merge of #36969 - nnethercote:rename-Parser-fields, r=eddyb
bors [Tue, 18 Oct 2016 05:27:57 +0000 (22:27 -0700)]
Auto merge of #36969 - nnethercote:rename-Parser-fields, r=eddyb

Clarify the positions of the lexer and parser

The lexer and parser use unclear names to indicate their positions in the
source code. I propose the following renamings.

Lexer:
```
pos      -> next_pos      # it's actually the next pos!
last_pos -> pos           # it's actually the current pos!
curr     -> ch            # the current char
curr_is  -> ch_is         # tests the current char
col (unchanged)           # the current column
```
parser
```
- last_span       -> prev_span          # the previous token's span
- last_token_kind -> prev_token_kind    # the previous token's kind
- LastTokenKind   -> PrevTokenKind      # ditto (but the type)
- token (unchanged)                     # the current token
- span (unchanged)                      # the current span
```

Things to note:
- This proposal removes all uses of "last", which is an unclear word because it
  could mean (a) previous, (b) final, or (c) most recent, i.e. current.
- The "current" things (ch, col, token, span) consistently lack a prefix. The
  "previous" and "next" things consistently have a prefix.

7 years agoDon't enqueue onto a disabled dep_graph.
Nicholas Nethercote [Tue, 18 Oct 2016 03:46:41 +0000 (14:46 +1100)]
Don't enqueue onto a disabled dep_graph.

This commit guards all calls to `DepGraphThreadData::enqueue` with a
check to make sure it is enabled. This requires distinguishing between a
"fully enabled" and an "enqueue-enabled" graph.

This change avoids some useless allocation and vector manipulations when
the graph is disabled (i.e. when incremental compilation is off) which
improves speed by ~1% on some of the rustc-benchmarks.

7 years agoprefer `if let` to match with `None => { }` arm in some places
Zack M. Davis [Tue, 18 Oct 2016 02:00:20 +0000 (19:00 -0700)]
prefer `if let` to match with `None => { }` arm in some places

In #34268 (8531d581), we replaced matches of None to the unit value `()`
with `if let`s in places where it was deemed that this made the code
unambiguously clearer and more idiomatic. In #34638 (d37edef9), we did
the same for matches of None to the empty block `{}`.

A casual observer, upon seeing these commits fly by, might suppose that
the matter was then settled, that no further pull requests on this
utterly trivial point of style could or would be made. Unless ...

It turns out that sometimes people write the empty block with a space in
between the braces. Who knew?

7 years agoInline read_{un,}signed_leb128 and opaque::Decoder functions.
Nicholas Nethercote [Tue, 11 Oct 2016 01:18:28 +0000 (12:18 +1100)]
Inline read_{un,}signed_leb128 and opaque::Decoder functions.

These functions are all hot in rustc and inlining them speeds up most of
the rustc-benchmarks by 1--2%.

7 years agoAdd stable example to TypeId
Jethro Beekman [Tue, 18 Oct 2016 00:49:07 +0000 (17:49 -0700)]
Add stable example to TypeId

7 years agoAuto merge of #37237 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Tue, 18 Oct 2016 00:35:16 +0000 (17:35 -0700)]
Auto merge of #37237 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 6 pull requests

- Successful merges: #37172, #37177, #37189, #37194, #37200, #37215
- Failed merges:

7 years agoAdd regression test.
Jeffrey Seyfried [Sun, 16 Oct 2016 09:13:15 +0000 (09:13 +0000)]
Add regression test.

7 years agoFix partially consumed tokens in macro matchers.
Jeffrey Seyfried [Sun, 16 Oct 2016 05:19:02 +0000 (05:19 +0000)]
Fix partially consumed tokens in macro matchers.

7 years agoFix typo
Michael Woerister [Mon, 17 Oct 2016 21:47:48 +0000 (17:47 -0400)]
Fix typo

7 years agoRollup merge of #37215 - flodiebold:comment-fix, r=sfackler
Guillaume Gomez [Mon, 17 Oct 2016 21:07:53 +0000 (23:07 +0200)]
Rollup merge of #37215 - flodiebold:comment-fix, r=sfackler

Update comment in Vec::dedup_by

It's a tiny thing, but I came across this comment which previously was in `dedup` and wasn't updated when `dedup_by` was introduced.

7 years agoRollup merge of #37200 - zackmdavis:llvm_version_in_verbose_version, r=sanxiyn
Guillaume Gomez [Mon, 17 Oct 2016 21:07:53 +0000 (23:07 +0200)]
Rollup merge of #37200 - zackmdavis:llvm_version_in_verbose_version, r=sanxiyn

include LLVM version in `--version --verbose`

This is in the matter of #28405.

```
$ ./x86_64-unknown-linux-gnu/stage1/bin/rustc --version --verbose
rustc 1.14.0-dev (8e05e7ee3 2016-10-15)
binary: rustc
commit-hash: 8e05e7ee3c19a5594b79d67c8390cef78970be7c
commit-date: 2016-10-15
host: x86_64-unknown-linux-gnu
release: 1.14.0-dev
LLVM version: 3.9
```

7 years agoRollup merge of #37194 - johnthagen:fix-const-static-header, r=bluss
Guillaume Gomez [Mon, 17 Oct 2016 21:07:53 +0000 (23:07 +0200)]
Rollup merge of #37194 - johnthagen:fix-const-static-header, r=bluss

Remove un-rendered ticks from "const and static" doc title

Related to #37116 and #37119.

Ticks in the titles are not correctly rendered

![const-static-render](https://cloud.githubusercontent.com/assets/10340167/19412643/63e385a2-92e8-11e6-81f1-16802f803aad.png)

7 years agoRollup merge of #37189 - nabeelomer:master, r=bluss
Guillaume Gomez [Mon, 17 Oct 2016 21:07:52 +0000 (23:07 +0200)]
Rollup merge of #37189 - nabeelomer:master, r=bluss

Updated the docs for Error::description

Fixes https://github.com/rust-lang/rust/issues/37163

7 years agoRollup merge of #37177 - michaelwoerister:fix-check-stage1, r=petrochenkov
Guillaume Gomez [Mon, 17 Oct 2016 21:07:52 +0000 (23:07 +0200)]
Rollup merge of #37177 - michaelwoerister:fix-check-stage1, r=petrochenkov

Fix make check-stage1 by conditionally activating question_mark feature for compiletest tool.

r? @alexcrichton

7 years agoRollup merge of #37172 - michaelwoerister:cleanup-dibuilder, r=eddyb
Guillaume Gomez [Mon, 17 Oct 2016 21:07:52 +0000 (23:07 +0200)]
Rollup merge of #37172 - michaelwoerister:cleanup-dibuilder, r=eddyb

debuginfo: Remove some outdated stuff from LLVM DIBuilder binding.

These seem to be leftovers from various adaptations to changes in LLVM over time.
Perfect for a rollup.

r? @eddyb

7 years agoAuto merge of #36915 - jfirebaugh:E0308-split, r=nikomatsakis
bors [Mon, 17 Oct 2016 21:06:46 +0000 (14:06 -0700)]
Auto merge of #36915 - jfirebaugh:E0308-split, r=nikomatsakis

Use a distinct error code for "if may be missing an else clause"

Introduce the possibility of assigning distinct error codes to the various origin types of E0308. Start by assigning E0317 for the "IfExpressionWithNoElse" case, and write a long diagnostic specific to this case.

Fixes #36596

7 years agoSet stalled=false when encountering an error
Jonas Schievink [Mon, 17 Oct 2016 19:53:27 +0000 (21:53 +0200)]
Set stalled=false when encountering an error

7 years agostd::collections: Reexport libcollections's range module
Ulrik Sverdrup [Mon, 17 Oct 2016 19:26:29 +0000 (21:26 +0200)]
std::collections: Reexport libcollections's range module

This is overdue, even if range and RangeArgument is still unstable.
The stability attributes are the same ones as the other unstable item
(Bound) here, they don't seem to matter.

7 years agoAuto merge of #37112 - pnkfelix:fix-issue-36744, r=arielb1
bors [Mon, 17 Oct 2016 16:47:46 +0000 (09:47 -0700)]
Auto merge of #37112 - pnkfelix:fix-issue-36744, r=arielb1

Fix ICE: inject bitcast if types mismatch for invokes/calls/stores

Fix ICE: inject bitcast if types mismatch for invokes/calls

Fix #36744

7 years agoICH: Use 128-bit Blake2b hash instead of 64-bit SipHash for incr. comp. fingerprints.
Michael Woerister [Fri, 7 Oct 2016 13:13:11 +0000 (09:13 -0400)]
ICH: Use 128-bit Blake2b hash instead of 64-bit SipHash for incr. comp. fingerprints.

7 years agoMoved new dropck-eyepatch compile-fail tests to the `ui/` subtree.
Felix S. Klock II [Mon, 17 Oct 2016 16:02:23 +0000 (18:02 +0200)]
Moved new dropck-eyepatch compile-fail tests to the `ui/` subtree.

7 years agoReview feedback: expand comment and simplify some code.
Felix S. Klock II [Mon, 17 Oct 2016 14:22:42 +0000 (16:22 +0200)]
Review feedback: expand comment and simplify some code.

7 years agoReview feedback: add linebreak and reindent to make braces match better.
Felix S. Klock II [Mon, 17 Oct 2016 14:22:24 +0000 (16:22 +0200)]
Review feedback: add linebreak and reindent to make braces match better.

7 years agoremove fixme that i no longer think appropriate.
Felix S. Klock II [Mon, 17 Oct 2016 14:17:54 +0000 (16:17 +0200)]
remove fixme that i no longer think appropriate.

7 years agoFix Subst construction: use subst from adt_def rather than Drop impl's subst.
Felix S. Klock II [Mon, 17 Oct 2016 14:14:25 +0000 (16:14 +0200)]
Fix Subst construction: use subst from adt_def rather than Drop impl's subst.

This addresses issue pointed out by niko that prior code would break
if the declaration order for generics does not match how they are fed
into the instantiation of the type itself. (Added some tests
exercising this scenario.)

7 years agoAuto merge of #37162 - matklad:static-mut-lint, r=jseyfried
bors [Mon, 17 Oct 2016 11:32:15 +0000 (04:32 -0700)]
Auto merge of #37162 - matklad:static-mut-lint, r=jseyfried

Lint against lowercase static mut

Closes #37145.

Lint for non mut statics was added in https://github.com/rust-lang/rust/pull/7523, and it explicitly did not cover mut statics. I am not sure why.

7 years agoExpand .zip() specialization to .map() and .cloned()
Ulrik Sverdrup [Mon, 17 Oct 2016 08:58:21 +0000 (10:58 +0200)]
Expand .zip() specialization to .map() and .cloned()

Implement .zip() specialization for Map and Cloned.

The crucial thing for transparent specialization is that we want to
preserve the potential side effects.

The simplest example is that in this code snippet:

`(0..6).map(f).zip((0..4).map(g)).count()`

`f` will be called five times, and `g` four times. The last time for `f`
is when the other iterator is at its end, so this element is unused.
This side effect can be preserved without disturbing code generation for
simple uses of `.map()`.

The `Zip::next_back()` case is even more complicated, unfortunately.

7 years agoUse one message for uppercase global lint
Aleksey Kladov [Mon, 17 Oct 2016 08:10:34 +0000 (11:10 +0300)]
Use one message for uppercase global lint