]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoFix issues with the Add/AddAssign impls for Cow<str>
Oliver Middleton [Fri, 4 Nov 2016 01:07:00 +0000 (01:07 +0000)]
Fix issues with the Add/AddAssign impls for Cow<str>

* Correct the stability attributes.
* Make Add and AddAssign actually behave the same.
* Use String::with_capacity when allocating a new string.
* Fix the tests.

7 years agoAuto merge of #37054 - rednum:master, r=alexcrichton
bors [Wed, 2 Nov 2016 12:37:33 +0000 (05:37 -0700)]
Auto merge of #37054 - rednum:master, r=alexcrichton

Add or and or_else for ordering.

Fixes https://github.com/rust-lang/rust/issues/37053 (see discussion in rust-lang/rfcs#1677).

7 years agoAuto merge of #36131 - Florob:entry_typeck, r=eddyb
bors [Wed, 2 Nov 2016 06:50:05 +0000 (23:50 -0700)]
Auto merge of #36131 - Florob:entry_typeck, r=eddyb

typeck: Fix error reporting of wrong entry function signatures

Expected and actual type were switched, this was introduced by
refactoring in 8eb12d91aaf95432ca73bda429af04e0710c984d.

7 years agoAuto merge of #37514 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Wed, 2 Nov 2016 02:38:16 +0000 (19:38 -0700)]
Auto merge of #37514 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 7 pull requests

- Successful merges: #36849, #37059, #37296, #37316, #37484, #37485, #37495
- Failed merges:

7 years agoAuto merge of #37491 - Mark-Simulacrum:closure-ice, r=eddyb
bors [Tue, 1 Nov 2016 19:20:03 +0000 (12:20 -0700)]
Auto merge of #37491 - Mark-Simulacrum:closure-ice, r=eddyb

Fix ICE when printing closures, and other similar types

Follow-up of https://github.com/rust-lang/rust/pull/37459, further fixes those problems.

Potentially actually fixes #36622, though @eddyb may want to not let that close if the rename of RUST_LOG is deemed part of that issue.

Potentially should be beta-nominated as well?

r? @eddyb

7 years agoRollup merge of #37495 - buntine:master, r=steveklabnik
Guillaume Gomez [Tue, 1 Nov 2016 15:15:52 +0000 (16:15 +0100)]
Rollup merge of #37495 - buntine:master, r=steveklabnik

Commented out final 'main' function in order to fit within pattern of…

… other examples and prevent incorrect indentation

7 years agoRollup merge of #37485 - xfix:patch-2, r=steveklabnik
Guillaume Gomez [Tue, 1 Nov 2016 15:15:52 +0000 (16:15 +0100)]
Rollup merge of #37485 - xfix:patch-2, r=steveklabnik

Don't mention "*" dependency version in guessing game example

It's a bad practice as far [RFC 1241](https://github.com/rust-lang/rfcs/blob/master/text/1241-no-wildcard-deps.md) is concerned, and introducing it in early tutorial may as well make it feel legitimate.

7 years agoRollup merge of #37484 - pfrenssen:patch-1, r=steveklabnik
Guillaume Gomez [Tue, 1 Nov 2016 15:15:52 +0000 (16:15 +0100)]
Rollup merge of #37484 - pfrenssen:patch-1, r=steveklabnik

Update "Testing" chapter for 1.12

I followed the "Testing" chapter using Rust 1.12.1 but there are some differences. By default the `tests` module is now also generated by `cargo new`, and the console output is updated.

7 years agoRollup merge of #37316 - ollie27:docs_links, r=GuillaumeGomez
Guillaume Gomez [Tue, 1 Nov 2016 15:15:52 +0000 (16:15 +0100)]
Rollup merge of #37316 - ollie27:docs_links, r=GuillaumeGomez

Fix a few links in the docs

r? @steveklabnik

7 years agoRollup merge of #37296 - srinivasreddy:librustc_driver, r=nikomatsakis
Guillaume Gomez [Tue, 1 Nov 2016 15:15:51 +0000 (16:15 +0100)]
Rollup merge of #37296 - srinivasreddy:librustc_driver, r=nikomatsakis

run rustfmt on librustc_driver folder

7 years agoRollup merge of #37059 - jfirebaugh:unused-RangeExpression, r=alexcrichton
Guillaume Gomez [Tue, 1 Nov 2016 15:15:51 +0000 (16:15 +0100)]
Rollup merge of #37059 - jfirebaugh:unused-RangeExpression, r=alexcrichton

Remove TypeOrigin::RangeExpression

This variant became unused in #30884.

7 years agoRollup merge of #36849 - diwic:69-fromutf8-doc, r=alexcrichton
Guillaume Gomez [Tue, 1 Nov 2016 15:15:51 +0000 (16:15 +0100)]
Rollup merge of #36849 - diwic:69-fromutf8-doc, r=alexcrichton

str: Fix documentation typo

from_utf8 returns a Result, not an Option.

Signed-off-by: David Henningsson diwic@ubuntu.com
7 years agoMerge branch 'master' of https://github.com/rust-lang/rust
Marcin Fatyga [Tue, 1 Nov 2016 14:26:22 +0000 (15:26 +0100)]
Merge branch 'master' of https://github.com/rust-lang/rust

Conflicts:
src/libcoretest/lib.rs

7 years agoAuto merge of #37332 - nikomatsakis:incr-comp-benchmark-2, r=michaelwoerister
bors [Tue, 1 Nov 2016 14:04:33 +0000 (07:04 -0700)]
Auto merge of #37332 - nikomatsakis:incr-comp-benchmark-2, r=michaelwoerister

add more incremental reuse test cases

r? @michaelwoerister

This is basically a port of the "private method in impl". It works better when it's a top-level fn. =)

7 years agoAuto merge of #37299 - devonhollowood:result-unwrap-or-default, r=alexcrichton
bors [Tue, 1 Nov 2016 10:53:42 +0000 (03:53 -0700)]
Auto merge of #37299 - devonhollowood:result-unwrap-or-default, r=alexcrichton

Add `unwrap_or_default` method to `Result`

Fixes #37025

7 years agoAuto merge of #37178 - apasel422:issue-37136, r=alexcrichton
bors [Tue, 1 Nov 2016 07:44:50 +0000 (00:44 -0700)]
Auto merge of #37178 - apasel422:issue-37136, r=alexcrichton

Implement `RefUnwindSafe` for atomic types

Closes #37136

7 years agoAuto merge of #36595 - bluss:hashmap-usize-for-hash, r=alexcrichton
bors [Tue, 1 Nov 2016 04:36:39 +0000 (21:36 -0700)]
Auto merge of #36595 - bluss:hashmap-usize-for-hash, r=alexcrichton

hashmap: Store hashes as usize internally

We can't use more than usize's bits of a hash to select a bucket anyway,
so we only need to store that part in the table. This should be an
improvement for the size of the data structure on 32-bit platforms.
Smaller data means better cache utilization and hopefully better
performance.

Fixes #36567

7 years agoAuto merge of #37497 - iirelu:proper-vec-brackets-2, r=steveklabnik
bors [Mon, 31 Oct 2016 23:29:03 +0000 (16:29 -0700)]
Auto merge of #37497 - iirelu:proper-vec-brackets-2, r=steveklabnik

Make all vec! macros use square brackets: Attempt 2

[The last PR](https://github.com/rust-lang/rust/pull/37476) ended with tears after a valiant struggle with git. I managed to clean up the completely broken history of that into a brand spanking new PR! Yay!

Original:

> Everyone hates the old syntax. I hope. Otherwise this PR has some controversy I wasn't expecting.

> This would be the perfect time to write a lint recommending vec![..] when you use another style.

> Disclaimer: I may have broken something. If I have, I'll fix them when the tests come in. Luckily the chance for a non-syntactical error is pretty low in all this.

7 years agoChanged most vec! invocations to use square braces
iirelu [Sat, 29 Oct 2016 21:54:04 +0000 (22:54 +0100)]
Changed most vec! invocations to use square braces

Most of the Rust community agrees that the vec! macro is clearer when
called using square brackets [] instead of regular brackets (). Most of
these ocurrences are from before macros allowed using different types of
brackets.

There is one left unchanged in a pretty-print test, as the pretty
printer still wants it to have regular brackets.

7 years agoAuto merge of #37191 - zackmdavis:we_heard_you_the_first_time_really, r=nikomatsakis
bors [Mon, 31 Oct 2016 17:56:25 +0000 (10:56 -0700)]
Auto merge of #37191 - zackmdavis:we_heard_you_the_first_time_really, r=nikomatsakis

introing one-time diagnostics: only emit "lint level defined here" once

This is a revised resubmission of PR #34084 (which was closed due to inactivity on account of time constraints on the author's part).
---

We introduce a new `one_time_diagnostics` field on
`rustc::session::Session` to hold a hashset of diagnostic messages we've
set once but don't want to see again (as uniquified by span and message
text), "lint level defined here" being the motivating example dealt with
here.

This is in the matter of #24690.
---

r? @nikomatsakis

7 years agoAuto merge of #37494 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Mon, 31 Oct 2016 14:22:58 +0000 (07:22 -0700)]
Auto merge of #37494 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 5 pull requests

- Successful merges: #37438, #37458, #37462, #37475, #37486
- Failed merges:

7 years agoRemoved commented main functions entirely. This fits in with other examples in the...
Bunts Thy Unholy [Mon, 31 Oct 2016 12:41:38 +0000 (23:41 +1100)]
Removed commented main functions entirely. This fits in with other examples in the Closures section

7 years agoCommented out final 'main' function in order to fit within pattern of other examples...
Bunts Thy Unholy [Mon, 31 Oct 2016 11:45:03 +0000 (22:45 +1100)]
Commented out final 'main' function in order to fit within pattern of other examples and prevent incorrect indentation

7 years agoRollup merge of #37486 - msiglreith:pr_doc_bitandassign, r=apasel422
Guillaume Gomez [Mon, 31 Oct 2016 11:27:24 +0000 (12:27 +0100)]
Rollup merge of #37486 - msiglreith:pr_doc_bitandassign, r=apasel422

Fix typo in the BitAndAssign operator documentation

The name of the operator should be `&=` instead of `&`.

7 years agoRollup merge of #37475 - AndiDog:feature/error-explanation-E0532, r=GuillaumeGomez
Guillaume Gomez [Mon, 31 Oct 2016 11:27:24 +0000 (12:27 +0100)]
Rollup merge of #37475 - AndiDog:feature/error-explanation-E0532, r=GuillaumeGomez

Add E0532 error explanation

This resolves one of the error list in https://github.com/rust-lang/rust/issues/35347 - just because I stumbled over it today.

I assumed the error code should be removed from `register_diagnostics!` because it's now defined above.

Since that is my first code contribution, please check that all is in order. It would be helpful to know how to run the test for the `compile_fail,E0532` part. I did `make check-stage1-cfail NO_REBUILD=1` but that doesn't test the inlined example.

r? @GuillaumeGomez

7 years agoRollup merge of #37462 - Mark-Simulacrum:remove-obsolete-fixme, r=petrochenkov
Guillaume Gomez [Mon, 31 Oct 2016 11:27:24 +0000 (12:27 +0100)]
Rollup merge of #37462 - Mark-Simulacrum:remove-obsolete-fixme, r=petrochenkov

Remove outdated fixme comment.

Linked issue has been closed, but the comment was not removed.

If this is still an issue, then the comment should probably be updated.

r? @petrochenkov

7 years agoRollup merge of #37458 - nrc:save-span-errs2, r=petrochenkov
Guillaume Gomez [Mon, 31 Oct 2016 11:27:23 +0000 (12:27 +0100)]
Rollup merge of #37458 - nrc:save-span-errs2, r=petrochenkov

Fix more spans in deriving::generic

r? @petrochenkov

7 years agoRollup merge of #37438 - Cobrand:index_doc, r=GuillaumeGomez
Guillaume Gomez [Mon, 31 Oct 2016 11:27:23 +0000 (12:27 +0100)]
Rollup merge of #37438 - Cobrand:index_doc, r=GuillaumeGomez

improve docs for Index and IndexMut

This mainly changes the boring example of Foo/Bar of `IndexMut` into a better one.

Also added explanations about syntactic sugar for `v[index]`.

Closes #36329

7 years agoAuto merge of #37465 - pftbest:rust-llvm-2016-10-29, r=alexcrichton
bors [Mon, 31 Oct 2016 09:52:54 +0000 (02:52 -0700)]
Auto merge of #37465 - pftbest:rust-llvm-2016-10-29, r=alexcrichton

LLVM: Update submodule to rust-llvm-2016-10-29 branch.

Fixes #37227

7 years agoAuto merge of #37439 - michaelwoerister:remove-sha256, r=alexcrichton
bors [Mon, 31 Oct 2016 06:37:18 +0000 (23:37 -0700)]
Auto merge of #37439 - michaelwoerister:remove-sha256, r=alexcrichton

Replace all uses of SHA-256 with BLAKE2b.

Removes the SHA-256 implementation and replaces all uses of it with BLAKE2b, which we already use for debuginfo type guids and incremental compilation hashes. It doesn't make much sense to have two different cryptographic hash implementations in the compiler and Blake has a few advantages over SHA-2 (computationally less expensive, hashes of up to 512 bits).

7 years agoAuto merge of #37489 - nagisa:unnecessary-clone, r=eddyb
bors [Mon, 31 Oct 2016 03:30:38 +0000 (20:30 -0700)]
Auto merge of #37489 - nagisa:unnecessary-clone, r=eddyb

Do not clone Mir unnecessarily

r? @eddyb

7 years agoFix ICE when printing closures, and other similar types
Mark-Simulacrum [Mon, 31 Oct 2016 02:14:10 +0000 (20:14 -0600)]
Fix ICE when printing closures, and other similar types

7 years agoAdd E0532 error explanation
Andreas Sommer [Sat, 29 Oct 2016 23:03:16 +0000 (01:03 +0200)]
Add E0532 error explanation

7 years agoDo not clone Mir unnecessarily
Simonas Kazlauskas [Mon, 31 Oct 2016 00:16:21 +0000 (02:16 +0200)]
Do not clone Mir unnecessarily

7 years agoAuto merge of #37460 - nrc:save-imports, r=eddyb
bors [Mon, 31 Oct 2016 00:01:28 +0000 (17:01 -0700)]
Auto merge of #37460 - nrc:save-imports, r=eddyb

save-analysis: change imports to carry a ref id rather than their own…

… node id

To make jump to def for imports work

r? @eddyb

7 years agoMake the crate disambiguator 128 bits instead of 256 bits.
Michael Woerister [Sun, 30 Oct 2016 23:01:37 +0000 (19:01 -0400)]
Make the crate disambiguator 128 bits instead of 256 bits.

7 years agoAdd rustc_data_structures to rustc_driver dependencies.
Michael Woerister [Sat, 29 Oct 2016 01:26:01 +0000 (21:26 -0400)]
Add rustc_data_structures to rustc_driver dependencies.

7 years agoReplace all uses of SHA-256 with BLAKE2b.
Michael Woerister [Thu, 27 Oct 2016 02:42:48 +0000 (22:42 -0400)]
Replace all uses of SHA-256 with BLAKE2b.

7 years agoAuto merge of #37459 - Mark-Simulacrum:closure-ice, r=eddyb
bors [Sun, 30 Oct 2016 20:36:58 +0000 (13:36 -0700)]
Auto merge of #37459 - Mark-Simulacrum:closure-ice, r=eddyb

Fix ICE when attempting to print closure generics

Fixes #36622.

r? @eddyb or @arielb1

7 years agoAuto merge of #37445 - nnethercote:shrink-Expr_, r=eddyb
bors [Sun, 30 Oct 2016 17:12:20 +0000 (10:12 -0700)]
Auto merge of #37445 - nnethercote:shrink-Expr_, r=eddyb

Shrink Expr_::ExprInlineAsm.

On 64-bit this reduces the size of `Expr_` from 144 to 64 bytes, and
reduces the size of `Expr` from 176 to 96 bytes.

For the workload in #36799 this reduces the RSS for the "lowering ast -> hir" phase and all subsequent phases by 50 MiB, which reduces the peak RSS for that workload by about 1%. Not huge, but it's a very easy improvement.

r? @eddyb

7 years agoFix typo in the BitAndAssign operator documentation
msiglreith [Sun, 30 Oct 2016 16:50:28 +0000 (17:50 +0100)]
Fix typo in the BitAndAssign operator documentation

7 years agoDon't mention "*" dependency version in guessing game example
Konrad Borowski [Sun, 30 Oct 2016 14:24:13 +0000 (15:24 +0100)]
Don't mention "*" dependency version in guessing game example

It's a bad practice as far [RFC 1241] is concerned, and introducing it
in early tutorial may as well make it feel legitimate.

[RFC 1241]: https://github.com/rust-lang/rfcs/blob/master/text/1241-no-wildcard-deps.md

7 years agoFix ICE when attempting to get closure generics.
Mark-Simulacrum [Fri, 28 Oct 2016 22:26:47 +0000 (16:26 -0600)]
Fix ICE when attempting to get closure generics.

7 years agoAuto merge of #37431 - jseyfried:refactor_crate_config, r=eddyb
bors [Sun, 30 Oct 2016 13:51:30 +0000 (06:51 -0700)]
Auto merge of #37431 - jseyfried:refactor_crate_config, r=eddyb

Move `CrateConfig` from `Crate` to `ParseSess`

This is a syntax-[breaking-change]. Most breakage can be fixed by removing a `CrateConfig` argument.
r? @eddyb

7 years agoUpdate "Testing" chapter for 1.12
Pieter Frenssen [Sun, 30 Oct 2016 13:42:31 +0000 (15:42 +0200)]
Update "Testing" chapter for 1.12

I followed the "Testing" chapter using Rust 1.12.1 but there are some differences. By default the `tests` module is now also generated by `cargo new`, and the console output is updated.

7 years agorun rustfmt on librustc_driver folder
Srinivas Reddy Thatiparthy [Thu, 20 Oct 2016 01:38:43 +0000 (07:08 +0530)]
run rustfmt on librustc_driver folder

7 years agoAuto merge of #37392 - alexcrichton:more-disable-jemalloc, r=brson
bors [Sun, 30 Oct 2016 10:31:00 +0000 (03:31 -0700)]
Auto merge of #37392 - alexcrichton:more-disable-jemalloc, r=brson

Disable jemalloc on aarch64/powerpc

Sounds like jemalloc is broken on systems which differ in page size than the
host it was compiled on (unless an option was passed). This unfortunately
reduces the portability of binaries created and can often make Rust segfault by
default. For now let's patch over this by disabling jemalloc until we can figure
out a better solution.

Closes #36994
Closes #37320
cc jemalloc/jemalloc#467

7 years agoAuto merge of #37401 - eddyb:lazy-2, r=nikomatsakis
bors [Sun, 30 Oct 2016 07:01:21 +0000 (00:01 -0700)]
Auto merge of #37401 - eddyb:lazy-2, r=nikomatsakis

[2/n] rustc_metadata: move is_extern_item to trans.

*This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37400) | [next](https://github.com/rust-lang/rust/pull/37402)) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well.
If any motivation is unclear, please ask for additional PR description clarifications or code comments.*
<hr>

Minor cleanup missed by #36551: `is_extern_item` is one of, if not the only `CrateStore` method who takes a `TyCtxt` but doesn't produce something cached in it, and such methods are going away.

7 years agoAuto merge of #37400 - eddyb:lazy-1, r=nikomatsakis
bors [Sun, 30 Oct 2016 03:46:20 +0000 (20:46 -0700)]
Auto merge of #37400 - eddyb:lazy-1, r=nikomatsakis

[1/n] Move the MIR map into the type context.

*This is part of a series ([prev]() | [next](https://github.com/rust-lang/rust/pull/37401)) of patches designed to rework rustc into an out-of-order on-demand pipeline model for both better feature support (e.g. [MIR-based](https://github.com/solson/miri) early constant evaluation) and incremental execution of compiler passes (e.g. type-checking), with beneficial consequences to IDE support as well.
If any motivation is unclear, please ask for additional PR description clarifications or code comments.*
<hr>

The first commit reorganizes the `rustc::mir` module to contain the MIR types directly without an extraneous `repr` module which serves no practical purpose but is rather an eyesore.

The second commit performs the actual move of the MIR map into the type context, for the purposes of future integration with requesting analysis/lowering by-products through `TyCtxt`.

Local `Mir` bodies need to be mutated by passes (hence `RefCell`), and at least one pass (`qualify_consts`) needs simultaneous access to multiple `Mir` bodies (hence arena-allocation).
`Mir` bodies loaded from other crates appear as if immutably borrowed (by `.borrow()`-ing one `Ref` and subsequently "leaking" it) to avoid, at least dynamically, *any* possibility of their local mutation.

One caveat is that lint passes can now snoop at the MIR (helpful) or even mutate it (dangerous).
However, lints are unstable anyway and we can find a way to deal with this in due time.
Future work will result in a tighter API, potentially hiding mutation *completely* outside of MIR passes.

7 years agoAuto merge of #37399 - retep998:heap-of-trouble, r=alexcrichton
bors [Sun, 30 Oct 2016 00:28:07 +0000 (17:28 -0700)]
Auto merge of #37399 - retep998:heap-of-trouble, r=alexcrichton

Print out the error when HeapFree failures do occur

cc https://github.com/rust-lang/rust/issues/37395

I'd prefer to use `assert!` instead of `debug_assert!` if the cost is acceptable.

r? @alexcrichton

7 years agoAuto merge of #37389 - cramertj:cramertj/fn-item-to-unsafe-ptr, r=eddyb
bors [Sat, 29 Oct 2016 19:08:38 +0000 (12:08 -0700)]
Auto merge of #37389 - cramertj:cramertj/fn-item-to-unsafe-ptr, r=eddyb

rustc_typeck: Allow reification from fn item to unsafe ptr

See https://github.com/rust-lang/rfcs/issues/1762.

I've never contributed to the compiler internals before-- apologies if I'm not going about this the right way.

7 years agoLLVM: Update submodule to rust-llvm-2016-10-29 branch.
Vadzim Dambrouski [Sat, 29 Oct 2016 15:56:20 +0000 (18:56 +0300)]
LLVM: Update submodule to rust-llvm-2016-10-29 branch.

7 years agoAuto merge of #37449 - pnkfelix:fix-issue-37274, r=eddyb
bors [Sat, 29 Oct 2016 15:54:30 +0000 (08:54 -0700)]
Auto merge of #37449 - pnkfelix:fix-issue-37274, r=eddyb

Do not intern filemap to entry w/ mismatched length.

Do not intern filemap to entry w/ mismatched length.

Fix #37274 (I think).

Beta-nominated; note that only the second commit needs to be cherry picked to beta branch. (The first just adds some debug instrumentation that I wish had been present.)

7 years agoAuto merge of #37378 - petrochenkov:nopat, r=eddyb
bors [Sat, 29 Oct 2016 12:41:05 +0000 (05:41 -0700)]
Auto merge of #37378 - petrochenkov:nopat, r=eddyb

Prohibit patterns in trait methods without bodies

They are not properly type checked
```rust
trait Tr {
    fn f(&a: u8); // <- This compiles
}
```
, mostly rejected by the parser already and generally don't make much sense.
This PR is kind of a missing part of https://github.com/rust-lang/rust/pull/35015.

Given the [statistics from crater](https://github.com/rust-lang/rust/pull/37378#issuecomment-256154994), the effect of this PR is mostly equivalent to improving `unused_mut` lint.

cc https://github.com/rust-lang/rust/issues/35078#issuecomment-255707355 https://github.com/rust-lang/rust/pull/35015 https://github.com/rust-lang/rfcs/pull/1685 https://github.com/rust-lang/rust/issues/35203
r? @eddyb

7 years agoUpdate cargo sha for cargotest
Vadim Petrochenkov [Wed, 14 Sep 2016 21:51:46 +0000 (00:51 +0300)]
Update cargo sha for cargotest

7 years agoMove `CrateConfig` from `Crate` to `ParseSess`.
Jeffrey Seyfried [Thu, 27 Oct 2016 06:36:56 +0000 (06:36 +0000)]
Move `CrateConfig` from `Crate` to `ParseSess`.

7 years agoAuto merge of #37387 - raphlinus:fuchsia_aarch64, r=alexcrichton
bors [Sat, 29 Oct 2016 07:28:39 +0000 (00:28 -0700)]
Auto merge of #37387 - raphlinus:fuchsia_aarch64, r=alexcrichton

Support for aarch64 architecture on Fuchsia

This patch adds support for the aarch64-unknown-fuchsia target. Also
updates src/liblibc submodule to include required libc change.

7 years agoAuto merge of #37385 - raphlinus:fuchsia_random, r=alexcrichton
bors [Sat, 29 Oct 2016 04:31:26 +0000 (21:31 -0700)]
Auto merge of #37385 - raphlinus:fuchsia_random, r=alexcrichton

Add support for kernel randomness for Fuchsia

Wire up cprng syscall as provider for rand::os::OsRng on Fuchsia.

7 years agoRemove outdated fixme comment.
Mark-Simulacrum [Sat, 29 Oct 2016 01:35:30 +0000 (19:35 -0600)]
Remove outdated fixme comment.

7 years agoAuto merge of #37373 - nnethercote:html5ever-more-more, r=nrc
bors [Sat, 29 Oct 2016 00:02:01 +0000 (17:02 -0700)]
Auto merge of #37373 - nnethercote:html5ever-more-more, r=nrc

Avoid more allocations when compiling html5ever

These three commits reduce the number of allocations performed when compiling html5ever from 13.2M to 10.8M, which speeds up compilation by about 2%.

r? @nrc

7 years agosave-analysis: change imports to carry a ref id rather than their own node id
Nick Cameron [Fri, 28 Oct 2016 22:24:37 +0000 (08:24 +1000)]
save-analysis: change imports to carry a ref id rather than their own node id

7 years agoFix more spans in deriving::generic
Nick Cameron [Fri, 28 Oct 2016 22:18:30 +0000 (11:18 +1300)]
Fix more spans in deriving::generic

7 years agoAuto merge of #37367 - jseyfried:import_crate_root, r=nrc
bors [Fri, 28 Oct 2016 20:42:23 +0000 (13:42 -0700)]
Auto merge of #37367 - jseyfried:import_crate_root, r=nrc

Support `use *;` and `use ::*;`.

Fixes #31484.
r? @nrc

7 years agoAuto merge of #37450 - GuillaumeGomez:rollup, r=GuillaumeGomez
bors [Fri, 28 Oct 2016 17:20:55 +0000 (10:20 -0700)]
Auto merge of #37450 - GuillaumeGomez:rollup, r=GuillaumeGomez

Rollup of 5 pull requests

- Successful merges: #36206, #37343, #37430, #37436, #37441
- Failed merges:

7 years agoimprove docs for Index and IndexMut
Cobrand [Thu, 27 Oct 2016 23:42:47 +0000 (01:42 +0200)]
improve docs for Index and IndexMut

7 years agoDo not intern filemap to entry w/ mismatched length. Fix #37274 (I think).
Felix S. Klock II [Fri, 28 Oct 2016 15:12:54 +0000 (17:12 +0200)]
Do not intern filemap to entry w/ mismatched length. Fix #37274 (I think).

7 years agoDebug instrumentation for construction of ImportedFileMap table entries.
Felix S. Klock II [Fri, 28 Oct 2016 15:10:34 +0000 (17:10 +0200)]
Debug instrumentation for construction of ImportedFileMap table entries.

7 years agoRollup merge of #37441 - federicomenaquintero:master, r=steveklabnik
Guillaume Gomez [Fri, 28 Oct 2016 15:05:48 +0000 (17:05 +0200)]
Rollup merge of #37441 - federicomenaquintero:master, r=steveklabnik

reference: Mention --crate-type=cdylib in the Linkage section

This option is missing in the docs! :)

7 years agoRollup merge of #37436 - nrc:save-span-errs, r=petrochenkov
Guillaume Gomez [Fri, 28 Oct 2016 15:05:48 +0000 (17:05 +0200)]
Rollup merge of #37436 - nrc:save-span-errs, r=petrochenkov

Give variant spans used in derives the correct expansion id

This fixes a problem in save-analysis where it mistakes a path to a variant as the variant itself.

r? @petrochenkov

7 years agoRollup merge of #37430 - robinst:missing-crate-message-add-semicolon, r=eddyb
Guillaume Gomez [Fri, 28 Oct 2016 15:05:47 +0000 (17:05 +0200)]
Rollup merge of #37430 - robinst:missing-crate-message-add-semicolon, r=eddyb

Add semicolon to "Maybe a missing `extern crate foo`" message

I had it a couple of times that I was missing the "extern crate" line
after I introduced a new dependency. So I copied the text from the
message and inserted it into the beginning of my code, only to find the
compiler complaining that I was missing the semicolon. (I forgot to add
it after the text that I had pasted.)

There's a similar message which does include the semicolon, namely
"help: you can import it into scope: `use foo::Bar;`". I think the two
messages should be consistent, so this change adds it for "extern
crate".

7 years agoRollup merge of #37343 - bluss:write-doc, r=GuillaumeGomez
Guillaume Gomez [Fri, 28 Oct 2016 15:05:47 +0000 (17:05 +0200)]
Rollup merge of #37343 - bluss:write-doc, r=GuillaumeGomez

Add documentation for Read, Write impls for slices and Vec

The Write imps for &[u8] and Vec<u8> are quite different, and we need this to
be reflected in the docs.

These documentation comments will be visible on the respective type's
page in the trait impls section.

7 years agoRollup merge of #36206 - mcarton:35755, r=pnkfelix
Guillaume Gomez [Fri, 28 Oct 2016 15:05:47 +0000 (17:05 +0200)]
Rollup merge of #36206 - mcarton:35755, r=pnkfelix

Fix bad error message with `::<` in types

Fix #36116.

Before:
```rust
error: expected identifier, found `<`
  --> src/test/compile-fail/issue-36116.rs:16:52
   |
16 |     let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>);
   |                                                    ^

error: chained comparison operators require parentheses
  --> src/test/compile-fail/issue-36116.rs:16:52
   |
16 |     let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>);
   |                                                    ^^^^^^
   |
   = help: use `::<...>` instead of `<...>` if you meant to specify type arguments

error: expected expression, found `)`
  --> src/test/compile-fail/issue-36116.rs:16:57
   |
16 |     let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>);
   |                                                         ^

error: expected identifier, found `<`
  --> src/test/compile-fail/issue-36116.rs:20:17
   |
20 |     let g: Foo::<i32> = Foo { _a: 42 };
   |                 ^

error: aborting due to 5 previous errors
```

After:
```rust
error: unexpected token: `::`
  --> src/test/compile-fail/issue-36116.rs:16:50
   |
16 |     let f = Some(Foo { _a: 42 }).map(|a| a as Foo::<i32>);
   |                                                  ^^
   |
   = help: use `<...>` instead of `::<...>` if you meant to specify type arguments

error: unexpected token: `::`
  --> src/test/compile-fail/issue-36116.rs:20:15
   |
20 |     let g: Foo::<i32> = Foo { _a: 42 };
   |               ^^
   |
   = help: use `<...>` instead of `::<...>` if you meant to specify type arguments

error: aborting due to 2 previous errors
```

7 years agoAuto merge of #37196 - tamird:fix-tidy-features, r=brson
bors [Fri, 28 Oct 2016 14:01:17 +0000 (07:01 -0700)]
Auto merge of #37196 - tamird:fix-tidy-features, r=brson

tidy/features: fix checking of lang features

r? @brson

See the commit messages - the actual "fixes" here are strawmen; I'm happy to adjust them if you have suggestions.

7 years agorustc: move the MIR map into TyCtxt.
Eduard Burtescu [Fri, 28 Oct 2016 10:55:49 +0000 (13:55 +0300)]
rustc: move the MIR map into TyCtxt.

7 years agoFix bad error message with `::<` in types
mcarton [Thu, 1 Sep 2016 23:58:44 +0000 (01:58 +0200)]
Fix bad error message with `::<` in types

7 years agoAuto merge of #37321 - nrc:lib-proc-macro, r=@alexcrichton
bors [Fri, 28 Oct 2016 10:11:56 +0000 (03:11 -0700)]
Auto merge of #37321 - nrc:lib-proc-macro, r=@alexcrichton

Split up libproc_macro_plugin

Separate the plugin code from non-plugin code to break a potential cycle in crates.

This will allow us to merge the new libproc_macro_tokens into libproc_macro.

r? @alexcrichton

7 years agorustc: move mir::repr::* to mir.
Eduard Burtescu [Mon, 19 Sep 2016 20:50:00 +0000 (23:50 +0300)]
rustc: move mir::repr::* to mir.

7 years agoAuto merge of #37212 - srinivasreddy:libcollectionstest, r=nrc
bors [Fri, 28 Oct 2016 05:02:31 +0000 (22:02 -0700)]
Auto merge of #37212 - srinivasreddy:libcollectionstest, r=nrc

run rustfmt on libcollectionstest

7 years agoShrink Expr_::ExprInlineAsm.
Nicholas Nethercote [Fri, 28 Oct 2016 03:47:55 +0000 (14:47 +1100)]
Shrink Expr_::ExprInlineAsm.

On 64-bit this reduces the size of `Expr_` from 144 to 64 bytes, and
reduces the size of `Expr` from 176 to 96 bytes.

7 years agotidy/features: fix checking of lang features
Tamir Duberstein [Fri, 14 Oct 2016 22:14:29 +0000 (18:14 -0400)]
tidy/features: fix checking of lang features

Removes the `STATUSES` static which duplicates truth from the pattern
match in `collect_lang_features`.

Fixes existing duplicates by renaming:
- never_type{,_impls} on `impl`s on `!`
- concat_idents{,_macro} on `macro_rules! concat_idents`

Fixes #37013.

7 years agotidy/bins: fix false positive on non checked-in binary
Tamir Duberstein [Sat, 15 Oct 2016 20:17:23 +0000 (16:17 -0400)]
tidy/bins: fix false positive on non checked-in binary

`git ls-files` now exits zero when called with a missing file; check
that the file is included in the output before reporting a checked-in
binary. Observed with git 2.10.1 and tripped by a symlink created by
tests:

src/test/run-make/issue-26006/out/time/deps/liblibc.rlib -> out/libc/liblibc.rlib

7 years agoreference: Mention --crate-type=cdylib in the Linkage section
Federico Mena Quintero [Fri, 28 Oct 2016 01:23:23 +0000 (20:23 -0500)]
reference: Mention --crate-type=cdylib in the Linkage section

7 years agoAuto merge of #37035 - petrochenkov:selfstruct, r=eddyb
bors [Fri, 28 Oct 2016 01:18:56 +0000 (18:18 -0700)]
Auto merge of #37035 - petrochenkov:selfstruct, r=eddyb

Support `Self` in struct expressions and patterns

Struct expressions and patterns generally support type aliases `Alias { field: 10 }` i.e. they already have to work with `ty::Ty` to do their job. `Self` is a type alias (when it's not a type parameter) => struct expressions and patterns should support `Self`.

Typical example:
```
impl MyStruct {
    fn new() -> Self {
        Self { a: 10, b: "Hello" }
    }
}
```

The first commit does some preparations and cleanups, see the commit message for  details.
This also fixes couple of bugs related to aliases in struct paths (fixes https://github.com/rust-lang/rust/issues/36286).

EDIT:
Since struct expressions and patterns always work with `ty::Ty` now, associated paths in them are also supported. If associated type `A::B` successfully resolves to a struct (or union) type, then `A::B { /* fields */ }` is a valid expression/pattern. This will become more important when enum variants are treated as [associated items](https://github.com/rust-lang/rust/issues/26264#issuecomment-250603946).

r? @eddyb

7 years agoSplit up libproc_macro_plugin
Nick Cameron [Fri, 21 Oct 2016 07:55:39 +0000 (20:55 +1300)]
Split up libproc_macro_plugin

Separate the plugin code from non-plugin code to break a potential cycle in crates.

This will allow us to merge the new libproc_macro_tokens into libproc_macro.

7 years agoGive variant spans used in derives the correct expansion id
Nick Cameron [Thu, 27 Oct 2016 21:49:45 +0000 (10:49 +1300)]
Give variant spans used in derives the correct expansion id

This fixes a problem in save-analysis where it mistakes a path to a variant as the variant itself.

7 years agoRename ordering chaining functions.
Marcin Fatyga [Thu, 27 Oct 2016 21:31:10 +0000 (23:31 +0200)]
Rename ordering chaining functions.

7 years agoAuto merge of #37350 - srinivasreddy:meta_2, r=nrc
bors [Thu, 27 Oct 2016 19:51:49 +0000 (12:51 -0700)]
Auto merge of #37350 - srinivasreddy:meta_2, r=nrc

run rustfmt on librustc_metadata folder

7 years agoAddress comments + Fix rebase
Vadim Petrochenkov [Wed, 14 Sep 2016 21:51:46 +0000 (00:51 +0300)]
Address comments + Fix rebase

7 years agoSupport `Self` in struct expressions and patterns
Vadim Petrochenkov [Wed, 14 Sep 2016 21:51:46 +0000 (00:51 +0300)]
Support `Self` in struct expressions and patterns

7 years agoPreparations and cleanup
Vadim Petrochenkov [Wed, 14 Sep 2016 21:51:46 +0000 (00:51 +0300)]
Preparations and cleanup

Diagnostics for struct path resolution errors in resolve and typeck are unified.
Self type is treated as a type alias in few places (not reachable yet).
Unsafe cell is seen in constants even through type aliases.
All checks for struct paths in typeck work on type level.

7 years agoDisable jemalloc on aarch64/powerpc
Alex Crichton [Tue, 25 Oct 2016 02:33:28 +0000 (19:33 -0700)]
Disable jemalloc on aarch64/powerpc

Sounds like jemalloc is broken on systems which differ in page size than the
host it was compiled on (unless an option was passed). This unfortunately
reduces the portability of binaries created and can often make Rust segfault by
default. For now let's patch over this by disabling jemalloc until we can figure
out a better solution.

Closes #36994
Closes #37320
cc jemalloc/jemalloc#467

7 years agoAuto merge of #37245 - goffrie:recovery, r=nrc
bors [Thu, 27 Oct 2016 14:19:16 +0000 (07:19 -0700)]
Auto merge of #37245 - goffrie:recovery, r=nrc

Recover out of an enum or struct's braced block.

If we encounter a syntax error inside of a braced block, then we should
fail by consuming the rest of the block if possible.
This implements such recovery for enums and structs.

Fixes #37113.

7 years agoAdd documentation for Read, Write impls for slices and Vec
Ulrik Sverdrup [Sat, 22 Oct 2016 10:50:00 +0000 (12:50 +0200)]
Add documentation for Read, Write impls for slices and Vec

The Write impls for &[u8] and Vec<u8> are quite different, and we need this to
be reflected in the docs.

These documentation comments will be visible on the respective type's
page in the trait impls section.

7 years agoAuto merge of #36894 - petrochenkov:deny, r=nikomatsakis
bors [Thu, 27 Oct 2016 11:06:31 +0000 (04:06 -0700)]
Auto merge of #36894 - petrochenkov:deny, r=nikomatsakis

Make sufficiently old or low-impact compatibility lints deny-by-default

Tracking issues are updated/created when necessary.
Needs crater run before proceeding.

r? @nikomatsakis

7 years agoMake sufficiently old or low-impact compatibility lints deny-by-default
Vadim Petrochenkov [Wed, 14 Sep 2016 21:51:46 +0000 (00:51 +0300)]
Make sufficiently old or low-impact compatibility lints deny-by-default

7 years agoAuto merge of #37128 - nrc:depr-attr, r=@alexcrichton
bors [Thu, 27 Oct 2016 07:51:58 +0000 (00:51 -0700)]
Auto merge of #37128 - nrc:depr-attr, r=@alexcrichton

Deprecate no_debug and custom_derive

r? @nikomatsakis

7 years agodeduplicate one-time diagnostics on lint ID as well as span and message
Zack M. Davis [Thu, 27 Oct 2016 06:07:38 +0000 (23:07 -0700)]
deduplicate one-time diagnostics on lint ID as well as span and message

Some lint-level attributes (like `bad-style`, or, more dramatically,
`warnings`) can affect more than one lint; it seems fairer to point out
the attribute once for each distinct lint affected. Also, a UI test is
added. This remains in the matter of #24690.

7 years agoone-time diagnostics are only one-time for humans, not JSON-eating tools
Zack M. Davis [Thu, 27 Oct 2016 04:03:18 +0000 (21:03 -0700)]
one-time diagnostics are only one-time for humans, not JSON-eating tools

Jonathan D. Turner pointed out that we don't want to dedup in JSON
mode. Since the compile-test runner uses JSON output, we regrettably
need to revert the edits to existing tests; one imagines that testing
for one-time diagnosticity for humans will have to be added as a UI
test.

This remains in the matter of #24690.

7 years agoAuto merge of #11994 - eddyb:struct-literal-field-shorthand, r=nrc
bors [Thu, 27 Oct 2016 04:47:25 +0000 (21:47 -0700)]
Auto merge of #11994 - eddyb:struct-literal-field-shorthand, r=nrc

Implement field shorthands in struct literal expressions.

Implements #37340 in a straight-forward way: `Foo { x, y: f() }` parses as `Foo { x: x, y: f() }`.
Because of the added `is_shorthand` to `ast::Field`, this is `[syntax-breaking]` (cc @Manishearth).

* [x] Mark the fields as being a shorthand (the exact same way we do it in patterns), for pretty-printing.
* [x] Gate the shorthand syntax with `#![feature(field_init_shorthand)]`.
* [x] Don't parse numeric field as identifiers.
* [x] Arbitrary field order tests.

7 years agoAdd semicolon to "Maybe a missing `extern crate foo`" message
Robin Stocker [Thu, 27 Oct 2016 04:24:08 +0000 (15:24 +1100)]
Add semicolon to "Maybe a missing `extern crate foo`" message

I had it a couple of times that I was missing the "extern crate" line
after I introduced a new dependency. So I copied the text from the
message and inserted it into the beginning of my code, only to find the
compiler complaining that I was missing the semicolon. (I forgot to add
it after the text that I had pasted.)

There's a similar message which does include the semicolon, namely
"help: you can import it into scope: `use foo::Bar;`". I think the two
messages should be consistent, so this change adds it for "extern
crate".