]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoproc_macro_plugin: Wrap nonexistent filename in <>
Jonas Schievink [Sat, 15 Oct 2016 00:56:29 +0000 (02:56 +0200)]
proc_macro_plugin: Wrap nonexistent filename in <>

I'm not sure how big of an issue this can become in practice, but `FileMap`s made from something that's not a file are supposed to wrap the file name in `<>`.

For an example fix, see kevinmehall/rust-peg@332fd4dbae19b64fb2af4b9d565e37a3703e7576. There, it caused cargo to always recompile a crate using rust-peg, even when nothing was changed, because cargo sees that the dummy file doesn't exist.

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 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 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 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 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 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 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 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 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 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 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.

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 agoLink the tracking issue for TrustedLen
Ulrik Sverdrup [Thu, 3 Nov 2016 23:24:59 +0000 (00:24 +0100)]
Link the tracking issue for TrustedLen

7 years agoMove doc comment desugaring into the parser.
Jeffrey Seyfried [Thu, 3 Nov 2016 10:44:25 +0000 (10:44 +0000)]
Move doc comment desugaring into the parser.

7 years agoAvoid recontructing the `Parser` in `macro_parser.rs`.
Jeffrey Seyfried [Thu, 3 Nov 2016 08:23:59 +0000 (08:23 +0000)]
Avoid recontructing the `Parser` in `macro_parser.rs`.

7 years agoMake `ast::ExprKind` smaller.
Jeffrey Seyfried [Thu, 3 Nov 2016 08:38:17 +0000 (08:38 +0000)]
Make `ast::ExprKind` smaller.

7 years agoReimplement "macros: Improve `tt` fragments" with better performance.
Jeffrey Seyfried [Thu, 3 Nov 2016 07:43:29 +0000 (07:43 +0000)]
Reimplement "macros: Improve `tt` fragments" with better performance.

7 years agoRevert "macros: Improve `tt` fragments"
Jeffrey Seyfried [Wed, 2 Nov 2016 22:59:08 +0000 (22:59 +0000)]
Revert "macros: Improve `tt` fragments"

This reverts commit 41745f30f751364bdce14428b7d3ffa5dd028903.

7 years agoReduce the size of `Token` and make it cheaper to clone by refactoring
Jeffrey Seyfried [Wed, 2 Nov 2016 03:03:55 +0000 (03:03 +0000)]
Reduce the size of `Token` and make it cheaper to clone by refactoring
`Token::Interpolated(Nonterminal)` -> `Token::Interpolated(Rc<Nonterminal>)`.

7 years agoClean up `parser.parse_token_tree()`.
Jeffrey Seyfried [Thu, 3 Nov 2016 03:33:21 +0000 (03:33 +0000)]
Clean up `parser.parse_token_tree()`.

7 years agocore::ptr: Specify issue for ptr_wrapping_offset feature
Ulrik Sverdrup [Thu, 3 Nov 2016 23:16:04 +0000 (00:16 +0100)]
core::ptr: Specify issue for ptr_wrapping_offset feature

7 years agoSet RUSTC_BOOTSTRAP to some value.
Brian Anderson [Thu, 3 Nov 2016 22:15:43 +0000 (22:15 +0000)]
Set RUSTC_BOOTSTRAP to some value.

Environment variables on windows can't be empty.

7 years agoFix ICE when querying DefId on Def::Err.
Mark-Simulacrum [Thu, 3 Nov 2016 20:55:35 +0000 (14:55 -0600)]
Fix ICE when querying DefId on Def::Err.

7 years agoPeekable::peek(): Use Option::as_ref()
Martin Glagla [Thu, 3 Nov 2016 21:22:27 +0000 (22:22 +0100)]
Peekable::peek(): Use Option::as_ref()

7 years agouse DefId's in const eval for cross-crate const fn's
Tim Neumann [Thu, 3 Nov 2016 10:51:11 +0000 (11:51 +0100)]
use DefId's in const eval for cross-crate const fn's

7 years agoset frame pointer elimination attribute for main
Dominik Inführ [Thu, 3 Nov 2016 09:53:13 +0000 (10:53 +0100)]
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 agoAuto merge of #37541 - nikomatsakis:issue-37291, r=brson
bors [Thu, 3 Nov 2016 05:58:01 +0000 (22:58 -0700)]
Auto merge of #37541 - nikomatsakis:issue-37291, r=brson

Use impl obligations as initial environment for specialization

This corrects a small regression in specialization that crept in, I think as part of the refactoring to introduce arenas. I also made an experiment (in the last commit) to cleanup the code to be more aggressive about normalization. As the commit log notes, I am not 100% sure that this is correct, but it feels safer, and I think that at worst it yields *more* ICEs (as opposed to admitting faulty code). I'll schedule a crater run to check beyond the testbase.

Fixes #37291.

r? @aturon

7 years agoA way to remove otherwise unused locals from MIR
Simonas Kazlauskas [Tue, 16 Aug 2016 01:59:50 +0000 (04:59 +0300)]
A way to remove otherwise unused locals from MIR

Replaces the hack where a similar thing is done within trans.

7 years agorustbuild: Rewrite user-facing interface
Alex Crichton [Fri, 21 Oct 2016 20:18:09 +0000 (13:18 -0700)]
rustbuild: Rewrite user-facing interface

This commit is a rewrite of the user-facing interface to the rustbuild build
system. The intention here is to make it much easier to compile/test the project
without having to remember weird rule names and such. An overall view of the new
interface is:

    # build everything
    ./x.py build

    # document everyting
    ./x.py doc

    # test everything
    ./x.py test

    # test libstd
    ./x.py test src/libstd

    # build libcore stage0
    ./x.py build src/libcore --stage 0

    # run stage1 run-pass tests
    ./x.py test src/test/run-pass --stage 1

The `src/bootstrap/bootstrap.py` script is now aliased as a top-level `x.py`
script. This `x` was chosen to be both short and easily tab-completable (no
collisions in that namespace!). The build system now accepts a "subcommand" of
what to do next, the main ones being build/doc/test.

Each subcommand then receives an optional list of arguments. These arguments are
paths in the source repo of what to work with. That is, if you want to test a
directory, you just pass that directory as an argument.

The purpose of this rewrite is to do away with all of the arcane renames like
"rpass" is the "run-pass" suite, "cfail" is the "compile-fail" suite, etc. By
simply working with directories and files it's much more intuitive of how to run
a test (just pass it as an argument).

The rustbuild step/dependency management was also rewritten along the way to
make this easy to work with and define, but that's largely just a refactoring of
what was there before.

The *intention* is that this support is extended for arbitrary files (e.g.
`src/test/run-pass/my-test-case.rs`), but that isn't quite implemented just yet.
Instead directories work for now but we can follow up with stricter path
filtering logic to plumb through all the arguments.

7 years agoAuto merge of #36993 - nnethercote:obligation, r=nikomatsakis
bors [Thu, 3 Nov 2016 00:46:44 +0000 (17:46 -0700)]
Auto merge of #36993 - nnethercote:obligation, r=nikomatsakis

Optimize ObligationForest's NodeState handling.

This commit does the following.
- Changes `NodeState` from an enum to a `bitflags`. This makes it
  possible to check against multiple possible values in a single bitwise
  operation.
- Replaces all the hot `match`es involving `NodeState` with `if`/`else`
  chains that ensure that cases are handled in the order of frequency.
- Partially inlines two functions, `find_cycles_from_node` and
  `mark_as_waiting_from`, at two call sites in order to avoid function
  unnecessary function calls on hot paths.
- Fully inlines and removes `is_popped`.

These changes speeds up rustc-benchmarks/inflate-0.1.0 by about 7% when
doing debug builds with a stage1 compiler.

r? @arielb1

7 years agoAdd feature gate for Self and associated types in struct expressions and patterns
Vadim Petrochenkov [Wed, 14 Sep 2016 21:51:46 +0000 (00:51 +0300)]
Add feature gate for Self and associated types in struct expressions and patterns

7 years agoStabilize `..` in tuple (struct) patterns
Vadim Petrochenkov [Wed, 14 Sep 2016 21:51:46 +0000 (00:51 +0300)]
Stabilize `..` in tuple (struct) patterns

7 years agojust use full-normalization when for the impl trait ref
Niko Matsakis [Wed, 2 Nov 2016 22:08:32 +0000 (18:08 -0400)]
just use full-normalization when for the impl trait ref

This seems better because I want to avoid the situation where unresolved
inference variables make it into the environment.  On the other hand, I
am not 100% sure that this is correct. My assumption was that the WF
check should ensure that this normalization can succeed. But it occurs
to me that the WF checks may need to make use of the `specializes`
predicate themselves, and hence we may have a kind of cycle here (this
is a bigger problem with spec in any case that we need to resolve).

On the other hand, this should just cause extra errors I think, so it
seems like a safe thing to attempt. Certainly all tests pass.

7 years agonormalize trait-ref in context of impl
Niko Matsakis [Wed, 2 Nov 2016 15:50:16 +0000 (11:50 -0400)]
normalize trait-ref in context of impl

The `specializes()` function was trying to normalize the impl trait in
an empty environment. This could lead to inexplicable failures.

7 years agoadd #32791 test case
Niko Matsakis [Wed, 2 Nov 2016 16:27:11 +0000 (12:27 -0400)]
add #32791 test case

7 years agoleb128-encode integers before hashing them in IchHasher.
Nicholas Nethercote [Wed, 26 Oct 2016 22:23:38 +0000 (09:23 +1100)]
leb128-encode integers before hashing them in IchHasher.

This significantly reduces the number of bytes hashed by IchHasher.

7 years agoAuto merge of #37540 - jonathandturner:rollup, r=jonathandturner
bors [Wed, 2 Nov 2016 21:29:31 +0000 (14:29 -0700)]
Auto merge of #37540 - jonathandturner:rollup, r=jonathandturner

Rollup of 10 pull requests

- Successful merges: #37351, #37405, #37473, #37482, #37488, #37498, #37502, #37513, #37517, #37523
- Failed merges: #37521