Commit Graph

57937 Commits

Author SHA1 Message Date
Nicholas Nethercote
a935481ae9 Avoid an unnecessary clone in macro_parser::parse.
This avoids ~800,000 allocations in html5ever.
2016-10-21 12:58:06 +11:00
bors
0c429872a3 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
2016-10-18 22:13:09 -07:00
Eduard-Mihai Burtescu
f354d72536 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!
2016-10-19 08:00:05 +03:00
Eduard-Mihai Burtescu
988831319e 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
2016-10-19 08:00:04 +03:00
Eduard-Mihai Burtescu
903e1f9657 Rollup merge of #37257 - srinivasreddy:librustc_errors, r=eddyb
run rustfmt on librustc_errors folder
2016-10-19 08:00:04 +03:00
Eduard-Mihai Burtescu
a09b94b3d9 Rollup merge of #37254 - srinivasreddy:master, r=alexcrichton
run rustfmt on libpanic_unwind
2016-10-19 08:00:04 +03:00
Eduard-Mihai Burtescu
3d57d42f13 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)
2016-10-19 08:00:03 +03:00
Eduard-Mihai Burtescu
ad241dfa65 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.
2016-10-19 08:00:03 +03:00
Eduard-Mihai Burtescu
7343291ac3 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)
2016-10-19 08:00:03 +03:00
Eduard-Mihai Burtescu
6ae80c6ac4 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
2016-10-19 08:00:03 +03:00
Eduard-Mihai Burtescu
7b0eb102de 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.
2016-10-19 08:00:02 +03:00
Eduard-Mihai Burtescu
beaa4c5779 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
2016-10-19 08:00:02 +03:00
Eduard-Mihai Burtescu
184ee985f8 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>
2016-10-19 08:00:02 +03:00
Eduard-Mihai Burtescu
eae11c35c9 Rollup merge of #37218 - srinivasreddy:sync, r=nrc
Run rustfmt on libcore/sync folder
2016-10-19 08:00:02 +03:00
Eduard-Mihai Burtescu
094eaf0250 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
2016-10-19 08:00:01 +03:00
Eduard-Mihai Burtescu
45683187ea 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
2016-10-19 08:00:01 +03:00
Eduard-Mihai Burtescu
a6788d0ba8 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
2016-10-19 08:00:00 +03:00
Eduard-Mihai Burtescu
c38324dee2 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.
2016-10-19 08:00:00 +03:00
Eduard-Mihai Burtescu
fc8f9b950b 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!
2016-10-19 08:00:00 +03:00
Eduard-Mihai Burtescu
5c643435d1 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.
2016-10-19 08:00:00 +03:00
Eduard-Mihai Burtescu
aaed275a49 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
2016-10-19 07:59:59 +03:00
Eduard-Mihai Burtescu
a88ca4bf8e 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
2016-10-19 07:59:59 +03:00
Eduard-Mihai Burtescu
373fcd1bd3 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.
2016-10-19 07:59:59 +03:00
Eduard-Mihai Burtescu
6e3a72d256 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.
2016-10-19 07:59:59 +03:00
Eduard-Mihai Burtescu
fdcdcac66c Rollup merge of #36964 - GuillaumeGomez:comment_error, r=jonathandturner
Add invalid doc comment help message

Fixes #36946.

Any opinion on the message?
2016-10-19 07:59:59 +03:00
Eduard-Mihai Burtescu
ab5dcff131 Format comment in a nicer way.
Just kidding I'm doing this only to unstuck @bors/homu/buildbot.
2016-10-19 07:37:20 +03:00
Nicholas Nethercote
016f69f459 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%.
2016-10-19 14:00:48 +11:00
Brian Anderson
d3c5905772 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.
2016-10-19 01:23:01 +00:00
Guillaume Gomez
93417fa71e Add invalid doc comment help message 2016-10-18 22:39:01 +02:00
Vadim Petrochenkov
4a91a80b26 Fix some pretty printing tests 2016-10-18 23:23:40 +03:00
Srinivas Reddy Thatiparthy
b260617345
run rustfmt on librustc_errors folder 2016-10-18 23:13:02 +05:30
Srinivas Reddy Thatiparthy
1cc1dcce7d
run rustfmt on libpanic_unwind 2016-10-18 23:09:47 +05:30
Felix S. Klock II
10a58ac49b Incorporate review feedback: code formatting fixes, expand a comment. 2016-10-18 14:46:55 +02:00
bors
16eeeac783 Auto merge of #37120 - srinivasreddy:librand, r=nrc
run rustfmt on librand
2016-10-18 05:09:12 -07:00
Nicholas Nethercote
1e4241ab31 Optimize Substs::super_fold_with.
This speeds up several rustc-benchmarks by 1--4%.
2016-10-18 20:55:23 +11:00
bors
753ea76336 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%.
2016-10-18 01:49:13 -07:00
bors
3543a0f602 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.
2016-10-17 22:27:57 -07:00
Nicholas Nethercote
6a4bb35b70 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%.
2016-10-18 12:00:28 +11:00
Jethro Beekman
a29b503033 Add stable example to TypeId 2016-10-17 17:49:07 -07:00
bors
1d3dfa5301 Auto merge of #37237 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 6 pull requests

- Successful merges: #37172, #37177, #37189, #37194, #37200, #37215
- Failed merges:
2016-10-17 17:35:16 -07:00
Jeffrey Seyfried
95a9e2a724 Add regression test. 2016-10-17 23:00:53 +00:00
Jeffrey Seyfried
9578e1a251 Fix partially consumed tokens in macro matchers. 2016-10-17 23:00:52 +00:00
Michael Woerister
c560ca4513 Fix typo 2016-10-17 17:47:48 -04:00
Guillaume Gomez
b097790182 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.
2016-10-17 23:07:53 +02:00
Guillaume Gomez
3ff8ee18aa 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: 8e05e7ee3c
commit-date: 2016-10-15
host: x86_64-unknown-linux-gnu
release: 1.14.0-dev
LLVM version: 3.9
```
2016-10-17 23:07:53 +02:00
Guillaume Gomez
9569ea0d2f 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)
2016-10-17 23:07:53 +02:00
Guillaume Gomez
28416cbbff Rollup merge of #37189 - nabeelomer:master, r=bluss
Updated the docs for Error::description

Fixes https://github.com/rust-lang/rust/issues/37163
2016-10-17 23:07:52 +02:00
Guillaume Gomez
1aac569e8a 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
2016-10-17 23:07:52 +02:00
Guillaume Gomez
2b634949a3 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
2016-10-17 23:07:52 +02:00
bors
e0111758eb 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
2016-10-17 14:06:46 -07:00