]> git.lizzy.rs Git - rust.git/log
rust.git
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 #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 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 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 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

7 years agoAuto merge of #37153 - michaelwoerister:spread-arg-debuginfo, r=eddyb
bors [Mon, 17 Oct 2016 07:31:25 +0000 (00:31 -0700)]
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

7 years agoAuto merge of #37082 - frewsxcv:session, r=jseyfried
bors [Mon, 17 Oct 2016 03:00:14 +0000 (20:00 -0700)]
Auto merge of #37082 - frewsxcv:session, r=jseyfried

'src/librustc/session/filesearch.rs' refactoring and cleanup.

7 years agoAuto merge of #37129 - arielb1:erased-normal, r=eddyb
bors [Sun, 16 Oct 2016 11:22:21 +0000 (04:22 -0700)]
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

7 years agoAuto merge of #37098 - ollie27:rustdoc_playground, r=GuillaumeGomez
bors [Sun, 16 Oct 2016 02:49:12 +0000 (19:49 -0700)]
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

7 years agoAuto merge of #37152 - arielb1:drop-cache, r=pnkfelix
bors [Sat, 15 Oct 2016 22:38:52 +0000 (15:38 -0700)]
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

7 years agorustdoc: Improve playground run buttons
Oliver Middleton [Tue, 11 Oct 2016 08:56:30 +0000 (09:56 +0100)]
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.

7 years agoAuto merge of #37132 - petrochenkov:intern, r=alexcrichton
bors [Sat, 15 Oct 2016 16:32:06 +0000 (09:32 -0700)]
Auto merge of #37132 - petrochenkov:intern, r=alexcrichton

Get rid of double indirection in string interner

7 years agoRemove FIXME
John Firebaugh [Sat, 15 Oct 2016 15:49:16 +0000 (08:49 -0700)]
Remove FIXME

7 years agoAuto merge of #37100 - dikaiosune:master, r=eddyb
bors [Sat, 15 Oct 2016 13:08:55 +0000 (06:08 -0700)]
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 :smile:. 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.

7 years agoAuto merge of #37094 - fhartwig:spec-extend-from-slice, r=alexcrichton
bors [Sat, 15 Oct 2016 08:48:42 +0000 (01:48 -0700)]
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)
```

7 years agoAuto merge of #35704 - tbu-:pr_pread_pwrite, r=alexcrichton
bors [Sat, 15 Oct 2016 02:33:04 +0000 (19:33 -0700)]
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.

7 years agoAuto merge of #37170 - jonathandturner:rollup, r=jonathandturner
bors [Fri, 14 Oct 2016 23:15:42 +0000 (16:15 -0700)]
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:

7 years agoAndroid: Fix unused-imports warning
Tobias Bucher [Fri, 14 Oct 2016 21:02:47 +0000 (23:02 +0200)]
Android: Fix unused-imports warning

7 years agoRollup merge of #37159 - cthulhua:readme-mingw-tar, r=alexcrichton
Jonathan Turner [Fri, 14 Oct 2016 19:07:09 +0000 (12:07 -0700)]
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.

7 years agoRollup merge of #37141 - nabeelomer:master, r=sfackler
Jonathan Turner [Fri, 14 Oct 2016 19:07:08 +0000 (12:07 -0700)]
Rollup merge of #37141 - nabeelomer:master, r=sfackler

Documented that RwLock might panic

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

7 years agoRollup merge of #37123 - srinivasreddy:libcore_num, r=erickt
Jonathan Turner [Fri, 14 Oct 2016 19:07:08 +0000 (12:07 -0700)]
Rollup merge of #37123 - srinivasreddy:libcore_num, r=erickt

run rustfmt on libcore/num folder

7 years agoRollup merge of #37122 - srinivasreddy:liblog, r=alexcrichton
Jonathan Turner [Fri, 14 Oct 2016 19:07:08 +0000 (12:07 -0700)]
Rollup merge of #37122 - srinivasreddy:liblog, r=alexcrichton

run rustfmt on liblog

7 years agoRollup merge of #37119 - durka:patch-31, r=steveklabnik
Jonathan Turner [Fri, 14 Oct 2016 19:07:08 +0000 (12:07 -0700)]
Rollup merge of #37119 - durka:patch-31, r=steveklabnik

book: remove backticks in Type Aliases header

Fix #37116.

7 years agoRollup merge of #37115 - GuillaumeGomez:buf_reader_urls, r=kmcallister
Jonathan Turner [Fri, 14 Oct 2016 19:07:08 +0000 (12:07 -0700)]
Rollup merge of #37115 - GuillaumeGomez:buf_reader_urls, r=kmcallister

add missing urls for BufWriter and BufReader

r? @steveklabnik

7 years agoRollup merge of #37102 - est31:rustdoc_question_mark, r=GuillaumeGomez
Jonathan Turner [Fri, 14 Oct 2016 19:07:07 +0000 (12:07 -0700)]
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

7 years agoRollup merge of #36961 - GuillaumeGomez:hash_doc, r=frewsxcv
Jonathan Turner [Fri, 14 Oct 2016 19:07:07 +0000 (12:07 -0700)]
Rollup merge of #36961 - GuillaumeGomez:hash_doc, r=frewsxcv

Add missing urls for hash modules

r? @steveklabnik

7 years agoRollup merge of #36755 - Rantanen:master, r=GuillaumeGomez
Jonathan Turner [Fri, 14 Oct 2016 19:07:07 +0000 (12:07 -0700)]
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.

7 years agoRollup merge of #36307 - faebser:E0408_new_error_format, r=GuillaumeGomez
Jonathan Turner [Fri, 14 Oct 2016 19:07:07 +0000 (12:07 -0700)]
Rollup merge of #36307 - faebser:E0408_new_error_format, r=GuillaumeGomez

Changed error message E0408 to new format

Followed your text and was able to change the ouput to the new format.
I did not encounter any broken test therefore this is a really small commit.

Thanks for letting me hack on the compiler :)

r? @jonathandturner

7 years agoRename static mut to upper case
Aleksey Kladov [Fri, 14 Oct 2016 12:07:18 +0000 (15:07 +0300)]
Rename static mut to upper case

7 years agoOnly use Android fallback for {ftruncate,pread,pwrite} on 32 bit
Tobias Bucher [Fri, 14 Oct 2016 12:19:41 +0000 (14:19 +0200)]
Only use Android fallback for {ftruncate,pread,pwrite} on 32 bit

7 years agoLint against lowercase static mut
Aleksey Kladov [Fri, 14 Oct 2016 10:12:42 +0000 (13:12 +0300)]
Lint against lowercase static mut

7 years agoAuto merge of #36692 - arthurprs:hashmap-layout, r=alexcrichton
bors [Fri, 14 Oct 2016 09:23:19 +0000 (02:23 -0700)]
Auto merge of #36692 - arthurprs:hashmap-layout, r=alexcrichton

Cache conscious hashmap table

Right now the internal HashMap representation is 3 unziped arrays hhhkkkvvv, I propose to change it to hhhkvkvkv (in further iterations kvkvkvhhh may allow inplace grow). A previous attempt is at #21973.

This layout is generally more cache conscious as it makes the value immediately accessible after a key matches. The separated hash arrays is a _no-brainer_ because of how the RH algorithm works and that's unchanged.

**Lookups**: Upon a successful match in the hash array the code can check the key and immediately have access to the value in the same or next cache line (effectively saving a L[1,2,3] miss compared to the current layout).
**Inserts/Deletes/Resize**: Moving values in the table (robin hooding it) is faster because it touches consecutive cache lines and uses less instructions.

Some backing benchmarks (besides the ones bellow) for the benefits of this layout can be seen here as well http://www.reedbeta.com/blog/2015/01/12/data-oriented-hash-table/

The obvious drawbacks is: padding can be wasted between the key and value. Because of that keys(), values() and contains() can consume more cache and be slower.

Total wasted padding between items (C being the capacity of the table).
* Old layout: C * (K-K padding) + C * (V-V padding)
* Proposed: C * (K-V padding) + C * (V-K padding)

In practice padding between K-K and V-V *can* be smaller than K-V and V-K. The overhead is capped(ish) at sizeof u64 - 1 so we can actually measure the worst case (u8 at the end of key type and value with aliment of 1, _hardly the average case in practice_).

Starting from the worst case the memory overhead is:
* `HashMap<u64, u8>` 46% memory overhead. (aka *worst case*)
* `HashMap<u64, u16>` 33% memory overhead.
* `HashMap<u64, u32>` 20% memory overhead.
* `HashMap<T, T>` 0% memory overhead
* Worst case based on sizeof K + sizeof V:

| x              |  16    |  24    |  32    |  64   |  128  |
|----------------|--------|--------|--------|-------|-------|
| (8+x+7)/(8+x)  |  1.29  |  1.22  |  1.18  |  1.1  |  1.05 |

I've a test repo here to run benchmarks  https://github.com/arthurprs/hashmap2/tree/layout

```
 ➜  hashmap2 git:(layout) ✗ cargo benchcmp hhkkvv:: hhkvkv:: bench.txt
 name                            hhkkvv:: ns/iter  hhkvkv:: ns/iter  diff ns/iter   diff %
 grow_10_000                     922,064           783,933               -138,131  -14.98%
 grow_big_value_10_000           1,901,909         1,171,862             -730,047  -38.38%
 grow_fnv_10_000                 443,544           418,674                -24,870   -5.61%
 insert_100                      2,469             2,342                     -127   -5.14%
 insert_1000                     23,331            21,536                  -1,795   -7.69%
 insert_100_000                  4,748,048         3,764,305             -983,743  -20.72%
 insert_10_000                   321,744           290,126                -31,618   -9.83%
 insert_int_bigvalue_10_000      749,764           407,547               -342,217  -45.64%
 insert_str_10_000               337,425           334,009                 -3,416   -1.01%
 insert_string_10_000            788,667           788,262                   -405   -0.05%
 iter_keys_100_000               394,484           374,161                -20,323   -5.15%
 iter_keys_big_value_100_000     402,071           620,810                218,739   54.40%
 iter_values_100_000             424,794           373,004                -51,790  -12.19%
 iterate_100_000                 424,297           389,950                -34,347   -8.10%
 lookup_100_000                  189,997           186,554                 -3,443   -1.81%
 lookup_100_000_bigvalue         192,509           189,695                 -2,814   -1.46%
 lookup_10_000                   154,251           145,731                 -8,520   -5.52%
 lookup_10_000_bigvalue          162,315           146,527                -15,788   -9.73%
 lookup_10_000_exist             132,769           128,922                 -3,847   -2.90%
 lookup_10_000_noexist           146,880           144,504                 -2,376   -1.62%
 lookup_1_000_000                137,167           132,260                 -4,907   -3.58%
 lookup_1_000_000_bigvalue       141,130           134,371                 -6,759   -4.79%
 lookup_1_000_000_bigvalue_unif  567,235           481,272                -85,963  -15.15%
 lookup_1_000_000_unif           589,391           453,576               -135,815  -23.04%
 merge_shuffle                   1,253,357         1,207,387              -45,970   -3.67%
 merge_simple                    40,264,690        37,996,903          -2,267,787   -5.63%
 new                             6                 5                           -1  -16.67%
 with_capacity_10e5              3,214             3,256                       42    1.31%
```

```
➜  hashmap2 git:(layout) ✗ cargo benchcmp hhkkvv:: hhkvkv:: bench.txt
 name                           hhkkvv:: ns/iter  hhkvkv:: ns/iter  diff ns/iter   diff %
 iter_keys_100_000              391,677           382,839                 -8,838   -2.26%
 iter_keys_1_000_000            10,797,360        10,209,898            -587,462   -5.44%
 iter_keys_big_value_100_000    414,736           662,255                247,519   59.68%
 iter_keys_big_value_1_000_000  10,147,837        12,067,938           1,920,101   18.92%
 iter_values_100_000            440,445           377,080                -63,365  -14.39%
 iter_values_1_000_000          10,931,844        9,979,173             -952,671   -8.71%
 iterate_100_000                428,644           388,509                -40,135   -9.36%
 iterate_1_000_000              11,065,419        10,042,427          -1,022,992   -9.24%
```

7 years agoAuto merge of #36743 - SimonSapin:dedup-by, r=alexcrichton
bors [Fri, 14 Oct 2016 02:56:53 +0000 (19:56 -0700)]
Auto merge of #36743 - SimonSapin:dedup-by, r=alexcrichton

Add Vec::dedup_by and Vec::dedup_by_key

7 years agoadd (missing) tar to list of packages to get under mingw
Danny Hua [Fri, 14 Oct 2016 02:38:49 +0000 (19:38 -0700)]
add (missing) tar to list of packages to get under mingw

7 years agoadd a per-param-env cache to `impls_bound`
Ariel Ben-Yehuda [Thu, 13 Oct 2016 20:39:50 +0000 (23:39 +0300)]
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.

I'm running a check that there are no adverse performance effects.

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

7 years agoAuto merge of #37151 - alexcrichton:fix-master, r=alexcrichton
bors [Thu, 13 Oct 2016 20:12:52 +0000 (13:12 -0700)]
Auto merge of #37151 - alexcrichton:fix-master, r=alexcrichton

rustbuild: Less panics in musl_root

Don't panic if the target wasn't configured.

7 years agorustbuild: Less panics in musl_root
Alex Crichton [Thu, 13 Oct 2016 19:01:59 +0000 (12:01 -0700)]
rustbuild: Less panics in musl_root

Don't panic if the target wasn't configured.

7 years agodebuginfo: Create debuginfo for re-aggregated spread_arg instead of for the individua...
Michael Woerister [Thu, 13 Oct 2016 18:55:31 +0000 (14:55 -0400)]
debuginfo: Create debuginfo for re-aggregated spread_arg instead of for the individual pieces.

7 years agonormalize types every time HR regions are erased
Ariel Ben-Yehuda [Wed, 12 Oct 2016 21:08:11 +0000 (00:08 +0300)]
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).

7 years agoRevert "normalize tuple pair types"
Ariel Ben-Yehuda [Thu, 13 Oct 2016 16:15:50 +0000 (19:15 +0300)]
Revert "normalize tuple pair types"

This reverts commit 7badc32005648e7aebe982a076cc677c68937fe4.

7 years agoUpdate
Nabeel Omer [Thu, 13 Oct 2016 15:37:18 +0000 (21:07 +0530)]
Update

7 years agoUpdated RwLock Docs
Nabeel Omer [Thu, 13 Oct 2016 15:07:09 +0000 (20:37 +0530)]
Updated RwLock Docs

7 years agoAdding FIXME for noop Substs::params.
Adam Perry [Wed, 12 Oct 2016 05:06:40 +0000 (22:06 -0700)]
Adding FIXME for noop Substs::params.

7 years agoAdd assert checking that allocation and deallocation sizes are equal
Vadim Petrochenkov [Thu, 13 Oct 2016 11:05:59 +0000 (14:05 +0300)]
Add assert checking that allocation and deallocation sizes are equal

7 years agoExplain motivation behind lifetimes
Mikko Rantanen [Mon, 26 Sep 2016 19:00:47 +0000 (22:00 +0300)]
Explain motivation behind lifetimes

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

7 years agoChanged error message E0408 to new format
Fabian Frei [Tue, 6 Sep 2016 21:00:35 +0000 (23:00 +0200)]
Changed error message E0408 to new format
r? @jonathandturner

7 years agoGet rid of double indirection in string interner by using `Rc<str>`
Vadim Petrochenkov [Wed, 12 Oct 2016 17:54:41 +0000 (20:54 +0300)]
Get rid of double indirection in string interner by using `Rc<str>`

7 years agoAdd an unstable constructor for creating `Rc<str>` from `str`
Vadim Petrochenkov [Wed, 12 Oct 2016 17:54:41 +0000 (20:54 +0300)]
Add an unstable constructor for creating `Rc<str>` from `str`

7 years agoAuto merge of #37118 - alexcrichton:rollup, r=alexcrichton
bors [Wed, 12 Oct 2016 21:42:12 +0000 (14:42 -0700)]
Auto merge of #37118 - alexcrichton:rollup, r=alexcrichton

Rollup of 17 pull requests

- Successful merges: #36762, #36831, #36973, #36991, #36995, #37023, #37049, #37050, #37056, #37064, #37066, #37067, #37084, #37089, #37091, #37092, #37110
- Failed merges:

7 years agoRollup merge of #37110 - TimNN:fix-37109, r=eddyb
Alex Crichton [Wed, 12 Oct 2016 17:15:29 +0000 (10:15 -0700)]
Rollup merge of #37110 - TimNN:fix-37109, r=eddyb

normalize tuple pair types in trans

Fixes #37109.

Note that #37109 is a regression from stable to stable, beta and nightly.

7 years agoRollup merge of #37092 - alexcrichton:update-libc, r=japaric
Alex Crichton [Wed, 12 Oct 2016 17:15:29 +0000 (10:15 -0700)]
Rollup merge of #37092 - alexcrichton:update-libc, r=japaric

std: Update liblibc submodule

This fixes compilation on the s390x target

7 years agoRollup merge of #37091 - alexcrichton:configure, r=brson
Alex Crichton [Wed, 12 Oct 2016 17:15:28 +0000 (10:15 -0700)]
Rollup merge of #37091 - alexcrichton:configure, r=brson

configure: Fix gcc detection for LLVM

We have a case where 32-bit compilation accidentally requested clang when gcc
was the only one available.

7 years agoRollup merge of #37089 - GuillaumeGomez:io_urls, r=frewsxcv
Alex Crichton [Wed, 12 Oct 2016 17:15:28 +0000 (10:15 -0700)]
Rollup merge of #37089 - GuillaumeGomez:io_urls, r=frewsxcv

Add missing urls in io module

r? @steveklabnik

7 years agoRollup merge of #37084 - jseyfried:cleanup_expanded_macro_use_scopes, r=nrc
Alex Crichton [Wed, 12 Oct 2016 17:15:28 +0000 (10:15 -0700)]
Rollup merge of #37084 - jseyfried:cleanup_expanded_macro_use_scopes, r=nrc

macros: clean up scopes of expanded `#[macro_use]` imports

This PR changes the scope of macro-expanded `#[macro_use]` imports to match that of unexpanded `#[macro_use]` imports. For example, this would be allowed:
```rust
example!();
macro_rules! m { () => { #[macro_use(example)] extern crate example_crate; } }
m!();
```

This PR also enforces the full shadowing restrictions from RFC 1560 on `#[macro_use]` imports (currently, we only enforce the weakened restrictions from #36767).

This is a [breaking-change], but I believe it is highly unlikely to cause breakage in practice.
r? @nrc

7 years agoRollup merge of #37067 - jseyfried:expand_derives_last, r=alexcrichton
Alex Crichton [Wed, 12 Oct 2016 17:15:28 +0000 (10:15 -0700)]
Rollup merge of #37067 - jseyfried:expand_derives_last, r=alexcrichton

macros: expand `#[derive]`s after other attribute macros and improve intra-`#[derive]` ordering

Fixes https://github.com/serde-rs/serde/issues/577.
cc #35900
r? @alexcrichton

7 years agoRollup merge of #37066 - nrc:stderr, r=alexcrichton
Alex Crichton [Wed, 12 Oct 2016 17:15:28 +0000 (10:15 -0700)]
Rollup merge of #37066 - nrc:stderr, r=alexcrichton

Error monitor should emit error to stderr instead of stdout

We are pretty consistent about emitting to stderr, except for when there is actually an error, in which case we emit to stdout. This seems a bit backwards. This PR just changes that exception to emit to stderr. This is useful for the RLS since the LS protocol uses stdout (grrr).

r? @alexcrichton

7 years agoRollup merge of #37064 - nnethercote:read_str, r=eddyb
Alex Crichton [Wed, 12 Oct 2016 17:15:27 +0000 (10:15 -0700)]
Rollup merge of #37064 - nnethercote:read_str, r=eddyb

Avoid allocations in `Decoder::read_str`.

`opaque::Decoder::read_str` is very hot within `rustc` due to its use in
the reading of crate metadata, and it currently returns a `String`. This
commit changes it to instead return a `Cow<str>`, which avoids a heap
allocation.

This change reduces the number of calls to `malloc` by almost 10% in
some benchmarks.

This is a [breaking-change] to libserialize.

7 years agoRollup merge of #37056 - Mark-Simulacrum:fix-bool-comparison, r=bluss
Alex Crichton [Wed, 12 Oct 2016 17:15:27 +0000 (10:15 -0700)]
Rollup merge of #37056 - Mark-Simulacrum:fix-bool-comparison, r=bluss

Add comparison operators to boolean const eval.

I think it might be worth adding tests here, but since I don't know how or where to do that, I have not done so yet. Willing to do so if asked and given an explanation as to how.

Fixes #37047.

7 years agoRollup merge of #37050 - frewsxcv:librustdoc, r=alexcrichton
Alex Crichton [Wed, 12 Oct 2016 17:15:27 +0000 (10:15 -0700)]
Rollup merge of #37050 - frewsxcv:librustdoc, r=alexcrichton

librustdoc refactoring and cleanup.

7 years agoRollup merge of #37049 - srinivasreddy:librustc_lint, r=nrc
Alex Crichton [Wed, 12 Oct 2016 17:15:27 +0000 (10:15 -0700)]
Rollup merge of #37049 - srinivasreddy:librustc_lint, r=nrc

run rustfmt on librustc_lint folder

7 years agoRollup merge of #37023 - jseyfried:fix_extern_crate_back_compat, r=nrc
Alex Crichton [Wed, 12 Oct 2016 17:15:26 +0000 (10:15 -0700)]
Rollup merge of #37023 - jseyfried:fix_extern_crate_back_compat, r=nrc

Fix importing inaccessible `extern crate`s (with a warning)

Fixes #36747, fixes #37020, and fixes #37021.
r? @nrc

7 years agoRollup merge of #36995 - nrc:stable, r=@nikomatsakis
Alex Crichton [Wed, 12 Oct 2016 17:15:26 +0000 (10:15 -0700)]
Rollup merge of #36995 - nrc:stable, r=@nikomatsakis

stabilise ?, attributes on stmts, deprecate Reflect

r? @nikomatsakis

7 years agoRollup merge of #36991 - wesleywiser:fixme_1, r=arielb1
Alex Crichton [Wed, 12 Oct 2016 17:15:26 +0000 (10:15 -0700)]
Rollup merge of #36991 - wesleywiser:fixme_1, r=arielb1

Move IdxSetBuf and BitSlice to rustc_data_structures

Resolves a FIXME

7 years agoChange color and make ? bold
est31 [Wed, 12 Oct 2016 12:48:13 +0000 (14:48 +0200)]
Change color and make ? bold

7 years agoAuto merge of #36762 - achanda:sockaddr_type, r=alexcrichton
bors [Wed, 12 Oct 2016 18:28:53 +0000 (11:28 -0700)]
Auto merge of #36762 - achanda:sockaddr_type, r=alexcrichton

Add two functions to check type of SockAddr

These can be used to determine the type of the underlying IP
address

r? @alexcrichton

7 years agorun rustfmt on libcore/num folder
Srinivas Reddy Thatiparthy [Wed, 12 Oct 2016 18:27:46 +0000 (23:57 +0530)]
run rustfmt on libcore/num folder

7 years agorun rustfmt on liblog
Srinivas Reddy Thatiparthy [Wed, 12 Oct 2016 18:15:03 +0000 (23:45 +0530)]
run rustfmt on liblog

7 years agobook: remove backticks in Type Aliases header
Alex Burka [Wed, 12 Oct 2016 17:44:08 +0000 (13:44 -0400)]
book: remove backticks in Type Aliases header

Fix #37116.

7 years agoSome tests to check that lifetime parametric fn's do not trip up LLVM.
Felix S. Klock II [Wed, 12 Oct 2016 17:29:50 +0000 (19:29 +0200)]
Some tests to check that lifetime parametric fn's do not trip up LLVM.

7 years agoInject bitcast if types mismatch when building a store instruction.
Felix S. Klock II [Wed, 12 Oct 2016 17:26:06 +0000 (19:26 +0200)]
Inject bitcast if types mismatch when building a store instruction.

7 years agoRollup merge of #36831 - michaelwoerister:ich-updates, r=nikomatsakis
Alex Crichton [Wed, 12 Oct 2016 17:15:26 +0000 (10:15 -0700)]
Rollup merge of #36831 - michaelwoerister:ich-updates, r=nikomatsakis

incr.comp.: Minor refactoring and update to struct ICH test case

r? @nikomatsakis

7 years agoRollup merge of #36762 - achanda:sockaddr_type, r=alexcrichton
Alex Crichton [Wed, 12 Oct 2016 17:15:25 +0000 (10:15 -0700)]
Rollup merge of #36762 - achanda:sockaddr_type, r=alexcrichton

Add two functions to check type of SockAddr

These can be used to determine the type of the underlying IP
address

r? @alexcrichton

7 years agoadd missing urls for BufWriter and BufReader
Guillaume Gomez [Wed, 12 Oct 2016 16:27:04 +0000 (18:27 +0200)]
add missing urls for BufWriter and BufReader

7 years agoFix ICE by injecting bitcasts if types mismatch when building invokes or calls.
Felix S. Klock II [Wed, 12 Oct 2016 15:36:04 +0000 (17:36 +0200)]
Fix ICE by injecting bitcasts if types mismatch when building invokes or calls.

7 years agoCache conscious hashmap table
arthurprs [Sat, 24 Sep 2016 09:28:00 +0000 (11:28 +0200)]
Cache conscious hashmap table

7 years agoAuto merge of #36737 - srinivasreddy:check, r=nrc
bors [Wed, 12 Oct 2016 12:29:09 +0000 (05:29 -0700)]
Auto merge of #36737 - srinivasreddy:check, r=nrc

Run rustfmt on librustc_typeck/check/ folder

7 years agoRemove unnecessary `unsafe` block
Tobias Bucher [Wed, 12 Oct 2016 11:06:55 +0000 (13:06 +0200)]
Remove unnecessary `unsafe` block

7 years agonormalize tuple pair types
Tim Neumann [Wed, 12 Oct 2016 10:10:39 +0000 (12:10 +0200)]
normalize tuple pair types

7 years agoAuto merge of #37095 - petrochenkov:metactor, r=alexcrichton
bors [Wed, 12 Oct 2016 06:36:29 +0000 (23:36 -0700)]
Auto merge of #37095 - petrochenkov:metactor, r=alexcrichton

Temporary fix for metadata decoding for struct constructors

Same as https://github.com/rust-lang/rust/pull/37078, but for nightly.
Ideally, metadata lookup functions should "just work" for constructor ids, but this fixes the issue as well.

Fixes https://github.com/rust-lang/rust/issues/37026
r? @alexcrichton

7 years agoUsing a type alias of Slice<Kind<'tcx>> to intern Substs<'tcx>.
Adam Perry [Sun, 9 Oct 2016 18:36:12 +0000 (11:36 -0700)]
Using a type alias of Slice<Kind<'tcx>> to intern Substs<'tcx>.

Fixing now incorrect Hash impl for TransItem.
Using as_ptr() rather than a pointer cast for string formatting.
Fixing Borrow and Lift impls for Substs.
Move usages of tcx.mk_substs to Substs::new iterator-based version.

7 years agorustdoc: color the question mark operator
est31 [Wed, 12 Oct 2016 03:23:37 +0000 (05:23 +0200)]
rustdoc: color the question mark operator

The idea was proposed by eddyb in: https://github.com/rust-lang/rust/issues/31436#issuecomment-247426582

7 years agoAuto merge of #37090 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Tue, 11 Oct 2016 20:29:02 +0000 (13:29 -0700)]
Auto merge of #37090 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 9 pull requests

- Successful merges: #36679, #36699, #36997, #37040, #37060, #37065, #37072, #37073, #37081
- Failed merges:

7 years agoTemporary fix for metadata decoding for struct constructors
Vadim Petrochenkov [Tue, 11 Oct 2016 20:04:29 +0000 (23:04 +0300)]
Temporary fix for metadata decoding for struct constructors

7 years agoReview changes
Nick Cameron [Thu, 6 Oct 2016 19:18:17 +0000 (08:18 +1300)]
Review changes

7 years agoDeprecate `Reflect`
Nick Cameron [Thu, 6 Oct 2016 05:28:27 +0000 (18:28 +1300)]
Deprecate `Reflect`

[tracking issue](https://github.com/rust-lang/rust/issues/27749)

7 years agoStabilise attributes on statements.
Nick Cameron [Thu, 6 Oct 2016 03:44:59 +0000 (16:44 +1300)]
Stabilise attributes on statements.

Note that attributes on expressions are still unstable and are behind the `stmt_expr_attributes` flag.

cc [Tracking issue](https://github.com/rust-lang/rust/issues/15701)

7 years agoStabilise `?`
Nick Cameron [Wed, 5 Oct 2016 22:36:36 +0000 (11:36 +1300)]
Stabilise `?`

cc [`?` tracking issue](https://github.com/rust-lang/rust/issues/31436)

7 years agoSpecialize Vec::extend to Vec::extend_from_slice
Florian Hartwig [Tue, 11 Oct 2016 17:22:41 +0000 (19:22 +0200)]
Specialize Vec::extend to Vec::extend_from_slice

7 years agostd: Update liblibc submodule
Alex Crichton [Tue, 11 Oct 2016 17:10:10 +0000 (10:10 -0700)]
std: Update liblibc submodule

This fixes compilation on the s390x target

7 years agoconfigure: Fix gcc detection for LLVM
Alex Crichton [Tue, 11 Oct 2016 17:08:07 +0000 (10:08 -0700)]
configure: Fix gcc detection for LLVM

We have a case where 32-bit compilation accidentally requested clang when gcc
was the only one available.

7 years agoRollup merge of #37081 - p512:master, r=sfackler
Guillaume Gomez [Tue, 11 Oct 2016 15:51:27 +0000 (17:51 +0200)]
Rollup merge of #37081 - p512:master, r=sfackler

Changed 0 into '0'

Right now `0` is an undefined production rule.
[Documentation following the grammar specification](https://doc.rust-lang.org/nightly/std/fmt/#sign0) strongly suggests `'0'` is meant as it is used as a character literal.

r? @steveklabnik

7 years agoRollup merge of #37073 - GuillaumeGomez:string_url, r=steveklabnik
Guillaume Gomez [Tue, 11 Oct 2016 15:51:27 +0000 (17:51 +0200)]
Rollup merge of #37073 - GuillaumeGomez:string_url, r=steveklabnik

Add missing urls on String module

r? @steveklabnik

7 years agoRollup merge of #37072 - michaelwoerister:enable-trait-ich-tests, r=nikomatsakis
Guillaume Gomez [Tue, 11 Oct 2016 15:51:27 +0000 (17:51 +0200)]
Rollup merge of #37072 - michaelwoerister:enable-trait-ich-tests, r=nikomatsakis

ICH: Enable some cases in trait definition hashing.

Enable some test cases originally written by @eulerdisk. The tests can be enabled now because @MathieuBordere has fixed the underlying problem in #36974.

r? @nikomatsakis

7 years agoRollup merge of #37065 - nnethercote:opt-mk_printer, r=nikomatsakis
Guillaume Gomez [Tue, 11 Oct 2016 15:51:26 +0000 (17:51 +0200)]
Rollup merge of #37065 - nnethercote:opt-mk_printer, r=nikomatsakis

Merge `Printer::token` and `Printer::size`.

Logically, it's a vector of pairs, so might as well represent it that
way.

The commit also changes `scan_stack` so that it is initialized with the
default size, instead of the excessive `55 * linewidth` size, which it
usually doesn't get even close to reaching.

7 years agoRollup merge of #37060 - jfirebaugh:E0303, r=jonathandturner
Guillaume Gomez [Tue, 11 Oct 2016 15:51:26 +0000 (17:51 +0200)]
Rollup merge of #37060 - jfirebaugh:E0303, r=jonathandturner

Update E0303 to new error format

Fixes #35790

r? @jonathandturner

7 years agoRollup merge of #37040 - flodiebold:hash-tests, r=michaelwoerister
Guillaume Gomez [Tue, 11 Oct 2016 15:51:26 +0000 (17:51 +0200)]
Rollup merge of #37040 - flodiebold:hash-tests, r=michaelwoerister

Incr. comp. hash tests for consts and statics

Hi,

These two commits fix #37000 and #37001.

r? @michaelwoerister

7 years agoRollup merge of #36997 - KillTheMule:patch-1, r=steveklabnik
Guillaume Gomez [Tue, 11 Oct 2016 15:51:26 +0000 (17:51 +0200)]
Rollup merge of #36997 - KillTheMule:patch-1, r=steveklabnik

Book: Be very explicit of lifetimes being descriptive

... not prescriptive. Pointed out in https://users.rust-lang.org/t/what-if-i-get-lifetimes-wrong/7535/4, which was a revelation to me and made me think this should be more clear in the book. I'm not sure if I got this entirely right or if the wording is good, but I figured a PR is more helpful than a simple issue.

r? @steveklabnik

Small Note: There's also https://github.com/rust-lang/book, should I have sent the PR there? It doesn't coincide with the online book though, so I figured it's better of here.

7 years agoRollup merge of #36699 - bluss:repeat-str, r=alexcrichton
Guillaume Gomez [Tue, 11 Oct 2016 15:51:26 +0000 (17:51 +0200)]
Rollup merge of #36699 - bluss:repeat-str, r=alexcrichton

Add method str::repeat(self, usize) -> String

It is relatively simple to repeat a string n times:
`(0..n).map(|_| s).collect::<String>()`. It becomes slightly more
complicated to do it “right” (sizing the allocation up front), which
warrants a method that does it for us.

This method is useful in writing testcases, or when generating text.
`format!()` can be used to repeat single characters, but not repeating
strings like this.

7 years agoRollup merge of #36679 - QuietMisdreavus:rustdoc-line-breaks, r=steveklabnik
Guillaume Gomez [Tue, 11 Oct 2016 15:51:25 +0000 (17:51 +0200)]
Rollup merge of #36679 - QuietMisdreavus:rustdoc-line-breaks, r=steveklabnik

rustdoc: print non-self arguments of bare functions and struct methods on their own line

This change alters the formatting rustdoc uses when it creates function and struct method documentation. For bare functions, each argument is printed on its own line. For struct methods, non-self arguments are printed on their own line. In both cases, no line breaks are introduced if there are no arguments, and for struct methods, no line breaks are introduced if there is only a single self argument. This should aid readability of long function signatures and allow for greater comprehension of these functions.

I've run rustdoc with these changes on my crate egg-mode and its set of dependencies and put the result [on my server](https://shiva.icesoldier.me/doc-custom/egg_mode/). Of note, here are a few shortcut links that highlight the changes:

* [Bare function with a long signature](https://shiva.icesoldier.me/doc-custom/egg_mode/place/fn.reverse_geocode.html)
* [Struct methods, with single self argument and with self and non-self arguments](https://shiva.icesoldier.me/doc-custom/egg_mode/tweet/struct.Timeline.html#method.reset)
* [Bare functions with no arguments](https://shiva.icesoldier.me/doc-custom/rand/fn.thread_rng.html) and [struct methods with no arguments](https://shiva.icesoldier.me/doc-custom/hyper/client/struct.Client.html#method.new) are left unchanged.

This PR consists of two commits: one for bare functions and one for struct methods.

7 years agoAdd missing urls in io module
Guillaume Gomez [Tue, 11 Oct 2016 15:48:14 +0000 (17:48 +0200)]
Add missing urls in io module