Commit Graph

57890 Commits

Author SHA1 Message Date
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
Guillaume Gomez
93417fa71e Add invalid doc comment help message 2016-10-18 22:39:01 +02:00
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
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
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
bors
ce31626801 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
2016-10-17 09:47:46 -07:00
Felix S. Klock II
4124d8e48b Moved new dropck-eyepatch compile-fail tests to the ui/ subtree. 2016-10-17 18:02:23 +02:00
Felix S. Klock II
0d8f7164bb Review feedback: expand comment and simplify some code. 2016-10-17 16:22:42 +02:00
Felix S. Klock II
85d2e4d1d6 Review feedback: add linebreak and reindent to make braces match better. 2016-10-17 16:22:24 +02:00
Felix S. Klock II
818ac082d2 remove fixme that i no longer think appropriate. 2016-10-17 16:17:54 +02:00
Felix S. Klock II
0271a9a60a 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.)
2016-10-17 16:14:25 +02:00
bors
07b86d0d4d 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.
2016-10-17 04:32:15 -07:00
Aleksey Kladov
066d62d4b4 Use one message for uppercase global lint 2016-10-17 11:10:34 +03:00
bors
da7f8c540b Auto merge of #37153 - michaelwoerister:spread-arg-debuginfo, r=eddyb
debuginfo: Handle spread_arg case in MIR-trans in a more stable way.

Use `VariableAccess::DirectVariable` instead of `VariableAccess::IndirectVariable` in order not to make LLVM's SROA angry. This is a step towards fixing #36774 and #35547. At least, I can build Cargo with optimizations + debuginfo again.

r? @eddyb
2016-10-17 00:31:25 -07:00
bors
54c133d3ba Auto merge of #37082 - frewsxcv:session, r=jseyfried
'src/librustc/session/filesearch.rs' refactoring and cleanup.
2016-10-16 20:00:14 -07:00
Florian Diebold
187ddf30b0 Update comment in Vec::dedup_by 2016-10-16 14:41:01 +02:00
bors
6572a46311 Auto merge of #37129 - arielb1:erased-normal, r=eddyb
normalize types every time HR regions are erased

Associated type normalization is inhibited by higher-ranked regions.
Therefore, every time we erase them, we must re-normalize.

I was meaning to introduce this change some time ago, but we used
to erase regions in generic context, which broke this terribly (because
you can't always normalize in a generic context). That seems to be gone
now.

Ensure this by having a `erase_late_bound_regions_and_normalize`
function.

Fixes #37109 (the missing call was in mir::block).

r? @eddyb
2016-10-16 04:22:21 -07:00
bors
6dc035ed91 Auto merge of #37098 - ollie27:rustdoc_playground, r=GuillaumeGomez
rustdoc: Improve playground run buttons

The main change is to stop using javascript to generate the URLs and use
rustdoc instead.

This also adds run buttons to the error index examples.

You can test the changes at https://ollie27.github.io/rust_doc_test/.

Fixes #36621
Fixes #36910
2016-10-15 19:49:12 -07:00
Zack M. Davis
06123d3afe include LLVM version in --version --verbose
This is in the matter of #28405.
2016-10-15 15:57:28 -07:00
bors
98a3502da1 Auto merge of #37152 - arielb1:drop-cache, r=pnkfelix
add a per-param-env cache to `impls_bound`

There used to be only a global cache, which led to uncached calls to
trait selection when there were type parameters.

This causes a 20% decrease in borrow-checking time and an overall 0.5% performance increase during bootstrapping (as borrow-checking tends to be a tiny part of compilation time).

Fixes #37106 (drop elaboration times are now ~half of borrow checking,
so might still be worthy of optimization, but not critical).

r? @pnkfelix
2016-10-15 15:38:52 -07:00
johnthagen
d001e8ad17 Remove un-rendered ticks from title. 2016-10-15 15:00:37 -04:00
Oliver Middleton
0b2746c8db rustdoc: Improve playground run buttons
The main change is to stop using javascript to generate the URLs and use
rustdoc instead.

This also adds run buttons to the error index examples.
2016-10-15 18:32:03 +01:00
Nabeel Omer
16b8957df4 Fixed typo 2016-10-15 22:56:07 +05:30
bors
5bfe107401 Auto merge of #37132 - petrochenkov:intern, r=alexcrichton
Get rid of double indirection in string interner
2016-10-15 09:32:06 -07:00
Nabeel Omer
57583722f6 Corrected broken markdown link 2016-10-15 21:30:09 +05:30
John Firebaugh
d07602b573 Remove FIXME 2016-10-15 08:49:16 -07:00
Nabeel Omer
a1b50ad673 Updated the docs for Error::description 2016-10-15 19:13:49 +05:30
bors
8e05e7ee3c Auto merge of #37100 - dikaiosune:master, r=eddyb
Change Substs to type alias for Slice<Kind> for interning

This changes the definition of `librustc::ty::subst::Substs` to be a type alias to `Slice<Kind>`. `Substs` was already interned, but can now make use of the efficient `PartialEq` and `Hash` impls on `librustc::ty::Slice`.

I'm working on collecting some timing data for this, will update when it's done.

I chose to leave the impls on `Substs<'tcx>` even though it's now just a type alias to `Slice<Kind<'tcx>>` because it has the smallest footprint on other portions of the compiler which depend on its API. It turns out to be a pretty huge diff if you change where Substs's methods live 😄. That said, I'm not necessarily sure it's the *best* implementation but it's probably the easiest/smallest to review.

Many thanks to @eddyb for both suggesting this as a project for learning more about the compiler, and the tireless ~~handholding~~ mentorship he provided.
2016-10-15 06:08:55 -07:00
bors
030bc49bb4 Auto merge of #37094 - fhartwig:spec-extend-from-slice, r=alexcrichton
Specialize Vec::extend to Vec::extend_from_slice

I tried using the existing `SpecExtend` as a helper trait for this, but the instances would always conflict with the instances higher up in the file, so I created a new helper trait.

Benchmarking `extend` vs `extend_from_slice` with an slice of 1000 `u64`s gives the following results:

```
before:

running 2 tests
test tests::bench_extend_from_slice ... bench:         166 ns/iter (+/- 78)
test tests::bench_extend_trait      ... bench:       1,187 ns/iter (+/- 697)

after:
running 2 tests
test tests::bench_extend_from_slice ... bench:         149 ns/iter (+/- 87)
test tests::bench_extend_trait      ... bench:         138 ns/iter (+/- 70)
```
2016-10-15 01:48:42 -07:00
bors
e1b67776db Auto merge of #35704 - tbu-:pr_pread_pwrite, r=alexcrichton
Implement `read_offset` and `write_offset`

These functions allow to read from and write to a file from multiple
threads without changing the per-file cursor, avoiding the race between
the seek and the read.
2016-10-14 19:33:04 -07:00
bors
a8d189af90 Auto merge of #37170 - jonathandturner:rollup, r=jonathandturner
Rollup of 10 pull requests

- Successful merges: #36307, #36755, #36961, #37102, #37115, #37119, #37122, #37123, #37141, #37159
- Failed merges:
2016-10-14 16:15:42 -07:00
Tobias Bucher
15549935f8 Android: Fix unused-imports warning 2016-10-14 23:02:47 +02:00
Michael Woerister
e4e444a26b Fix make check-stage1 by conditionally activating question_mark feature for compiletest tool. 2016-10-14 16:01:58 -04:00
Jonathan Turner
881f0f81f0 Rollup merge of #37159 - cthulhua:readme-mingw-tar, r=alexcrichton
add (missing) tar to list of packages to get under mingw

The distribution targets use tar, but the readme pacman invocation doesn't include the tar package.
2016-10-14 12:07:09 -07:00
Jonathan Turner
dd25442aaf Rollup merge of #37141 - nabeelomer:master, r=sfackler
Documented that RwLock might panic

Fixes https://github.com/rust-lang/rust/issues/37010
2016-10-14 12:07:08 -07:00
Jonathan Turner
886d47c3ff Rollup merge of #37123 - srinivasreddy:libcore_num, r=erickt
run rustfmt on libcore/num folder
2016-10-14 12:07:08 -07:00