]> git.lizzy.rs Git - rust.git/log
rust.git
7 years agoincr.comp.: Cache DepNodes with corresponding query results.
Michael Woerister [Tue, 4 Jul 2017 15:33:43 +0000 (17:33 +0200)]
incr.comp.: Cache DepNodes with corresponding query results.

7 years agoincr.comp.: Introduce the concept of anonymous DepNodes.
Michael Woerister [Fri, 23 Jun 2017 14:37:12 +0000 (16:37 +0200)]
incr.comp.: Introduce the concept of anonymous DepNodes.

7 years agoincr.comp.: Manage dependency graph on main thread.
Michael Woerister [Tue, 4 Jul 2017 13:06:57 +0000 (15:06 +0200)]
incr.comp.: Manage dependency graph on main thread.

7 years agoFix some `tidy` errors.
Michael Woerister [Tue, 4 Jul 2017 12:23:07 +0000 (14:23 +0200)]
Fix some `tidy` errors.

7 years agoDeduplicate DepNode::ConstEval()
Michael Woerister [Mon, 3 Jul 2017 14:37:48 +0000 (16:37 +0200)]
Deduplicate DepNode::ConstEval()

7 years agoAllow 'tcx in define_dep_nodes! and deduplicate some DepNodes.
Michael Woerister [Fri, 30 Jun 2017 21:53:35 +0000 (14:53 -0700)]
Allow 'tcx in define_dep_nodes! and deduplicate some DepNodes.

7 years agoAdd StableHash implementation for ty::Instance.
Michael Woerister [Fri, 30 Jun 2017 21:51:03 +0000 (14:51 -0700)]
Add StableHash implementation for ty::Instance.

7 years agoincr.comp.: Improve debug output for work products.
Michael Woerister [Fri, 23 Jun 2017 14:37:12 +0000 (16:37 +0200)]
incr.comp.: Improve debug output for work products.

7 years agoSplit DepNode::ItemSignature into non-overlapping variants.
Michael Woerister [Thu, 22 Jun 2017 08:54:26 +0000 (10:54 +0200)]
Split DepNode::ItemSignature into non-overlapping variants.

7 years agoAuto merge of #43115 - petrochenkov:methlife2, r=eddyb
bors [Sun, 9 Jul 2017 21:40:16 +0000 (21:40 +0000)]
Auto merge of #43115 - petrochenkov:methlife2, r=eddyb

Store all generic arguments for method calls in AST/HIR

The first part of https://github.com/rust-lang/rust/pull/42492.
Landed separately to start the process of merging libsyntax changes breaking rustfmt, which is not easy these days.

7 years agoUpdate rls to pull rustfmt with libsyntax changes
Vadim Petrochenkov [Sat, 8 Jul 2017 00:32:19 +0000 (03:32 +0300)]
Update rls to pull rustfmt with libsyntax changes

7 years agoStore all generic arguments for method calls in HIR
Vadim Petrochenkov [Fri, 7 Jul 2017 12:57:51 +0000 (15:57 +0300)]
Store all generic arguments for method calls in HIR

7 years agoStore all generic arguments for method calls in AST
Vadim Petrochenkov [Thu, 6 Jul 2017 23:39:55 +0000 (02:39 +0300)]
Store all generic arguments for method calls in AST

7 years agoAuto merge of #43130 - GuillaumeGomez:rustdoc-fn-spacing, r=QuietMisdreavus
bors [Sun, 9 Jul 2017 17:58:10 +0000 (17:58 +0000)]
Auto merge of #43130 - GuillaumeGomez:rustdoc-fn-spacing, r=QuietMisdreavus

Add spacing between trait functions

Fixes #42988.

<img width="1440" alt="screen shot 2017-07-09 at 17 02 16" src="https://user-images.githubusercontent.com/3050060/27995068-672a3208-64c8-11e7-9bc7-c7288f2cd27b.png">

7 years agoAuto merge of #43117 - MJDSys:fix_rustbuild_libdir_2, r=alexcrichton
bors [Sun, 9 Jul 2017 15:42:47 +0000 (15:42 +0000)]
Auto merge of #43117 - MJDSys:fix_rustbuild_libdir_2, r=alexcrichton

Fix stage 2 builds with a custom libdir.

When copying libstd for the stage 2 compiler, the builder ignores the
configured libdir/libdir_relative configuration parameters.  This causes
the compiler to fail to find libstd, which cause any tools built with the
stage 2 compiler to fail.

To fix this, make the copy steps of rustbuild aware of the libdir_relative
parameter when the stage >= 2.  Also update the dist target to be aware of
the new location of libstd.

7 years agoAdd spacing between trait functions
Guillaume Gomez [Sat, 8 Jul 2017 22:40:29 +0000 (00:40 +0200)]
Add spacing between trait functions

7 years agoAuto merge of #43082 - ids1024:condvar2, r=alexcrichton
bors [Sun, 9 Jul 2017 04:23:29 +0000 (04:23 +0000)]
Auto merge of #43082 - ids1024:condvar2, r=alexcrichton

Redox: Fix Condvar.wait(); do not lock mutex twice

The atomic_xchg() loop locks the mutex, so the call to mutex_lock is
incorrect, and blocks.

7 years agoAuto merge of #43128 - ibabushkin:master, r=eddyb
bors [Sun, 9 Jul 2017 01:48:11 +0000 (01:48 +0000)]
Auto merge of #43128 - ibabushkin:master, r=eddyb

Implemented `TypeFoldable` for `TypeError`s.

This is quite handy in some user code, for instance to pull out type errors from an inference context when `fresh_substs_for_item` has been used before.

7 years agoAuto merge of #43097 - PlasmaPower:large-align, r=eddyb
bors [Sat, 8 Jul 2017 22:09:04 +0000 (22:09 +0000)]
Auto merge of #43097 - PlasmaPower:large-align, r=eddyb

Raise alignment limit from 2^15 to 2^31 - 1

Fixes #42960

7 years agoImplemented `TypeFoldable` for `TypeError`s.
Inokentiy Babushkin [Sat, 8 Jul 2017 21:24:00 +0000 (23:24 +0200)]
Implemented `TypeFoldable` for `TypeError`s.

7 years agoAuto merge of #43075 - durka:error-long-link, r=nikomatsakis
bors [Sat, 8 Jul 2017 19:50:13 +0000 (19:50 +0000)]
Auto merge of #43075 - durka:error-long-link, r=nikomatsakis

Fix links for typeck diagnostics without tripping tidy

Pick up #42624 to fix #43070 (cc @frewsxcv). I fixed a few other links while I was at it.

7 years agoInternally limit alignment to 2^30
Lee Bousfield [Sat, 8 Jul 2017 17:43:52 +0000 (13:43 -0400)]
Internally limit alignment to 2^30

7 years agoAuto merge of #43019 - kevinmehall:cleanup-errors, r=nikomatsakis
bors [Sat, 8 Jul 2017 17:30:37 +0000 (17:30 +0000)]
Auto merge of #43019 - kevinmehall:cleanup-errors, r=nikomatsakis

Remove unused code from librustc_errors

While extracting librustc_errors into a [reusable library](https://github.com/kevinmehall/codemap-diagnostic), I noticed some obsolete code that the `dead_code` warning missed because it was marked `pub` but not used elsewhere.

7 years agoBox large array to avoid blowing the stack
Lee Bousfield [Sat, 8 Jul 2017 17:02:52 +0000 (13:02 -0400)]
Box large array to avoid blowing the stack

7 years agoAuto merge of #42996 - Boreeas:merge-e0609-e0612, r=GuillaumeGomez
bors [Sat, 8 Jul 2017 15:18:46 +0000 (15:18 +0000)]
Auto merge of #42996 - Boreeas:merge-e0609-e0612, r=GuillaumeGomez

Fold E0612, E0613 into E0609

As discussed in #42945, with PR 1506 tuple indices are no longer considered a separate case from normal field. This PR folds E06012 ("tuple index out of bounds") and E0613 ("type is not a tuple") into E0609 ("type does not have field with that name")

Resolves #42945

7 years agoLower alignment limit down to 2^31 - 1 (from LLVM)
Lee Bousfield [Sat, 8 Jul 2017 14:28:20 +0000 (10:28 -0400)]
Lower alignment limit down to 2^31 - 1 (from LLVM)

7 years agoRaised alignment limit from 2^15 to 2^31
Lee Bousfield [Thu, 6 Jul 2017 22:00:46 +0000 (18:00 -0400)]
Raised alignment limit from 2^15 to 2^31

7 years agoAuto merge of #43104 - nbaksalyar:rustbuild-illumos-fix, r=sanxiyn
bors [Sat, 8 Jul 2017 13:08:11 +0000 (13:08 +0000)]
Auto merge of #43104 - nbaksalyar:rustbuild-illumos-fix, r=sanxiyn

Fix Rustbuild linking on Illumos

Illumos (an OpenSolaris fork) expects to get several extra library references for some system functions used by Rust standard library. This commit adds required linker options to rustbuild, which is currently doesn't work on Illumos-based operating systems.

7 years agoAuto merge of #43077 - SimonSapin:ranges, r=alexcrichton
bors [Sat, 8 Jul 2017 07:30:21 +0000 (07:30 +0000)]
Auto merge of #43077 - SimonSapin:ranges, r=alexcrichton

Implement O(1)-time Iterator::nth for Range*, and slim the Step trait

Fixes #43064.
Fixes part of #39975.
Fixes items 1 <s>and 3</s> of #42168.
CC #27741.

I think #42310 and #43012 should not have landed without the `nth` part of this PR, but oh well.

7 years agoAdd tests for reaching the end of RangeInclusive as an iterator
Simon Sapin [Thu, 6 Jul 2017 16:13:44 +0000 (18:13 +0200)]
Add tests for reaching the end of RangeInclusive as an iterator

7 years agoAdd tests for Range*::nth
Simon Sapin [Thu, 6 Jul 2017 15:13:29 +0000 (17:13 +0200)]
Add tests for Range*::nth

7 years agoImplement O(1)-time Iterator::nth for Range*
Simon Sapin [Wed, 5 Jul 2017 23:14:20 +0000 (01:14 +0200)]
Implement O(1)-time Iterator::nth for Range*

7 years agoFactorize some macros in iter/range.rs
Simon Sapin [Wed, 5 Jul 2017 22:32:54 +0000 (00:32 +0200)]
Factorize some macros in iter/range.rs

7 years agoRemove Step::steps_between, rename steps_between_by_one to steps_between
Simon Sapin [Wed, 5 Jul 2017 22:10:40 +0000 (00:10 +0200)]
Remove Step::steps_between, rename steps_between_by_one to steps_between

7 years agoRemove unused Step methods
Simon Sapin [Wed, 5 Jul 2017 21:54:08 +0000 (23:54 +0200)]
Remove unused Step methods

7 years agoRemove unused Add bounds in iterator for ranges impls.
Simon Sapin [Wed, 5 Jul 2017 21:49:33 +0000 (23:49 +0200)]
Remove unused Add bounds in iterator for ranges impls.

7 years agoAuto merge of #43072 - cuviper:linux-stack-guard, r=alexcrichton
bors [Sat, 8 Jul 2017 04:22:49 +0000 (04:22 +0000)]
Auto merge of #43072 - cuviper:linux-stack-guard, r=alexcrichton

Skip the main thread's manual stack guard on Linux

Linux doesn't allocate the whole stack right away, and the kernel has its own stack-guard mechanism to fault when growing too close to an existing mapping.  If we map our own guard, then the kernel starts enforcing a rather large gap above that, rendering much of the possible stack space useless.

Instead, we'll just note where we expect rlimit to start faulting, so our handler can report "stack overflow", and trust that the kernel's own stack guard will work.

Fixes #43052.
r? @alexcrichton

### Kernel compatibility:

Strictly speaking, Rust claims support for Linux kernels >= 2.6.18, and stack guards were only added to mainline in 2.6.36 for [CVE-2010-2240].  But since that vulnerability was so severe, the guards were backported to many stable branches, and Red Hat patched this all the way back to RHEL3's 2.4.21!  I think it's reasonable for us to assume that any *supportable* kernel should have these stack guards.

At that time, the kernel only enforced one page of padding between the stack and other mappings, but thanks to [Stack Clash] that padding is now much larger, causing #43052.  The kernel side of those fixes are in [CVE-2017-1000364], which Red Hat has backported to at least RHEL5's 2.6.18 so far.

[CVE-2010-2240]: https://access.redhat.com/security/cve/CVE-2010-2240
[CVE-2017-1000364]: https://access.redhat.com/security/cve/CVE-2017-1000364
[Stack Clash]: https://access.redhat.com/security/vulnerabilities/stackguard

7 years agoFix stage 2 builds with a custom libdir.
Matthew Dawson [Sat, 8 Jul 2017 03:00:38 +0000 (23:00 -0400)]
Fix stage 2 builds with a custom libdir.

When copying libstd for the stage 2 compiler, the builder ignores the
configured libdir/libdir_relative configuration parameters.  This causes
the compiler to fail to find libstd, which cause any tools built with the
stage 2 compiler to fail.

To fix this, make the copy steps of rustbuild aware of the libdir_relative
parameter when the stage >= 2.  Also update the dist target to be aware of
the new location of libstd.

7 years agoAuto merge of #42894 - petrochenkov:deny, r=nikomatsakis
bors [Sat, 8 Jul 2017 02:03:38 +0000 (02:03 +0000)]
Auto merge of #42894 - petrochenkov:deny, r=nikomatsakis

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

Needs crater run before proceeding.

r? @nikomatsakis

7 years agoMake `patterns_in_fns_without_body` warn-by-default again
Vadim Petrochenkov [Sat, 8 Jul 2017 00:01:11 +0000 (03:01 +0300)]
Make `patterns_in_fns_without_body` warn-by-default again

Fix some tests on Linux

7 years agoMove public reexports of private extern crates into a separate lint
Vadim Petrochenkov [Sun, 25 Jun 2017 02:50:51 +0000 (05:50 +0300)]
Move public reexports of private extern crates into a separate lint

This is going to be a hard error while all private-in-public errors from rustc_privacy will be reclassified into lints.

7 years agoMake sufficiently old or low-impact compatibility lints deny-by-default
Vadim Petrochenkov [Sun, 25 Jun 2017 02:30:20 +0000 (05:30 +0300)]
Make sufficiently old or low-impact compatibility lints deny-by-default

7 years agoRemove more anonymous trait method parameters
Vadim Petrochenkov [Sun, 25 Jun 2017 02:29:10 +0000 (05:29 +0300)]
Remove more anonymous trait method parameters

7 years agoAuto merge of #42840 - arielb1:poison-smoke-and-mirrors, r=nikomatsakis
bors [Fri, 7 Jul 2017 21:15:30 +0000 (21:15 +0000)]
Auto merge of #42840 - arielb1:poison-smoke-and-mirrors, r=nikomatsakis

Replace the global fulfillment cache with the evaluation cache

This uses the new "Chalk" ParamEnv refactoring to check "global" predicates in an empty environment, which should be correct because global predicates aren't affected by a consistent environment.

Fixes #39970.
Fixes #42796.

r? @nikomatsakis

7 years agoFold E0613 into E0609
boreeas [Fri, 30 Jun 2017 18:36:51 +0000 (20:36 +0200)]
Fold E0613 into E0609

Resolves #42945

7 years agoAuto merge of #42809 - seanmonstar:stable-associated-consts, r=nikomatsakis
bors [Fri, 7 Jul 2017 18:42:14 +0000 (18:42 +0000)]
Auto merge of #42809 - seanmonstar:stable-associated-consts, r=nikomatsakis

remove associated_consts feature gate

Currently struggling to run tests locally (something about jemalloc target missing).

cc #29646

7 years agoreturn EvaluatedToRecur when evaluating a recursive obligation tree
Ariel Ben-Yehuda [Fri, 30 Jun 2017 11:18:04 +0000 (14:18 +0300)]
return EvaluatedToRecur when evaluating a recursive obligation tree

This helps avoid cache pollution. Also add more comments explaining
that.

7 years agouse the evaluation cache instead of the global fulfillment cache
Ariel Ben-Yehuda [Thu, 22 Jun 2017 21:27:47 +0000 (00:27 +0300)]
use the evaluation cache instead of the global fulfillment cache

The evaluation cache already exists, and it can handle differing
parameter environments natively.

Fixes #39970.
Fixes #42796.

7 years agouse dep-graph reads for the evaluation cache
Ariel Ben-Yehuda [Mon, 26 Jun 2017 15:39:52 +0000 (18:39 +0300)]
use dep-graph reads for the evaluation cache

This is just duplicating the logic from the old fulfillment cache, so
I'm not sure it is 100% correct, but it should not be more wrong than
the old logic.

7 years agoprevent illegal coinductive matching in trait evaluation
Ariel Ben-Yehuda [Mon, 26 Jun 2017 14:23:15 +0000 (17:23 +0300)]
prevent illegal coinductive matching in trait evaluation

Previously, coinductive matching was only blocked on the fulfillment
path, and ignored on the evaluation path.

7 years agoSkip the main thread's manual stack guard on Linux
Josh Stone [Wed, 5 Jul 2017 19:03:17 +0000 (12:03 -0700)]
Skip the main thread's manual stack guard on Linux

Linux doesn't allocate the whole stack right away, and the kernel has
its own stack-guard mechanism to fault when growing too close to an
existing mapping.  If we map our own guard, then the kernel starts
enforcing a rather large gap above that, rendering much of the possible
stack space useless.

Instead, we'll just note where we expect rlimit to start faulting, so
our handler can report "stack overflow", and trust that the kernel's own
stack guard will work.

Fixes #43052.

7 years agoRedox: Fix Condvar.wait(); do not lock mutex twice
Ian Douglas Scott [Wed, 5 Jul 2017 19:00:46 +0000 (12:00 -0700)]
Redox: Fix Condvar.wait(); do not lock mutex twice

The atomic_xchg() loop locks the mutex, so the call to mutex_lock is
incorrect, and blocks.

7 years agoAuto merge of #43099 - japaric:msp430, r=alexcrichton
bors [Fri, 7 Jul 2017 15:27:49 +0000 (15:27 +0000)]
Auto merge of #43099 - japaric:msp430, r=alexcrichton

add a built-in MSP430 target

the MSP430 backend has been enabled for a while but no target was added to rustc
to encourage out of tree experimentation.

We believe the out of tree (custom) target has been iterated long enough and is
stable enough for inclusion in the compiler. Kudos to @pftbest and @awygle for
fixing several LLVM / codegen bugs this target had!

The target name chosen is a slight variation of the triple gcc uses, which is
simply `msp430-elf`. We picked `msp430-none-elf` to leave room for custom
targets that target some embedded OS running on MSP430 devices. (cf. the
custom `thumbv7m-tockos-eabi` target TockOS uses vs the built-in
`thumbv7m-none-eabi`).

There's one expected change in the specification of the proposed target: the
`asm_args` and `no_integrated_as` fields will change to their default values.
Once the LLVM backend gains the ability to directly produce MSP430 object files
we can stop depending on `msp430-elf-gcc` for producing object files; when that
occurs the `asm` related fields will change. This change won't break existing
user code.

r? @alexcrichton
cc @brson

7 years agoAuto merge of #43093 - rthomas:39791-hashmap, r=alexcrichton
bors [Fri, 7 Jul 2017 12:54:46 +0000 (12:54 +0000)]
Auto merge of #43093 - rthomas:39791-hashmap, r=alexcrichton

Add annotations to the resize fn #39791

This adds the `inline(never)` and `cold` annotations to the
HashMap::resize function.

7 years agoAuto merge of #43060 - petrochenkov:asless, r=estebank
bors [Fri, 7 Jul 2017 10:37:38 +0000 (10:37 +0000)]
Auto merge of #43060 - petrochenkov:asless, r=estebank

syntax: Apply `x as usize < y` recovery to type ascription as well

Also correct spans, add some comments.

r? @estebank

7 years agosyntax: Apply recovery for casts to type ascription
Vadim Petrochenkov [Mon, 3 Jul 2017 23:17:01 +0000 (02:17 +0300)]
syntax: Apply recovery for casts to type ascription

Fix spans, add some comments

7 years agoFix spans for binary operator expression with interpolated identifiers
Vadim Petrochenkov [Tue, 4 Jul 2017 14:04:34 +0000 (17:04 +0300)]
Fix spans for binary operator expression with interpolated identifiers

7 years agoAuto merge of #43091 - aidanhs:aphs-no-docker-priv, r=alexcrichton
bors [Fri, 7 Jul 2017 08:13:20 +0000 (08:13 +0000)]
Auto merge of #43091 - aidanhs:aphs-no-docker-priv, r=alexcrichton

Privileged in docker run isn't necessary

Added relatively recently in https://github.com/rust-lang/rust/pull/40199/files#diff-71609a365528e4649836825d8250c241R57, but I don't see anything in that PR that requires it. If it's not strictly necessary, we shouldn't use it.

(if this lands I'll make a PR against libc which also uses privileged)

r? @alexcrichton

7 years agoAuto merge of #43068 - ollie27:rustdoc_markdown_tests, r=GuillaumeGomez
bors [Fri, 7 Jul 2017 06:01:30 +0000 (06:01 +0000)]
Auto merge of #43068 - ollie27:rustdoc_markdown_tests, r=GuillaumeGomez

rustdoc: Don't run Markdown tests twice

This matches the behaviour for finding tests in Rust files.

This was a regression from 1.17 to 1.18 so it would be a good idea to backport this to beta so at least 1.19 won't also be affected.

Fixes #42726

r? @GuillaumeGomez

7 years agoFix Rustbuild linking on Illumos
Nikita Baksalyar [Fri, 7 Jul 2017 05:32:18 +0000 (08:32 +0300)]
Fix Rustbuild linking on Illumos

Illumos (an OpenSolaris fork) expects to get several
extra library references for some system functions used
by Rust standard library. This commit adds required linker
options to rustbuild, which is currently doesn't work on
Illumos-based operating systems.

7 years agoAuto merge of #43062 - sfackler:connect-timeout, r=alexcrichton
bors [Fri, 7 Jul 2017 03:43:14 +0000 (03:43 +0000)]
Auto merge of #43062 - sfackler:connect-timeout, r=alexcrichton

Implement TcpStream::connect_timeout

This breaks the "single syscall rule", but it's really annoying to hand
write and is pretty foundational.

r? @alexcrichton

cc @rust-lang/libs

7 years agoImplement TcpStream::connect_timeout
Steven Fackler [Wed, 5 Jul 2017 06:46:24 +0000 (23:46 -0700)]
Implement TcpStream::connect_timeout

This breaks the "single syscall rule", but it's really annoying to hand
write and is pretty foundational.

7 years agoRemove unused code from librustc_errors
Kevin Mehall [Sun, 2 Jul 2017 20:46:38 +0000 (13:46 -0700)]
Remove unused code from librustc_errors

7 years agoAuto merge of #42125 - petrochenkov:privty, r=nikomatsakis
bors [Fri, 7 Jul 2017 01:32:13 +0000 (01:32 +0000)]
Auto merge of #42125 - petrochenkov:privty, r=nikomatsakis

Check types for privacy

This PR implements late post factum checking of type privacy, as opposed to early preventive "private-in-public" checking.
This will allow to turn private-in-public checks into a lint and make them more heuristic-based, and more aligned with what people may expect (e.g. reachability-based behavior).

Types are privacy-checked if they are written explicitly, and also if they are inferred as expression or pattern types.
This PR checks "semantic" types and does it unhygienically, this significantly restricts what macros 2.0 (as implemented in https://github.com/rust-lang/rust/pull/40847) can do (sorry @jseyfried) - they still can use private *names*, but can't use private *types*.
This is the most conservative solution, but hopefully it's temporary and can be relaxed in the future, probably using macro contexts of expression/pattern spans.

Traits are also checked in preparation for [trait aliases](https://github.com/rust-lang/rust/issues/41517), which will be able to leak private traits, and macros 2.0 which will be able to leak pretty much anything.

This is a [breaking-change], but the code that is not contrived and can be broken by this patch should be guarded by `private_in_public` lint. [Previous crater run](https://github.com/rust-lang/rust/issues/34537#issuecomment-262865768) discovered a few abandoned crates that weren't updated since `private_in_public` has been introduced in 2015.

cc https://github.com/rust-lang/rust/issues/34537 https://internals.rust-lang.org/t/lang-team-minutes-private-in-public-rules/4504
Fixes https://github.com/rust-lang/rust/issues/30476
Fixes https://github.com/rust-lang/rust/issues/33479

cc @nikomatsakis
r? @eddyb

7 years agoAddress review comments
petrochenkov [Thu, 29 Jun 2017 13:06:24 +0000 (16:06 +0300)]
Address review comments

Fix regressions after rebase

7 years agoAuto merge of #42904 - estebank:number-suggestions, r=nikomatsakis
bors [Thu, 6 Jul 2017 22:22:21 +0000 (22:22 +0000)]
Auto merge of #42904 - estebank:number-suggestions, r=nikomatsakis

Make suggestion include the line number

When there're more than one suggestions in the same diagnostic, they are
displayed in their own block, instead of inline. In order to reduce
confusion, those blocks now display the line number.

New output:

```
error[E0308]: mismatched types
  --> ../../src/test/ui/block-result/unexpected-return-on-unit.rs:19:5
   |
19 |     foo()
   |     ^^^^^ expected (), found usize
   |
   = note: expected type `()`
              found type `usize`
help: did you mean to add a semicolon here?
   |
19 |     foo();
   |          ^
help: possibly return type missing here?
   |
18 | fn bar() -> usize {
   |          ^^^^^^^^

error: aborting due to previous error(s)
```

Fix #39152.

7 years agoPrivileged in docker run isn't necessary
Aidan Hobson Sayers [Thu, 6 Jul 2017 17:42:49 +0000 (18:42 +0100)]
Privileged in docker run isn't necessary

7 years agoadd a built-in MSP430 target
Jorge Aparicio [Thu, 6 Jul 2017 20:15:44 +0000 (15:15 -0500)]
add a built-in MSP430 target

7 years agoOnly underline suggestion if it is not the only code being shown
Esteban Küber [Wed, 5 Jul 2017 23:39:06 +0000 (16:39 -0700)]
Only underline suggestion if it is not the only code being shown

7 years agoAdd extra whitespace for suggestions
Esteban Küber [Wed, 28 Jun 2017 06:16:04 +0000 (23:16 -0700)]
Add extra whitespace for suggestions

7 years agoMake suggestion include the line number
Esteban Küber [Sun, 25 Jun 2017 20:11:22 +0000 (13:11 -0700)]
Make suggestion include the line number

When there're more than one suggestions in the same diagnostic, they are
displayed in their own block, instead of inline. In order to reduce
confusion, those blocks now display the line number.

7 years agoCheck adjustments and node substs
Vadim Petrochenkov [Sat, 3 Jun 2017 14:51:32 +0000 (17:51 +0300)]
Check adjustments and node substs

Cleanup checking of inherent static methods and fix checking of inherent associated constants
Add more tests

7 years agoCheck types for privacy
Vadim Petrochenkov [Sat, 22 Apr 2017 19:46:34 +0000 (22:46 +0300)]
Check types for privacy

7 years agochange error URLs to footnote style
Alex Burka [Wed, 5 Jul 2017 21:13:07 +0000 (21:13 +0000)]
change error URLs to footnote style

7 years agofix description for E0617
Alex Burka [Wed, 5 Jul 2017 21:12:09 +0000 (21:12 +0000)]
fix description for E0617

It used to point to the Book, but no specific section, and in fact the
information is not in the Book (see rust-lang-nursery/reference#77).

7 years agoFix a couple broken links to the reference from error messages.
Corey Farwell [Tue, 13 Jun 2017 03:40:58 +0000 (23:40 -0400)]
Fix a couple broken links to the reference from error messages.

7 years agoAuto merge of #43092 - aidanhs:aphs-retry-llvm-tarball, r=alexcrichton
bors [Thu, 6 Jul 2017 19:56:55 +0000 (19:56 +0000)]
Auto merge of #43092 - aidanhs:aphs-retry-llvm-tarball, r=alexcrichton

Retry downloading llvm commit tarball

As promised on https://github.com/rust-lang/rust/pull/42816#issuecomment-312890169

r? @alexcrichton

7 years agoAdd annotations to the resize fn #39791
Ryan Thomas [Thu, 6 Jul 2017 19:25:53 +0000 (20:25 +0100)]
Add annotations to the resize fn #39791

This adds the `inline(never)` and `cold` annotations to the
HashMap::resize function.

7 years agoremove associated_consts feature gate
Sean McArthur [Thu, 6 Jul 2017 18:52:25 +0000 (11:52 -0700)]
remove associated_consts feature gate

7 years agoRetry downloading llvm commit tarball
Aidan Hobson Sayers [Thu, 6 Jul 2017 17:55:07 +0000 (18:55 +0100)]
Retry downloading llvm commit tarball

7 years agoAuto merge of #42816 - alexcrichton:probestack, r=nikomatsakis
bors [Thu, 6 Jul 2017 17:15:14 +0000 (17:15 +0000)]
Auto merge of #42816 - alexcrichton:probestack, r=nikomatsakis

rustc: Implement stack probes for x86

This commit implements stack probes on x86/x86_64 using the freshly landed
support upstream in LLVM. The purpose of stack probes here are to guarantee a
segfault on stack overflow rather than having a chance of running over the guard
page already present on all threads by accident.

At this time there's no support for any other architecture because LLVM itself
does not have support for other architectures.

7 years agorustc: Implement stack probes for x86
Alex Crichton [Wed, 21 Jun 2017 19:08:18 +0000 (12:08 -0700)]
rustc: Implement stack probes for x86

This commit implements stack probes on x86/x86_64 using the freshly landed
support upstream in LLVM. The purpose of stack probes here are to guarantee a
segfault on stack overflow rather than having a chance of running over the guard
page already present on all threads by accident.

At this time there's no support for any other architecture because LLVM itself
does not have support for other architectures.

7 years agorustdoc: Don't run Markdown tests twice
Oliver Middleton [Wed, 5 Jul 2017 14:47:54 +0000 (15:47 +0100)]
rustdoc: Don't run Markdown tests twice

This matches the behaviour for finding tests in Rust files.

7 years agoAuto merge of #43066 - pornel:patch-1, r=Mark-Simulacrum
bors [Thu, 6 Jul 2017 14:46:13 +0000 (14:46 +0000)]
Auto merge of #43066 - pornel:patch-1, r=Mark-Simulacrum

Suggest rustup toolchain link

The contributing instructions only explain how to build the compiler, but not how to try it out.

I found `rustup toolchain link` to be super useful for this, so I think it's good to suggest it.

7 years agoAuto merge of #43078 - kennytm:fix-42755-vis-can-be-empty, r=petrochenkov
bors [Thu, 6 Jul 2017 11:28:32 +0000 (11:28 +0000)]
Auto merge of #43078 - kennytm:fix-42755-vis-can-be-empty, r=petrochenkov

Disallow `$($v:vis)*`. Fix #42755.

#42755

7 years agoSuggest rustup toolchain link
Kornel [Wed, 5 Jul 2017 14:24:41 +0000 (15:24 +0100)]
Suggest rustup toolchain link

7 years agoDisallow `$($v:vis)*`. Fix #42755.
kennytm [Thu, 6 Jul 2017 00:18:58 +0000 (08:18 +0800)]
Disallow `$($v:vis)*`. Fix #42755.

7 years agoAuto merge of #43008 - zackmdavis:field_init_shorthand_in_librustc, r=estebank
bors [Thu, 6 Jul 2017 07:49:44 +0000 (07:49 +0000)]
Auto merge of #43008 - zackmdavis:field_init_shorthand_in_librustc, r=estebank

use field init shorthand in src/librustc/

Commentary on #37340 [suggested](https://github.com/rust-lang/rust/issues/37340#issuecomment-255513390) using the new field init syntax in the compiler. Do we care about this? If so, here's a pull request for the librustc/ directory. While [`rustfmt` might do this in the future](https://github.com/rust-lang/rust/issues/37340#issuecomment-255513712), in the meantime, some simple Python will do:

```python
#!/usr/bin/env python3

import os, re, sys

OPPORTUNITY = re.compile(r" (\w+): \1,?\n")

def field_init_shorthand_substitution(filename):
    with open(filename) as f:
        text = f.read()
        revised = OPPORTUNITY.sub(r" \1,\n", text)
    with open(filename, 'w') as f:
        f.write(revised)

def substitute_in_directory(path):
    for dirname, _subdirs, basenames in os.walk(path):
        for basename in basenames:
            field_init_shorthand_substitution(os.path.join(dirname, basename))

if __name__ == "__main__":
    substitute_in_directory(sys.argv[1])
```

**Update 3 July**: edited the search (respectively replace) regex to ` (\w+): \1,?\n` (` \1,\n`) from ` (\w+): \1,` (` \1,`)

7 years agouse field init shorthand in src/librustc
Zack M. Davis [Mon, 3 Jul 2017 18:19:51 +0000 (11:19 -0700)]
use field init shorthand in src/librustc

The field init shorthand syntax was stabilized in 1.17.0 (aebd94f); we
are now free to use it in the compiler.

7 years agoAuto merge of #43001 - estebank:try-on-unimplemented, r=aturon
bors [Thu, 6 Jul 2017 05:29:09 +0000 (05:29 +0000)]
Auto merge of #43001 - estebank:try-on-unimplemented, r=aturon

Add `rustc_on_unimplemented` message to `std::ops::Try`

#42694, #35946.

7 years agoAdd `rustc_on_unimplemented` message to `std::ops::Try`
Esteban Küber [Sat, 1 Jul 2017 00:11:12 +0000 (17:11 -0700)]
Add `rustc_on_unimplemented` message to `std::ops::Try`

7 years agoAuto merge of #42899 - alexcrichton:compiler-builtins, r=nikomatsakis
bors [Thu, 6 Jul 2017 02:34:29 +0000 (02:34 +0000)]
Auto merge of #42899 - alexcrichton:compiler-builtins, r=nikomatsakis

Switch to rust-lang-nursery/compiler-builtins

This commit migrates the in-tree `libcompiler_builtins` to the upstream version
at https://github.com/rust-lang-nursery/compiler-builtins. The upstream version
has a number of intrinsics written in Rust and serves as an in-progress rewrite
of compiler-rt into Rust. Additionally it also contains all the existing
intrinsics defined in `libcompiler_builtins` for 128-bit integers.

It's been the intention since the beginning to make this transition but
previously it just lacked the manpower to get done. As this PR likely shows it
wasn't a trivial integration! Some highlight changes are:

* The PR rust-lang-nursery/compiler-builtins#166 contains a number of fixes
  across platforms and also some refactorings to make the intrinsics easier to
  read. The additional testing added there also fixed a number of integration
  issues when pulling the repository into this tree.

* LTO with the compiler-builtins crate was fixed to link in the entire crate
  after the LTO process as these intrinsics are excluded from LTO.

* Treatment of hidden symbols was updated as previously the
  `#![compiler_builtins]` crate would mark all symbol *imports* as hidden
  whereas it was only intended to mark *exports* as hidden.

7 years agoAuto merge of #42727 - alexcrichton:allocators-new, r=eddyb
bors [Thu, 6 Jul 2017 00:16:16 +0000 (00:16 +0000)]
Auto merge of #42727 - alexcrichton:allocators-new, r=eddyb

rustc: Implement the #[global_allocator] attribute

This PR is an implementation of [RFC 1974] which specifies a new method of
defining a global allocator for a program. This obsoletes the old
`#![allocator]` attribute and also removes support for it.

[RFC 1974]: https://github.com/rust-lang/rfcs/pull/1974

The new `#[global_allocator]` attribute solves many issues encountered with the
`#![allocator]` attribute such as composition and restrictions on the crate
graph itself. The compiler now has much more control over the ABI of the
allocator and how it's implemented, allowing much more freedom in terms of how
this feature is implemented.

cc #27389

7 years agorustc: Implement the #[global_allocator] attribute
Alex Crichton [Sat, 3 Jun 2017 21:54:08 +0000 (14:54 -0700)]
rustc: Implement the #[global_allocator] attribute

This PR is an implementation of [RFC 1974] which specifies a new method of
defining a global allocator for a program. This obsoletes the old
`#![allocator]` attribute and also removes support for it.

[RFC 1974]: https://github.com/rust-lang/rfcs/pull/197

The new `#[global_allocator]` attribute solves many issues encountered with the
`#![allocator]` attribute such as composition and restrictions on the crate
graph itself. The compiler now has much more control over the ABI of the
allocator and how it's implemented, allowing much more freedom in terms of how
this feature is implemented.

cc #27389

7 years agoAuto merge of #40939 - jseyfried:proc_macro_api, r=nrc
bors [Wed, 5 Jul 2017 21:16:34 +0000 (21:16 +0000)]
Auto merge of #40939 - jseyfried:proc_macro_api, r=nrc

proc_macro: implement `TokenTree`, `TokenKind`, hygienic `quote!`, and other API

All new API is gated behind `#![feature(proc_macro)]` and may be used with `#[proc_macro]`, `#[proc_macro_attribute]`, and `#[proc_macro_derive]` procedural macros.

More specifically, this PR adds the following in `proc_macro`:
```rust
// `TokenStream` constructors:
impl TokenStream { fn empty() -> TokenStream { ... } }
impl From<TokenTree> for TokenStream { ... }
impl From<TokenKind> for TokenStream { ... }
impl<T: Into<TokenStream>> FromIterator<T> for TokenStream { ... }
macro quote($($t:tt)*) { ... } // A hygienic `TokenStream` quoter

// `TokenStream` destructuring:
impl TokenStream { fn is_empty(&self) -> bool { ... } }
impl IntoIterator for TokenStream { type Item = TokenTree; ... }

struct TokenTree { span: Span, kind: TokenKind }
impl From<TokenKind> for TokenTree { ... }
impl Display for TokenTree { ... }

struct Span { ... } // a region of source code along with expansion/hygiene information
impl Default for Span { ... } // a span from the current procedural macro definition
impl Span { fn call_site() -> Span { ... } } // the call site of the current expansion
fn quote_span(span: Span) -> TokenStream;

enum TokenKind {
    Group(Delimiter, TokenStream), // A delimited sequence, e.g. `( ... )`
    Term(Term), // a unicode identifier, lifetime ('a), or underscore
    Op(char, Spacing), // a punctuation character (`+`, `,`, `$`, etc.).
    Literal(Literal), // a literal character (`'a'`), string (`"hello"`), or number (`2.3`)
}

enum Delimiter {
    Parenthesis, // `( ... )`
    Brace, // `[ ... ]`
    Bracket, // `{ ... }`
    None, // an implicit delimiter, e.g. `$var`, where $var is  `...`.
}

struct Term { ... } // An interned string
impl Term {
    fn intern(string: &str) -> Symbol { ... }
    fn as_str(&self) -> &str { ... }
}

enum Spacing {
    Alone, // not immediately followed by another `Op`, e.g. `+` in `+ =`.
    Joint, // immediately followed by another `Op`, e.g. `+` in `+=`
}

struct Literal { ... }
impl Display for Literal { ... }
impl Literal {
    fn integer(n: i128) -> Literal { .. } // unsuffixed integer literal
    fn float(n: f64) -> Literal { .. } // unsuffixed floating point literal
    fn u8(n: u8) -> Literal { ... } // similarly: i8, u16, i16, u32, i32, u64, i64, f32, f64
    fn string(string: &str) -> Literal { ... }
    fn character(ch: char) -> Literal { ... }
    fn byte_string(bytes: &[u8]) -> Literal { ... }
}
```
For details on `quote!` hygiene, see [this example](https://github.com/rust-lang/rust/pull/40939/commits/20a90485c040df87a667e9b6ee38e4d8a7d7fc5d) and [declarative macros 2.0](https://github.com/rust-lang/rust/pull/40847).

r? @nrc

7 years agorustbuild: Only -Zsave-analysis for libstd
Alex Crichton [Wed, 5 Jul 2017 20:51:34 +0000 (13:51 -0700)]
rustbuild: Only -Zsave-analysis for libstd

Don't pass the flag when we're compiling the compiler or other related tools

7 years agoMerge remote-tracking branch 'origin/master' into proc_macro_api
Alex Crichton [Wed, 5 Jul 2017 15:42:13 +0000 (08:42 -0700)]
Merge remote-tracking branch 'origin/master' into proc_macro_api

7 years agoSwitch to rust-lang-nursery/compiler-builtins
Alex Crichton [Thu, 22 Jun 2017 20:14:00 +0000 (13:14 -0700)]
Switch to rust-lang-nursery/compiler-builtins

This commit migrates the in-tree `libcompiler_builtins` to the upstream version
at https://github.com/rust-lang-nursery/compiler-builtins. The upstream version
has a number of intrinsics written in Rust and serves as an in-progress rewrite
of compiler-rt into Rust. Additionally it also contains all the existing
intrinsics defined in `libcompiler_builtins` for 128-bit integers.

It's been the intention since the beginning to make this transition but
previously it just lacked the manpower to get done. As this PR likely shows it
wasn't a trivial integration! Some highlight changes are:

* The PR rust-lang-nursery/compiler-builtins#166 contains a number of fixes
  across platforms and also some refactorings to make the intrinsics easier to
  read. The additional testing added there also fixed a number of integration
  issues when pulling the repository into this tree.

* LTO with the compiler-builtins crate was fixed to link in the entire crate
  after the LTO process as these intrinsics are excluded from LTO.

* Treatment of hidden symbols was updated as previously the
  `#![compiler_builtins]` crate would mark all symbol *imports* as hidden
  whereas it was only intended to mark *exports* as hidden.

7 years agoAuto merge of #42972 - GuillaumeGomez:fix-toggles-rustdoc, r=QuietMisdreavus
bors [Wed, 5 Jul 2017 13:56:32 +0000 (13:56 +0000)]
Auto merge of #42972 - GuillaumeGomez:fix-toggles-rustdoc, r=QuietMisdreavus

Toggle wrappers are now generated correctly

Fixes #42674.

7 years agoAuto merge of #43050 - stjepang:doc-vec-fix-parens, r=frewsxcv
bors [Wed, 5 Jul 2017 02:04:07 +0000 (02:04 +0000)]
Auto merge of #43050 - stjepang:doc-vec-fix-parens, r=frewsxcv

Minor fix in docs for Vec

Added missing parentheses after `mem::size_of::<T>`.