Commit Graph

58037 Commits

Author SHA1 Message Date
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
Ulrik Sverdrup
ed5015939f 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-17 10:58:21 +02: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
Jonas Schievink
88fde7f728 Don't process cycles when stalled
This improves the `inflate-0.1.0` benchmark by about 10% for me.
2016-10-17 02:28:31 +02:00
Vadim Petrochenkov
49e6b466e9 Mark enums with non-zero discriminant as non-zero 2016-10-17 02:24:04 +03:00
David Henningsson
e4ed345b2c 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-16 20:42:55 +02:00
Srinivas Reddy Thatiparthy
7a491bb66d
Run rustfmt on libcore/prelude folder 2016-10-16 22:13:04 +05:30
Srinivas Reddy Thatiparthy
5afd6d8206
Run rustfmt on libcore/sync folder 2016-10-16 22:11:01 +05:30
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
Srinivas Reddy Thatiparthy
54e320d4bc
run rustfmt on various folders 2016-10-16 15:41:01 +05:30
Srinivas Reddy Thatiparthy
abc715e985
run rustfmt on bootstrap/bin folder 2016-10-16 14:57:25 +05:30
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
Jeffrey Seyfried
aac6dca21e Treat custom derive extern crates like empty modules. 2016-10-15 22:55:21 +00:00
Jeffrey Seyfried
33e3da831c Use the macro namespace for custom derives. 2016-10-15 22:55:19 +00: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
Jeffrey Seyfried
d902963b6d Refactor syntax::ext::base::Resolver::resolve_invoc. 2016-10-15 20:50:02 +00:00
johnthagen
d001e8ad17 Remove un-rendered ticks from title. 2016-10-15 15:00:37 -04:00
Zack M. Davis
ac42f3f206 correct erroneous pluralization of '1 type argument' error messages
This is in the matter of #37042.
2016-10-15 11:40:12 -07: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
Corey Farwell
a8dc2975fd Improve doc example for std::borrow::Cow. 2016-10-15 00:55:46 -04:00
Alex Crichton
06d173adb7 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-14 20:33:20 -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
Alex Crichton
094c3a2c78 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-14 12:48:53 -07: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
Jonathan Turner
72a9dcf402 Rollup merge of #37122 - srinivasreddy:liblog, r=alexcrichton
run rustfmt on liblog
2016-10-14 12:07:08 -07:00
Jonathan Turner
6822769263 Rollup merge of #37119 - durka:patch-31, r=steveklabnik
book: remove backticks in Type Aliases header

Fix #37116.
2016-10-14 12:07:08 -07:00
Jonathan Turner
67aaddddd6 Rollup merge of #37115 - GuillaumeGomez:buf_reader_urls, r=kmcallister
add missing urls for BufWriter and BufReader

r? @steveklabnik
2016-10-14 12:07:08 -07:00
Jonathan Turner
3da9ddb7bf Rollup merge of #37102 - est31:rustdoc_question_mark, r=GuillaumeGomez
rustdoc: color the question mark operator

The idea of coloring `?` specially was proposed by @eddyb in: https://github.com/rust-lang/rust/issues/31436#issuecomment-247426582
2016-10-14 12:07:07 -07:00
Jonathan Turner
ad40a42093 Rollup merge of #36961 - GuillaumeGomez:hash_doc, r=frewsxcv
Add missing urls for hash modules

r? @steveklabnik
2016-10-14 12:07:07 -07:00
Jonathan Turner
71a183f8e9 Rollup merge of #36755 - Rantanen:master, r=GuillaumeGomez
Explain motivation behind lifetimes

Start the lifetime section with an explanation of the issues that lack of explicit lifetimes cause and how the explicit lifetimes solve these.

----------------

I had really hard time figuring out why I would need to care about the explicit reference lifetimes when going through the book at first. With strong background in C++, I'm familiar with the dangling reference problem - but given the section seems to focus more on the lifetime syntax and various ways to define lifetimes on functions and structs, I was unable to understand how they are used to solve the reference problem.

This PR is an attempt at getting the reader to understand what the explicit lifetimes are used for and why they are an awesome thing instead of a bit of syntax that just has to be written.

It's been less than a week that I've been diving into Rust so I'm far from certain about the terminology and technical correctness. I tried mimicking the existing terminology from the lifetimes section, but still no promises on getting it right.
2016-10-14 12:07:07 -07:00