]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoRollup merge of #37250 - liigo:rustdoc-unsafe-fns, r=steveklabnik
Eduard-Mihai Burtescu [Wed, 9 Nov 2016 18:51:15 +0000 (20:51 +0200)]
Rollup merge of #37250 - liigo:rustdoc-unsafe-fns, r=steveklabnik

rustdoc: mark unsafe fns in module page with superscript icons

Note: I'v changed the mark style. Now use superscript ⚠(U+26A0) (the old one is '[Unsafe]' literal).
Basically per https://botbot.me/mozilla/rust-docs/2016-10-19/?msg=75112017&page=1

![unsafe-fn-icon](https://cloud.githubusercontent.com/assets/346530/19633650/7f6e1eea-99e6-11e6-8d09-31aec83e46a5.png)

![unsafe-fn](https://cloud.githubusercontent.com/assets/346530/19472050/39daded2-9558-11e6-9148-3cb12afd1c9a.png)

7 years agoRollup merge of #37229 - nnethercote:FxHasher, r=nikomatsakis
Eduard-Mihai Burtescu [Wed, 9 Nov 2016 18:51:15 +0000 (20:51 +0200)]
Rollup merge of #37229 - nnethercote:FxHasher, r=nikomatsakis

Replace FNV with a faster hash function.

Hash table lookups are very hot in rustc profiles and the time taken within `FnvHash` itself is a big part of that. Although FNV is a simple hash, it processes its input one byte at a time. In contrast, Firefox has a homespun hash function that is also simple but works on multiple bytes at a time. So I tried it out and the results are compelling:

```
futures-rs-test  4.326s vs  4.212s --> 1.027x faster (variance: 1.001x, 1.007x)
helloworld       0.233s vs  0.232s --> 1.004x faster (variance: 1.037x, 1.016x)
html5ever-2016-  5.397s vs  5.210s --> 1.036x faster (variance: 1.009x, 1.006x)
hyper.0.5.0      5.018s vs  4.905s --> 1.023x faster (variance: 1.007x, 1.006x)
inflate-0.1.0    4.889s vs  4.872s --> 1.004x faster (variance: 1.012x, 1.007x)
issue-32062-equ  0.347s vs  0.335s --> 1.035x faster (variance: 1.033x, 1.019x)
issue-32278-big  1.717s vs  1.622s --> 1.059x faster (variance: 1.027x, 1.028x)
jld-day15-parse  1.537s vs  1.459s --> 1.054x faster (variance: 1.005x, 1.003x)
piston-image-0. 11.863s vs 11.482s --> 1.033x faster (variance: 1.060x, 1.002x)
regex.0.1.30     2.517s vs  2.453s --> 1.026x faster (variance: 1.011x, 1.013x)
rust-encoding-0  2.080s vs  2.047s --> 1.016x faster (variance: 1.005x, 1.005x)
syntex-0.42.2   32.268s vs 31.275s --> 1.032x faster (variance: 1.014x, 1.022x)
syntex-0.42.2-i 17.629s vs 16.559s --> 1.065x faster (variance: 1.013x, 1.021x)
```

(That's a stage1 compiler doing debug builds. Results for a stage2 compiler are similar.)

The attached commit is not in a state suitable for landing because I changed the implementation of FnvHasher without changing its name (because that would have required touching many lines in the compiler). Nonetheless, it is a good place to start discussions.

Profiles show very clearly that this new hash function is a lot faster to compute than FNV. The quality of the new hash function is less clear -- it seems to do better in some cases and worse in others (judging by the number of instructions executed in `Hash{Map,Set}::get`).

CC @brson, @arthurprs

7 years agoRollup merge of #37134 - GuillaumeGomez:display_tag, r=steveklabnik
Eduard-Mihai Burtescu [Wed, 9 Nov 2016 18:51:15 +0000 (20:51 +0200)]
Rollup merge of #37134 - GuillaumeGomez:display_tag, r=steveklabnik

Print more tags in rustdoc

r? @steveklabnik

cc @frewsxcv

A little screenshot:

<img width="1440" alt="screen shot 2016-10-13 at 01 41 53" src="https://cloud.githubusercontent.com/assets/3050060/19331745/873cd71e-90e6-11e6-88f8-715668366a3f.png">

7 years agoRollup merge of #36868 - petrochenkov:adtstab, r=nikomatsakis
Eduard-Mihai Burtescu [Wed, 9 Nov 2016 18:51:15 +0000 (20:51 +0200)]
Rollup merge of #36868 - petrochenkov:adtstab, r=nikomatsakis

Partially stabilize RFC 1506 "Clarify relationships between ADTs"

Lifted restrictions on tuple structs/variants are stabilized, i.e. `S{..}` can be used with any structs and empty tuple structs are permitted without feature gate.
Numeric fields in struct expressions/patterns `S { 0: a, 1: b }` are **NOT** stabilized.
This was implemented 1.5 months ago in Rust 1.12, but this is a tiny technical change that could probably go even without RFC/stabilization period.

cc https://github.com/rust-lang/rust/issues/35626 https://github.com/rust-lang/rust/pull/36871
r? @nikomatsakis

7 years agoAuto merge of #37657 - steveklabnik:rollup, r=steveklabnik
bors [Wed, 9 Nov 2016 13:35:23 +0000 (05:35 -0800)]
Auto merge of #37657 - steveklabnik:rollup, r=steveklabnik

Rollup of 8 pull requests

- Successful merges: #35102, #37425, #37483, #37588, #37601, #37610, #37650, #37652
- Failed merges:

7 years agoAuto merge of #37651 - alexcrichton:fix-deps, r=alexcrichton
bors [Wed, 9 Nov 2016 09:15:20 +0000 (01:15 -0800)]
Auto merge of #37651 - alexcrichton:fix-deps, r=alexcrichton

rustbuild: Fix dependencies of check-error-index

This depends on the error index actually existing rather than just the tool to
generate the error index.

7 years agorustbuild: Fix check-error-index step
Alex Crichton [Tue, 8 Nov 2016 17:59:46 +0000 (09:59 -0800)]
rustbuild: Fix check-error-index step

If it ran too soon there wasn't a `test` directory lying around but we'll need
one!

7 years agoRollup merge of #37652 - SimonSapin:arc-count-doc, r=alexcrichton
Steve Klabnik [Tue, 8 Nov 2016 21:20:58 +0000 (16:20 -0500)]
Rollup merge of #37652 - SimonSapin:arc-count-doc, r=alexcrichton

More proeminent warning in Arc::{strong,weak}_count docs.

CC https://github.com/rust-lang/rust/issues/28356#issuecomment-259212258

7 years agoRollup merge of #37650 - GuillaumeGomez:missing_urls_product, r=steveklabnik
Steve Klabnik [Tue, 8 Nov 2016 21:20:57 +0000 (16:20 -0500)]
Rollup merge of #37650 - GuillaumeGomez:missing_urls_product, r=steveklabnik

Add missing urls for Sum and Product traits

r? @steveklabnik

7 years agoRollup merge of #37610 - oldmanmike:unary-and-binary-tests, r=michaelwoerister
Steve Klabnik [Tue, 8 Nov 2016 21:20:57 +0000 (16:20 -0500)]
Rollup merge of #37610 - oldmanmike:unary-and-binary-tests, r=michaelwoerister

Add unary and binary tests for incr-comp

This is my draft of tests for unary and binary expressions as desired by #37520 for use in the test suite for hashes in incremental compilation. Feedback would be wonderful, if there's any changes I need to make I would appreciate the code review.

?r @michaelwoerister

7 years agoRollup merge of #37601 - brson:book-without-tiers, r=steveklabnik
Steve Klabnik [Tue, 8 Nov 2016 21:20:57 +0000 (16:20 -0500)]
Rollup merge of #37601 - brson:book-without-tiers, r=steveklabnik

book: Removed platform compatibility table, link to the forge

The content is duplicated, and it doesn't need to be in this location.
It's mostly trivia that doesn't apply to most of the audience.

The forge is up to date.

r? @steveklabnik cc @alexcrichton

7 years agoRollup merge of #37588 - GuillaumeGomez:missing_io_urls, r=frewsxcv
Steve Klabnik [Tue, 8 Nov 2016 21:20:57 +0000 (16:20 -0500)]
Rollup merge of #37588 - GuillaumeGomez:missing_io_urls, r=frewsxcv

Add missing urls on io structs

r? @steveklabnik

7 years agoRollup merge of #37483 - xfix:patch-1, r=steveklabnik
Steve Klabnik [Tue, 8 Nov 2016 21:20:56 +0000 (16:20 -0500)]
Rollup merge of #37483 - xfix:patch-1, r=steveklabnik

Match guessing game output to newest language version

Cargo now informs that it has finished, and there is new error format.

7 years agoRollup merge of #37425 - polo-language:doc, r=GuillaumeGomez
Steve Klabnik [Tue, 8 Nov 2016 21:20:56 +0000 (16:20 -0500)]
Rollup merge of #37425 - polo-language:doc, r=GuillaumeGomez

Add error note to illegal code snippet

Mark intentionally invalid code snippet in documentation as such with a comment. Similar comments used elsewhere in this file.

r? @steveklabnik

7 years agoRollup merge of #35102 - steveklabnik:ref_warning, r=aturon
Steve Klabnik [Tue, 8 Nov 2016 21:20:56 +0000 (16:20 -0500)]
Rollup merge of #35102 - steveklabnik:ref_warning, r=aturon

Make it clear that the reference isn't normative

Any time someone edits the reference, it has to be taken very seriously,
since it's the closest thing we have to a specification. This commit
adds language which indicates that this is not a normative document,
which makes it easier to make tweaks without worrying about forever
harming the future of Rust by painting ourselves in a corner.

r? @aturon

7 years agoAuto merge of #37192 - cristicbz:rust-rc-into-raw, r=brson
bors [Tue, 8 Nov 2016 20:13:45 +0000 (12:13 -0800)]
Auto merge of #37192 - cristicbz:rust-rc-into-raw, r=brson

Add `{into,from}_raw` to Rc and Arc

These methods convert to and from a `*const T` for `Rc` and `Arc` similar to the way they work on `Box`. The only slight complication is that `from_raw` needs to offset the pointer back to find the beginning of the `RcBox`/`ArcInner`.

I felt this is a fairly small addition, filling in a gap (when compared to `Box`) so it wouldn't need an RFC. The motivation is primarily for FFI.

(I'll create an issue and update a PR with the issue number if reviewers agree with the change in principle **Edit: done #37197**)

~~Edit: This was initially `{into,from}_raw` but concerns were raised about the possible footgun if mixed with the methods of the same name of `Box`.~~

Edit: This was went from `{into,from}_raw` to `{into,from}_inner_raw` then back to `{into,from}_raw` during review.

7 years agoPartially stabilize RFC 1506 "Clarify relationships between ADTs"
Vadim Petrochenkov [Wed, 14 Sep 2016 21:51:46 +0000 (00:51 +0300)]
Partially stabilize RFC 1506 "Clarify relationships between ADTs"

7 years agoMore proeminent warning in Arc::{strong,weak}_count docs.
Simon Sapin [Tue, 8 Nov 2016 19:15:20 +0000 (20:15 +0100)]
More proeminent warning in Arc::{strong,weak}_count docs.

7 years agoAdd missing urls for Sum and Product traits
Guillaume Gomez [Tue, 8 Nov 2016 17:33:04 +0000 (18:33 +0100)]
Add missing urls for Sum and Product traits

7 years agoAuto merge of #36843 - petrochenkov:dotstab, r=nikomatsakis
bors [Tue, 8 Nov 2016 10:06:45 +0000 (02:06 -0800)]
Auto merge of #36843 - petrochenkov:dotstab, r=nikomatsakis

Stabilize `..` in tuple (struct) patterns

I'd like to nominate `..` in tuple and tuple struct patterns for stabilization.
This feature is a relatively small extension to existing stable functionality and doesn't have known blockers.
The feature first appeared in Rust 1.10 6 months ago.
An example of use: https://github.com/rust-lang/rust/pull/36203

Closes https://github.com/rust-lang/rust/issues/33627
r? @nikomatsakis

7 years agoReplace FnvHasher use with FxHasher.
Nicholas Nethercote [Tue, 8 Nov 2016 03:02:55 +0000 (14:02 +1100)]
Replace FnvHasher use with FxHasher.

This speeds up compilation by 3--6% across most of rustc-benchmarks.

7 years agoAdd FxHasher, a faster alternative to FnvHasher.
Nicholas Nethercote [Tue, 8 Nov 2016 03:01:38 +0000 (14:01 +1100)]
Add FxHasher, a faster alternative to FnvHasher.

7 years agoAuto merge of #36365 - matthew-piziak:silent-overflow, r=eddyb
bors [Mon, 7 Nov 2016 19:48:16 +0000 (11:48 -0800)]
Auto merge of #36365 - matthew-piziak:silent-overflow, r=eddyb

fix silent overflows on `Step` impls

Part of https://github.com/rust-lang/rust/issues/36110

r? @eddyb

7 years agoFix typos and redundant code
oldmanmike [Mon, 7 Nov 2016 18:59:48 +0000 (13:59 -0500)]
Fix typos and redundant code

7 years agoApply changes recommended in code review
oldmanmike [Mon, 7 Nov 2016 17:42:20 +0000 (12:42 -0500)]
Apply changes recommended in code review

Said code review and recommendations can be found here:
https://github.com/rust-lang/rust/pull/37610

7 years agoAuto merge of #37625 - xen0n:rustbuild-mips, r=alexcrichton
bors [Mon, 7 Nov 2016 16:39:16 +0000 (08:39 -0800)]
Auto merge of #37625 - xen0n:rustbuild-mips, r=alexcrichton

rustbuild: support MIPS host builds

There is a *little* code duplication, but primarily for sake of "match exhaustiveness". Let's blame Linux/MIPS for not exposing endianness explicitly in `uname -m` (that's user-space interface and as such is frozen).

Currently the build won't work as we have to wait for a new stage0 for the MIPS host compilers, but this paves the way to self-hosted Rust on MIPS. The cross-compiled MIPS binaries are confirmed to work on the Loongson 3A2000 (MIPS64r2-compatible) so we have plenty of confidence that they'll work on other MIPS platforms too, as Linux/MIPS user-space ABI is consistent across machines of the same bitness.

r? @alexcrichton

7 years agoAuto merge of #37624 - xen0n:remove-bogus-mipsel-arches, r=alexcrichton
bors [Mon, 7 Nov 2016 12:14:00 +0000 (04:14 -0800)]
Auto merge of #37624 - xen0n:remove-bogus-mipsel-arches, r=alexcrichton

Remove mention of mipsel target_arch

This is the only remaining instance in rustc. All others were in the libc repo, removed with rust-lang/libc#445.

Actually there's more to clean in `libsyntax/abi.rs`, but let's save that for another commit...

7 years agoAuto merge of #37605 - dsprenkels:arc-max-refcount, r=alexcrichton
bors [Mon, 7 Nov 2016 07:05:58 +0000 (23:05 -0800)]
Auto merge of #37605 - dsprenkels:arc-max-refcount, r=alexcrichton

Fix Arc::clone()'s MAX_REFCOUNT check (off-by-one)

Before, the strong count of an `Arc` could be set to
`MAX_REFCOUNT + 1`, because when this happened, `old_size` would
be exactly `MAX_REFCOUNT`. `Arc::clone()` would not abort.

This commit changes the check in `Arc::clone()` to also abort if
the old value is equal to `MAX_REFCOUNT`, because then the new
value will be equal to `MAX_REFCOUNT + 1`.

A test would require allocating memory for `isize::MAX` pointers.
This would probably crash any machine, so no test is submitted
with this commit.

7 years agorustbuild: support MIPS host builds
Wang Xuerui [Mon, 7 Nov 2016 06:29:15 +0000 (14:29 +0800)]
rustbuild: support MIPS host builds

There is a *little* code duplication, but primarily for sake of "match
exhaustiveness". Let's blame Linux/MIPS for not exposing endianness
explicitly in `uname -m` (that's user-space interface and as such is
frozen).

Currently the build won't work as we have to wait for a new stage0 for
the MIPS host compilers, but this paves the way to self-hosted Rust on
MIPS. The cross-compiled MIPS binaries are confirmed to work on the
Loongson 3A2000 (MIPS64r2-compatible) so we have plenty of confidence
that they'll work on other MIPS platforms too, as Linux/MIPS user-space
ABI is consistent across machines of the same bitness.

7 years agoRemove mention of mipsel target_arch
Wang Xuerui [Mon, 7 Nov 2016 06:11:13 +0000 (14:11 +0800)]
Remove mention of mipsel target_arch

The `mipsel` `target_arch` was introduced with the initial MIPSel
support (rust-lang/rust@82ec1aef293ddc5c6373bd7f5ec323fafbdf7901),
but was subsequently removed with implementation of the Flexible Target
Specification (Rust RFC 0131,
rust-lang/rust@3a8f4ec32a80d372db2d02c76acba0276c4effd0).
This is the only remaining instance in rustc. All others are in the libc
repo, and are fixed in rust-lang/libc@b3676593f6930c32d947c59e210789bbfcb30960.

7 years agoAuto merge of #37506 - jseyfried:improve_shadowing_checks, r=nrc
bors [Mon, 7 Nov 2016 03:12:28 +0000 (19:12 -0800)]
Auto merge of #37506 - jseyfried:improve_shadowing_checks, r=nrc

macros: improve shadowing checks

This PR improves macro-expanded shadowing checks to work with out-of-(pre)order expansion.

Out-of-order expansion became possible in #37084, so this technically a [breaking-change] for nightly.
The regression test from this PR is an example of code that would break.

r? @nrc

7 years agoAuto merge of #37619 - TimNN:aarch64-fuchsia-abi-blacklist, r=alexcrichton
bors [Sun, 6 Nov 2016 23:59:45 +0000 (15:59 -0800)]
Auto merge of #37619 - TimNN:aarch64-fuchsia-abi-blacklist, r=alexcrichton

use arm abi blacklist for aarch64 fuchsia

r? @alexcrichton

7 years agoSet attributes hidden by default
Guillaume Gomez [Sun, 6 Nov 2016 20:06:20 +0000 (21:06 +0100)]
Set attributes hidden by default

7 years agoAuto merge of #37617 - pweyck:force-static-llvm-linking, r=alexcrichton
bors [Sun, 6 Nov 2016 20:47:14 +0000 (12:47 -0800)]
Auto merge of #37617 - pweyck:force-static-llvm-linking, r=alexcrichton

Force static linking of LLVM

Run `llvm-config` with `--link-static` if available, to force static linking of LLVM.
This option was added in LLVM 3.8.

This is my first pull request, any feedback is welcome!

Fixes #36854
See also: #36996

7 years agoImprove attributes display and allow expansion
Guillaume Gomez [Sun, 6 Nov 2016 20:03:08 +0000 (21:03 +0100)]
Improve attributes display and allow expansion

7 years agouse arm abi blacklist for aarch64 fuchsia
Tim Neumann [Sun, 6 Nov 2016 19:41:42 +0000 (20:41 +0100)]
use arm abi blacklist for aarch64 fuchsia

7 years agoAdd a comment to `Arc::MAX_REFCOUNT`
Daan Sprenkels [Fri, 4 Nov 2016 21:50:54 +0000 (22:50 +0100)]
Add a comment to `Arc::MAX_REFCOUNT`

The constant name `MAX_REFCOUNT` suggests that the value is a
_hard_ limit on the amount of references to an `Arc`. This is
a more soft limit however. This commit adds a comment to the
constant to annotate this.

See also: PR #37605

7 years agoSet possibility to hide attributes
Guillaume Gomez [Sun, 6 Nov 2016 19:06:01 +0000 (20:06 +0100)]
Set possibility to hide attributes

7 years agoPrint more tags in rustdoc
Guillaume Gomez [Wed, 12 Oct 2016 23:40:02 +0000 (01:40 +0200)]
Print more tags in rustdoc

7 years agoAuto merge of #37616 - jneem:master, r=alexcrichton
bors [Sun, 6 Nov 2016 17:34:15 +0000 (09:34 -0800)]
Auto merge of #37616 - jneem:master, r=alexcrichton

Add test for issue 18060.

Closes #18060

7 years agoForce static linking of LLVM
pweyck [Sun, 6 Nov 2016 10:45:21 +0000 (11:45 +0100)]
Force static linking of LLVM

Run llvm-config with "--link-static" if available, to force static linking of LLVM.
This option was added in LLVM 3.8.

Fixes #36854
See also: #36996

7 years agoAdd test for issue 18060.
Joe Neeman [Sun, 6 Nov 2016 15:27:36 +0000 (16:27 +0100)]
Add test for issue 18060.

7 years agoAuto merge of #37404 - eddyb:lazy-4, r=nikomatsakis
bors [Sun, 6 Nov 2016 14:22:38 +0000 (06:22 -0800)]
Auto merge of #37404 - eddyb:lazy-4, r=nikomatsakis

[4/n] rustc: harden against InferOk having obligations in more cases.

_This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37402) | [next](https://github.com/rust-lang/rust/pull/37408)) 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>

This adds more asserts that `InferOk` results have no obligations, pending completion of #32730.

Each of these could accidentally drop obligations on the floor if they start getting produced by unification, and a future change does just that, in order to produce a "shallow success" (hopefully leading to ambiguities during trait selection), _without_ the possibility of an eventual success - mostly guarded by ICEs for now.

7 years agorustc: harden against InferOk having obligations in more cases.
Eduard Burtescu [Mon, 3 Oct 2016 23:19:40 +0000 (02:19 +0300)]
rustc: harden against InferOk having obligations in more cases.

7 years agoAuto merge of #37386 - johnthagen:Self-reference-example, r=GuillaumeGomez
bors [Sun, 6 Nov 2016 10:28:58 +0000 (02:28 -0800)]
Auto merge of #37386 - johnthagen:Self-reference-example, r=GuillaumeGomez

Add example using Self to reference

When I first came across `Self` I had a hard time finding references to it in the docs (and it's also been asked about on [StackOverflow](http://stackoverflow.com/questions/32304595/whats-the-difference-between-self-and-self).

I hope this example provides someone who comes across it for the first time a little more help.  If there is a better way to show an example actually using `Self`, I'm happy to modify this.  It was just the simplest place to start I could see.

7 years agoAuto merge of #37597 - alexcrichton:rollup, r=alexcrichton
bors [Sun, 6 Nov 2016 05:34:25 +0000 (22:34 -0700)]
Auto merge of #37597 - alexcrichton:rollup, r=alexcrichton

Rollup of 24 pull requests

- Successful merges: #37255, #37317, #37408, #37410, #37422, #37427, #37470, #37501, #37537, #37556, #37557, #37564, #37565, #37566, #37569, #37574, #37577, #37579, #37583, #37585, #37586, #37587, #37589, #37596
- Failed merges: #37521, #37547

7 years agoOnly test docs and such for the host
Alex Crichton [Sat, 5 Nov 2016 21:22:19 +0000 (14:22 -0700)]
Only test docs and such for the host

7 years agoAdd unary and binary tests for incr-comp
oldmanmike [Sun, 6 Nov 2016 01:31:57 +0000 (21:31 -0400)]
Add unary and binary tests for incr-comp

7 years agoUse From trait as an example usage of Self.
johnthagen [Sat, 5 Nov 2016 22:21:17 +0000 (18:21 -0400)]
Use From trait as an example usage of Self.

7 years agoMerge branch 'gdb-next-gen' of https://github.com/TimNN/rust into rollup
Alex Crichton [Sat, 5 Nov 2016 17:51:34 +0000 (10:51 -0700)]
Merge branch 'gdb-next-gen' of https://github.com/TimNN/rust into rollup

7 years agoFix tests from the rollup
Alex Crichton [Sat, 5 Nov 2016 00:44:53 +0000 (17:44 -0700)]
Fix tests from the rollup

7 years agoMerge branch 'selfgate' of https://github.com/petrochenkov/rust into rollup
Alex Crichton [Fri, 4 Nov 2016 23:55:08 +0000 (16:55 -0700)]
Merge branch 'selfgate' of https://github.com/petrochenkov/rust into rollup

7 years agoMerge branch 'new-rustbuild' into rollup
Alex Crichton [Fri, 4 Nov 2016 23:53:48 +0000 (16:53 -0700)]
Merge branch 'new-rustbuild' into rollup

7 years agoRollup merge of #37596 - est31:master, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:33 +0000 (16:49 -0700)]
Rollup merge of #37596 - est31:master, r=alexcrichton

Add error when proc_macro_derive is used not on functions

Fixes #37590

7 years agoRollup merge of #37589 - raphlinus:fuchsia_random, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:33 +0000 (16:49 -0700)]
Rollup merge of #37589 - raphlinus:fuchsia_random, r=alexcrichton

std: Track change to cprng syscall signature (Fuchsia)

The mx_cprng_draw syscall has changed signature to separate the status
and size return values, rather than multiplexing them into a single
value with errors interpreted as a negative value. This patch tracks
that change.

7 years agoRollup merge of #37587 - ollie27:to_mut, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:33 +0000 (16:49 -0700)]
Rollup merge of #37587 - ollie27:to_mut, r=alexcrichton

Remove recursive call from Cow::to_mut

It seems to prevent it from being inlined.

7 years agoRollup merge of #37586 - TimNN:fix-37559, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:32 +0000 (16:49 -0700)]
Rollup merge of #37586 - TimNN:fix-37559, r=alexcrichton

fix #37559: update compiler-rt

Fixes #37559

r? @alexcrichton

7 years agoRollup merge of #37585 - leodasvacas:change_into_to_from, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:32 +0000 (16:49 -0700)]
Rollup merge of #37585 - leodasvacas:change_into_to_from, r=alexcrichton

Change `Into<Vec<u8>> for String` and `Into<OsString> for PathBuf` to From

Fixes #37561. First contribution, happy with any and all feedback!

7 years agoRollup merge of #37583 - michaelwoerister:hir-stats, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:32 +0000 (16:49 -0700)]
Rollup merge of #37583 - michaelwoerister:hir-stats, r=alexcrichton

Add `-Z hir-stats` for collecting statistics on HIR and AST

The data collected will be printed to the commandline and looks like the following:

```
// stats for libcore

PRE EXPANSION AST STATS

Name                Accumulated Size         Count     Item Size
----------------------------------------------------------------
TypeBinding                    2_280            57            40
Mod                            3_560            89            40
PathListItem                   6_516           181            36
Variant                        7_872            82            96
LifetimeDef                   21_280           380            56
StructField                   22_880           260            88
Lifetime                      23_800         1_190            20
Local                         30_192           629            48
ForeignItem                   31_504           179           176
Arm                           42_880           670            64
Mac                           46_960           587            80
FnDecl                        57_792         1_204            48
TraitItem                     69_504           362           192
TyParamBound                  98_280           945           104
Block                        108_384         2_258            48
Stmt                         144_720         3_618            40
ImplItem                     230_272         1_028           224
Item                         467_456         1_826           256
Pat                          517_776         4_623           112
Attribute                    745_680        15_535            48
Ty                         1_114_848         9_954           112
PathSegment                1_218_528        16_924            72
Expr                       3_082_408        20_279           152
----------------------------------------------------------------
Total                      8_095_372

POST EXPANSION AST STATS

Name                Accumulated Size         Count     Item Size
----------------------------------------------------------------
MacroDef                       1_056            12            88
Mod                            3_400            85            40
TypeBinding                    4_280           107            40
PathListItem                   6_516           181            36
Variant                        7_872            82            96
StructField                   24_904           283            88
ForeignItem                   31_504           179           176
TraitItem                     69_504           362           192
Local                         85_008         1_771            48
Arm                          100_288         1_567            64
Lifetime                     123_980         6_199            20
LifetimeDef                  126_728         2_263            56
TyParamBound                 297_128         2_857           104
FnDecl                       305_856         6_372            48
Block                        481_104        10_023            48
Stmt                         535_120        13_378            40
Item                       1_469_952         5_742           256
Attribute                  1_629_840        33_955            48
ImplItem                   1_732_864         7_736           224
Pat                        2_360_176        21_073           112
PathSegment                5_888_448        81_784            72
Ty                         6_237_168        55_689           112
Expr                      12_013_320        79_035           152
----------------------------------------------------------------
Total                     33_536_016

HIR STATS

Name                Accumulated Size         Count     Item Size
----------------------------------------------------------------
MacroDef                         864            12            72
Mod                            2_720            85            32
TypeBinding                    3_424           107            32
PathListItem                   5_068           181            28
Variant                        6_560            82            80
StructField                   20_376           283            72
ForeignItem                   27_208           179           152
WherePredicate                43_776           684            64
TraitItem                     52_128           362           144
Decl                          68_992         2_156            32
Local                         89_184         1_858            48
Arm                           94_368         1_966            48
LifetimeDef                  108_624         2_263            48
Lifetime                     123_980         6_199            20
Stmt                         168_000         4_200            40
TyParamBound                 251_416         2_857            88
FnDecl                       254_880         6_372            40
Block                        583_968        12_166            48
Item                       1_240_272         5_742           216
ImplItem                   1_361_536         7_736           176
Attribute                  1_620_480        33_760            48
Pat                        2_073_120        21_595            96
Path                       2_385_856        74_558            32
Ty                         4_455_040        55_688            80
PathSegment                5_587_904        87_311            64
Expr                       7_588_992        79_052            96
----------------------------------------------------------------
Total                     28_218_736
```

7 years agoRollup merge of #37579 - liigo:defaulthasher, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:32 +0000 (16:49 -0700)]
Rollup merge of #37579 - liigo:defaulthasher, r=alexcrichton

reference full path DefaultHasher

Since `DefaultHasher` does not in scope, it's not obvious where to find it.

7 years agoRollup merge of #37577 - nnethercote:shrink-Expr-slightly, r=eddyb
Alex Crichton [Fri, 4 Nov 2016 23:49:31 +0000 (16:49 -0700)]
Rollup merge of #37577 - nnethercote:shrink-Expr-slightly, r=eddyb

Shrink `hir::Expr` slightly

r? @eddyb

7 years agoRollup merge of #37574 - ollie27:cow_add, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:31 +0000 (16:49 -0700)]
Rollup merge of #37574 - ollie27:cow_add, r=alexcrichton

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 agoRollup merge of #37569 - jseyfried:improve_expansion_perf, r=eddyb
Alex Crichton [Fri, 4 Nov 2016 23:49:31 +0000 (16:49 -0700)]
Rollup merge of #37569 - jseyfried:improve_expansion_perf, r=eddyb

macros: improve expansion performance

This PR fixes that regression, further improves performance on recursive, `tt`-heavy workloads, and makes a variety of other improvements to parsing and expansion performance.

Expansion performance improvements:

| Test case      | Run-time | Memory usage |
| -------------- | -------- | ------------ |
| libsyntax      | 8%       | 10%          |
| librustc       | 15%      | 6%           |
| librustc_trans | 30%      | 6%           |
| #37074         | 20%      | 15%          |
| #34630         | 40%      | 8%           |

r? @eddyb

7 years agoRollup merge of #37566 - brson:env, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:31 +0000 (16:49 -0700)]
Rollup merge of #37566 - brson:env, r=alexcrichton

Set RUSTC_BOOTSTRAP to some value.

Environment variables on windows can't be empty.

7 years agoRollup merge of #37565 - mglagla:peek_use_as_ref, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:31 +0000 (16:49 -0700)]
Rollup merge of #37565 - mglagla:peek_use_as_ref, r=alexcrichton

Peekable::peek(): Use Option::as_ref()

Replace the match expression in .peek() with Option::as_ref() since it's the same functionality.

7 years agoRollup merge of #37564 - Mark-Simulacrum:sized-ice, r=eddyb
Alex Crichton [Fri, 4 Nov 2016 23:49:30 +0000 (16:49 -0700)]
Rollup merge of #37564 - Mark-Simulacrum:sized-ice, r=eddyb

Fix ICE when querying DefId on Def::Err.

Also moves computations into check that `kind_id` is `Ok(_)`, which is in theory an optimization, though I expect it's minor.

Fixes #37534.

r? @eddyb.

7 years agoRollup merge of #37557 - TimNN:fix-36954, r=eddyb
Alex Crichton [Fri, 4 Nov 2016 23:49:30 +0000 (16:49 -0700)]
Rollup merge of #37557 - TimNN:fix-36954, r=eddyb

Use DefId's in const eval for cross-crate const fn's

Fixes #36954.

r? @eddyb

cc @raphaelcohn

7 years agoRollup merge of #37556 - dinfuehr:main_frame_pointer, r=eddyb
Alex Crichton [Fri, 4 Nov 2016 23:49:30 +0000 (16:49 -0700)]
Rollup merge of #37556 - dinfuehr:main_frame_pointer, r=eddyb

set frame pointer elimination attribute for main

The rustc-generated function `main` should respect the same config for
frame pointer elimination as the rest of code.

7 years agoRollup merge of #37537 - GuillaumeGomez:error_kind_doc, r=steveklabnik
Alex Crichton [Fri, 4 Nov 2016 23:49:30 +0000 (16:49 -0700)]
Rollup merge of #37537 - GuillaumeGomez:error_kind_doc, r=steveklabnik

Add missing urls for ErrorKind's variants

r? @steveklabnik

7 years agoRollup merge of #37501 - alexcrichton:windows-subsystem, r=brson
Alex Crichton [Fri, 4 Nov 2016 23:49:29 +0000 (16:49 -0700)]
Rollup merge of #37501 - alexcrichton:windows-subsystem, r=brson

rustc: Add knowledge of Windows subsystems.

This commit is an implementation of [RFC 1665] which adds support for the
`#![windows_subsystem]` attribute. This attribute allows specifying either the
"windows" or "console" subsystems on Windows to the linker.

[RFC 1665]: https://github.com/rust-lang/rfcs/blob/master/text/1665-windows-subsystem.md

Previously all Rust executables were compiled as the "console" subsystem which
meant that if you wanted a graphical application it would erroneously pop up a
console whenever opened. When compiling an application, however, this is
undesired behavior and the "windows" subsystem is used instead to have control
over user interactions.

This attribute is validated, but ignored on all non-Windows platforms.

cc #37499

7 years agoRollup merge of #37470 - arthurprs:sip-smaller, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:29 +0000 (16:49 -0700)]
Rollup merge of #37470 - arthurprs:sip-smaller, r=alexcrichton

Don't reuse RandomState seeds

cc #36481

7 years agoRollup merge of #37427 - nnethercote:opt-IchHasher, r=michaelwoerister
Alex Crichton [Fri, 4 Nov 2016 23:49:29 +0000 (16:49 -0700)]
Rollup merge of #37427 - nnethercote:opt-IchHasher, r=michaelwoerister

Reduce the number of bytes hashed by IchHasher.

IchHasher uses blake2b hashing, which is expensive, so the fewer bytes hashed
the better. There are two big ways to reduce the number of bytes hashed.
- Filenames in spans account for ~66% of all bytes (for builds with debuginfo).
  The vast majority of spans have the same filename for the start of the span
  and the end of the span, so hashing the filename just once in those cases is
  a big win.
- u32 and u64 and usize values account for ~25%--33% of all bytes (for builds
  with debuginfo). The vast majority of these are small, i.e. fit in a u8, so
  shrinking them down before hashing is also a big win.

This PR implements these two optimizations. I'm certain the first one is safe.
I'm about 90% sure that the second one is safe.

Here are measurements of the number of bytes hashed when doing
debuginfo-enabled builds of stdlib and
rustc-benchmarks/syntex-0.42.2-incr-clean.

```
                    stdlib   syntex-incr
                    ------   -----------
original       156,781,386   255,095,596
half-SawSpan   106,744,403   176,345,419
short-ints      45,890,534   118,014,227
no-SawSpan[*]    6,831,874    45,875,714

[*] don't hash the SawSpan at all. Not part of this PR, just implemented for
    comparison's sake.
```

For debug builds of syntex-0.42.2-incr-clean, the two changes give a 1--2%
speed-up.

7 years agoRollup merge of #37422 - bluss:wrapping-offset, r=alexcrichton
Alex Crichton [Fri, 4 Nov 2016 23:49:29 +0000 (16:49 -0700)]
Rollup merge of #37422 - bluss:wrapping-offset, r=alexcrichton

Add .wrapping_offset() methods

.wrapping_offset() exposes the arith_offset intrinsic in the core
module (as methods on raw pointers, next to offset). This is the
first step in making it possible to stabilize the interface later.

`arith_offset` is a useful tool for developing iterators for two
reasons:
1. `arith_offset` is used by the slice's iterator, the most important
   iterator in libcore, and it is natural that Rust users need the same
   power available to implement similar iterators.
2. It is a good way to implement raw pointer iterations with step
   greater than one.

The name seems to fit the style of methods like "wrapping_add".

7 years agoAuto merge of #37470 - arthurprs:sip-smaller, r=alexcrichton
bors [Sat, 5 Nov 2016 11:32:04 +0000 (04:32 -0700)]
Auto merge of #37470 - arthurprs:sip-smaller, r=alexcrichton

Don't reuse RandomState seeds

cc #36481

7 years agoignore gdb check for android
Tim Neumann [Sat, 5 Nov 2016 09:23:55 +0000 (10:23 +0100)]
ignore gdb check for android

7 years agoAuto merge of #37427 - nnethercote:opt-IchHasher, r=michaelwoerister
bors [Sat, 5 Nov 2016 08:10:57 +0000 (01:10 -0700)]
Auto merge of #37427 - nnethercote:opt-IchHasher, r=michaelwoerister

Reduce the number of bytes hashed by IchHasher.

IchHasher uses blake2b hashing, which is expensive, so the fewer bytes hashed
the better. There are two big ways to reduce the number of bytes hashed.
- Filenames in spans account for ~66% of all bytes (for builds with debuginfo).
  The vast majority of spans have the same filename for the start of the span
  and the end of the span, so hashing the filename just once in those cases is
  a big win.
- u32 and u64 and usize values account for ~25%--33% of all bytes (for builds
  with debuginfo). The vast majority of these are small, i.e. fit in a u8, so
  shrinking them down before hashing is also a big win.

This PR implements these two optimizations. I'm certain the first one is safe.
I'm about 90% sure that the second one is safe.

Here are measurements of the number of bytes hashed when doing
debuginfo-enabled builds of stdlib and
rustc-benchmarks/syntex-0.42.2-incr-clean.

```
                    stdlib   syntex-incr
                    ------   -----------
original       156,781,386   255,095,596
half-SawSpan   106,744,403   176,345,419
short-ints      45,890,534   118,014,227
no-SawSpan[*]    6,831,874    45,875,714

[*] don't hash the SawSpan at all. Not part of this PR, just implemented for
    comparison's sake.
```

For debug builds of syntex-0.42.2-incr-clean, the two changes give a 1--2%
speed-up.

7 years agobook: Removed platform compatibility table, link to the forge
Brian Anderson [Sat, 5 Nov 2016 06:24:18 +0000 (23:24 -0700)]
book: Removed platform compatibility table, link to the forge

The content is duplicated, and it doesn't need to be in this location.
It's mostly trivia that doesn't apply to most of the audience.

The forge is up to date.

7 years agoAdd `{into,from}_raw` to Rc and Arc
Cristi Cobzarenco [Sat, 15 Oct 2016 15:32:14 +0000 (16:32 +0100)]
Add `{into,from}_raw` to Rc and Arc

7 years agoAuto merge of #37422 - bluss:wrapping-offset, r=alexcrichton
bors [Sat, 5 Nov 2016 00:48:07 +0000 (17:48 -0700)]
Auto merge of #37422 - bluss:wrapping-offset, r=alexcrichton

Add .wrapping_offset() methods

.wrapping_offset() exposes the arith_offset intrinsic in the core
module (as methods on raw pointers, next to offset). This is the
first step in making it possible to stabilize the interface later.

`arith_offset` is a useful tool for developing iterators for two
reasons:
1. `arith_offset` is used by the slice's iterator, the most important
   iterator in libcore, and it is natural that Rust users need the same
   power available to implement similar iterators.
2. It is a good way to implement raw pointer iterations with step
   greater than one.

The name seems to fit the style of methods like "wrapping_add".

7 years agoRollup merge of #37408 - eddyb:lazy-5, r=nikomatsakis
Alex Crichton [Fri, 4 Nov 2016 23:49:28 +0000 (16:49 -0700)]
Rollup merge of #37408 - eddyb:lazy-5, r=nikomatsakis

[5/n] rustc: record the target type of every adjustment.

_This is part of a series ([prev](https://github.com/rust-lang/rust/pull/37404) | [next](https://github.com/rust-lang/rust/pull/37412)) 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 rearranges `tcx.tables` so that all users go through `tcx.tables()`. This in preparation for per-body `Tables` where they will be requested for a specific `DefId`. Included to minimize churn.

The rest of the changes focus on adjustments, there are some renamings, but the main addition is the target type, always available in all cases (as opposed to just for unsizing where it was previously needed).

Possibly the most significant effect of this change is that figuring out the final type of an expression is now _always_ just one successful `HashMap` lookup (either the adjustment or, if that doesn't exist, the node type).

7 years agoRollup merge of #37317 - brson:relnotes, r=brson
Alex Crichton [Fri, 4 Nov 2016 23:49:28 +0000 (16:49 -0700)]
Rollup merge of #37317 - brson:relnotes, r=brson

Add release notes for 1.12.1

It completely slipped my mind that this is something I'm supposed to do as part of the release process...

7 years agoRollup merge of #37255 - mbrubeck:doc-edit, r=steveklabnik
Alex Crichton [Fri, 4 Nov 2016 23:49:28 +0000 (16:49 -0700)]
Rollup merge of #37255 - mbrubeck:doc-edit, r=steveklabnik

Fix some mistakes in HRTB docs

The example code for higher-ranked trait bounds on closures had an unnecessary `mut` which was confusing, and the text referred to an mutable reference which does not exist in the code (and isn't needed).  Removed the `mut`s and fixed the text to better describe the actual error for the failing example.

Thanks to csd_ on IRC for pointing out these problems!

r? @steveklabnik

7 years agoadd missing urls on io structs
Guillaume Gomez [Fri, 4 Nov 2016 19:51:57 +0000 (20:51 +0100)]
add missing urls on io structs

7 years agoAdd error when proc_macro_derive is used not on functions
est31 [Fri, 4 Nov 2016 21:37:51 +0000 (22:37 +0100)]
Add error when proc_macro_derive is used not on functions

Fixes #37590

7 years agoAuto merge of #37356 - cristicbz:wrapsum, r=alexcrichton
bors [Fri, 4 Nov 2016 21:14:48 +0000 (14:14 -0700)]
Auto merge of #37356 - cristicbz:wrapsum, r=alexcrichton

Add impls for `&Wrapping`. Also `Sum`, `Product` impls for both `Wrapping` and `&Wrapping`.

There are two changes here (split into two commits):
- Ops for references to `&Wrapping`  (`Add`, `Sub`, `Mul` etc.) similar to the way they are implemented for primitives.
- Impls for `iter::{Sum,Product}` for `Wrapping`.

As far as I know `impl` stability attributes don't really matter so I didn't bother breaking up the macro for two different kinds of stability. Happy to change if it does matter.

7 years agostd: Track change to cprng syscall signature (Fuchsia)
Raph Levien [Fri, 4 Nov 2016 20:01:15 +0000 (13:01 -0700)]
std: Track change to cprng syscall signature (Fuchsia)

The mx_cprng_draw syscall has changed signature to separate the status
and size return values, rather than multiplexing them into a single
value with errors interpreted as a negative value. This patch tracks
that change.

7 years agoRemove recursive call from Cow::to_mut
Oliver Middleton [Fri, 4 Nov 2016 18:47:32 +0000 (18:47 +0000)]
Remove recursive call from Cow::to_mut

It seems to prevent it from being inlined.

7 years agofix #37559: update compiler-rt
Tim Neumann [Fri, 4 Nov 2016 18:08:09 +0000 (19:08 +0100)]
fix #37559: update compiler-rt

7 years agoChange Into<Vec<u8>> for String and Into<OsString> for PathBuf to From impls
leonardo.yvens [Fri, 4 Nov 2016 17:54:08 +0000 (15:54 -0200)]
Change Into<Vec<u8>> for String and Into<OsString> for PathBuf to From impls

7 years agoAuto merge of #37306 - bluss:trusted-len, r=alexcrichton
bors [Fri, 4 Nov 2016 17:40:30 +0000 (10:40 -0700)]
Auto merge of #37306 - bluss:trusted-len, r=alexcrichton

Add Iterator trait TrustedLen to enable better FromIterator / Extend

This trait attempts to improve FromIterator / Extend code by enabling it to trust the iterator to produce an exact number of elements, which means that reallocation needs to happen only once and is moved out of the loop.

`TrustedLen` differs from `ExactSizeIterator` in that it attempts to include _more_ iterators by allowing for the case that the iterator's len does not fit in `usize`. Consumers must check for this case (for example they could panic, since they can't allocate a collection of that size).

For example, chain can be TrustedLen and all numerical ranges can be TrustedLen. All they need to do is to report an exact size if it fits in `usize`, and `None` as the upper bound otherwise.

The trait describes its contract like this:

```
An iterator that reports an accurate length using size_hint.

The iterator reports a size hint where it is either exact
(lower bound is equal to upper bound), or the upper bound is `None`.
The upper bound must only be `None` if the actual iterator length is
larger than `usize::MAX`.

The iterator must produce exactly the number of elements it reported.

This trait must only be implemented when the contract is upheld.
Consumers of this trait must inspect `.size_hint()`’s upper bound.
```

Fixes #37232

7 years agoAdd -Zhir-stats for collecting statistics on HIR and AST
Michael Woerister [Fri, 4 Nov 2016 15:37:39 +0000 (11:37 -0400)]
Add -Zhir-stats for collecting statistics on HIR and AST

7 years agoAuto merge of #37167 - nikomatsakis:jroesch-issue-18937, r=pnkfelix
bors [Fri, 4 Nov 2016 14:20:44 +0000 (07:20 -0700)]
Auto merge of #37167 - nikomatsakis:jroesch-issue-18937, r=pnkfelix

detect extra region requirements in impls

The current "compare method" check fails to check for the "region obligations" that accrue in the fulfillment context. This branch switches that code to create a `FnCtxt` so that it can invoke the regionck code. Previous crater runs (I haven't done one with the latest tip) have found some small number of affected crates, so I went ahead and introduced a warning cycle. I will kick off a crater run with this branch shortly.

This is a [breaking-change] because previously unsound code was accepted. The crater runs also revealed some cases where legitimate code was no longer type-checking, so the branch contains one additional (but orthogonal) change. It improves the elaborator so that we elaborate region requirements more thoroughly. In particular, if we know that `&'a T: 'b`, we now deduce that `T: 'b` and `'a: 'b`.

I invested a certain amount of effort in getting a good error message. The error message looks like this:

```
error[E0276]: impl has stricter requirements than trait
  --> traits-elaborate-projection-region.rs:33:5
   |
21 |     fn foo() where T: 'a;
   |     --------------------- definition of `foo` from trait
...
33 |     fn foo() where U: 'a { }
   |     ^^^^^^^^^^^^^^^^^^^^^^^^ impl has extra requirement `U: 'a`
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #18937 <https://github.com/rust-lang/rust/issues/18937>
note: lint level defined here
  --> traits-elaborate-projection-region.rs:12:9
   |
12 | #![deny(extra_requirement_in_impl)]
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
```

Obviously the warning only prints if this is a _new_ error (that resulted from the bugfix). But all existing errors that fit this description are updated to follow the general template. In order to get the lint to preserve the span-labels and the error code, I separate out the core `Diagnostic` type (which encapsulates the error code, message, span, and children) from the `DiagnosticBuilder` (which layers on a `Handler` that can be used to report errors). I also extended `add_lint` with an alternative `add_lint_diagnostic` that takes in a full diagnostic (cc @jonathandturner for those changes). This doesn't feel ideal but feels like it's moving in the right direction =).

r? @pnkfelix
cc @arielb1

Fixes #18937

7 years agoAuto merge of #37037 - Mark-Simulacrum:stack-error, r=alexcrichton
bors [Fri, 4 Nov 2016 10:38:18 +0000 (03:38 -0700)]
Auto merge of #37037 - Mark-Simulacrum:stack-error, r=alexcrichton

Add conversions from `io:ErrorKind` to `io::Error`

Filing to help with discussion around the possibility of doing this.

Current changes are clearly backwards incompatible, but I think adding a new function (with a bikeshed on naming) like `Error::new_str` should be possible (or some other way of specializing the string error message case) to fix #36658.

7 years agoreference full path `DefaultHasher`
Liigo Zhuang [Fri, 4 Nov 2016 07:43:42 +0000 (15:43 +0800)]
reference full path `DefaultHasher`

7 years agoFix fallout in tests.
Jeffrey Seyfried [Fri, 4 Nov 2016 09:07:00 +0000 (09:07 +0000)]
Fix fallout in tests.

7 years agoAuto merge of #36306 - nagisa:mir-local-cleanup, r=eddyb
bors [Fri, 4 Nov 2016 05:58:55 +0000 (22:58 -0700)]
Auto merge of #36306 - nagisa:mir-local-cleanup, r=eddyb

A way to remove otherwise unused locals from MIR

There is a certain amount of desire for a pass which cleans up the provably unused variables (no assignments or reads). There has been an implementation of such pass by @scottcarr, and another (two!) implementations by me in my own dataflow efforts.

PR like https://github.com/rust-lang/rust/pull/35916 proves that this pass is useful even on its own, which is why I cherry-picked it out from my dataflow effort.

@nikomatsakis previously expressed concerns over this pass not seeming to be very cheap to run and therefore unsuitable for regular cleanup duties. Turns out, regular cleanup of local declarations is not at all necessary, at least now, because majority of passes simply do not (or should not) care about them. That’s why it is viable to only run this pass once (perhaps a few more times in the future?) per function, right before translation.

r? @eddyb or @nikomatsakis

7 years agoShrink `Expr_::ExprStruct`.
Nicholas Nethercote [Fri, 4 Nov 2016 04:04:16 +0000 (15:04 +1100)]
Shrink `Expr_::ExprStruct`.

On 64-bit platforms this reduces the size of `Expr_` from  64 bytes to
56 bytes, and reduces the size of `Expr` from 88 bytes to 80 bytes.

7 years agoReorder `hir::Expr` fields.
Nicholas Nethercote [Thu, 3 Nov 2016 03:58:32 +0000 (14:58 +1100)]
Reorder `hir::Expr` fields.

On 64-bit platforms this reduces the size of `Expr` from 96 bytes to 88
bytes.

7 years agoRemove field `TtReader::next_tok`.
Jeffrey Seyfried [Thu, 3 Nov 2016 21:58:28 +0000 (21:58 +0000)]
Remove field `TtReader::next_tok`.

7 years agoImprove `tt`-heavy expansion performance.
Jeffrey Seyfried [Thu, 3 Nov 2016 11:59:43 +0000 (11:59 +0000)]
Improve `tt`-heavy expansion performance.