]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agorustdoc: Hide `-> ()` in cross crate inlined Fn* bounds
Oliver Middleton [Wed, 7 Feb 2018 13:14:37 +0000 (13:14 +0000)]
rustdoc: Hide `-> ()` in cross crate inlined Fn* bounds

6 years agoAuto merge of #45752 - estebank:highlight-primary, r=nikomatsakis
bors [Wed, 31 Jan 2018 07:53:57 +0000 (07:53 +0000)]
Auto merge of #45752 - estebank:highlight-primary, r=nikomatsakis

Highlight code on diagnostics when underlined

Highlight the label's span with the respective color:

<img width="692" alt="" src="https://user-images.githubusercontent.com/1606434/32411026-a1842482-c18d-11e7-9933-6510eefbad19.png">

Fix #42112.

6 years agoAuto merge of #46666 - clarcharr:duration_core, r=alexcrichton
bors [Wed, 31 Jan 2018 04:16:12 +0000 (04:16 +0000)]
Auto merge of #46666 - clarcharr:duration_core, r=alexcrichton

Move Duration to libcore

Fixes #46520; should be merged after #46508.

6 years agoAuto merge of #47870 - kennytm:rollup, r=kennytm
bors [Tue, 30 Jan 2018 11:10:06 +0000 (11:10 +0000)]
Auto merge of #47870 - kennytm:rollup, r=kennytm

Rollup of 12 pull requests

- Successful merges: #47515, #47603, #47718, #47732, #47760, #47780, #47822, #47826, #47836, #47839, #47853, #47855
- Failed merges:

6 years agoRollup merge of #47855 - ollie27:rustdoc_hoedown_link_title, r=QuietMisdreavus
kennytm [Tue, 30 Jan 2018 09:11:00 +0000 (17:11 +0800)]
Rollup merge of #47855 - ollie27:rustdoc_hoedown_link_title, r=QuietMisdreavus

rustdoc: Fix link title rendering with hoedown

The link title needs to be HTML escaped.

It was broken by #47046.

r? @QuietMisdreavus

6 years agoRollup merge of #47853 - rust-lang:increase-nested-groups-test-coverage, r=nikomatsakis
kennytm [Tue, 30 Jan 2018 09:10:59 +0000 (17:10 +0800)]
Rollup merge of #47853 - rust-lang:increase-nested-groups-test-coverage, r=nikomatsakis

Increase test coverage of use_nested_groups

r? @nikomatsakis

6 years agoRollup merge of #47839 - frewsxcv:frewsxcv-map-index, r=QuietMisdreavus
kennytm [Tue, 30 Jan 2018 09:10:58 +0000 (17:10 +0800)]
Rollup merge of #47839 - frewsxcv:frewsxcv-map-index, r=QuietMisdreavus

Document that `Index` ops can panic on `HashMap` & `BTreeMap`.

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

6 years agoRollup merge of #47836 - Mark-Simulacrum:stage-flags, r=alexcrichton
kennytm [Tue, 30 Jan 2018 09:10:57 +0000 (17:10 +0800)]
Rollup merge of #47836 - Mark-Simulacrum:stage-flags, r=alexcrichton

Add per-stage RUSTFLAGS: RUSTFLAGS_STAGE_{0,1,2} and RUSTFLAGS_STAGE_NOT_0

Fixes #47658.

r? @alexcrichton

6 years agoRollup merge of #47826 - gnzlbg:patch-2, r=alexcrichton
kennytm [Tue, 30 Jan 2018 09:10:56 +0000 (17:10 +0800)]
Rollup merge of #47826 - gnzlbg:patch-2, r=alexcrichton

Whitelist v7 feature for ARM and AARCH64.

Needed for `v7` features in `coresimd`.

See https://github.com/rust-lang-nursery/stdsimd/blob/b2f7be24d5043a88427f9a5258ca9a51ede6d029/coresimd/src/arm/v7.rs#L40 which used to work but doesn't anymore.

r? alexcrichton

6 years agoRollup merge of #47822 - gnzlbg:patch-1, r=alexcrichton
kennytm [Tue, 30 Jan 2018 09:10:55 +0000 (17:10 +0800)]
Rollup merge of #47822 - gnzlbg:patch-1, r=alexcrichton

Whitelist aes x86 feature flag

Required to fix https://github.com/rust-lang-nursery/stdsimd/issues/295 in stdsimd.

Closes #44544 .

r? @alexcrichton

6 years agoRollup merge of #47780 - varkor:cross-file-errors-line-col, r=estebank
kennytm [Tue, 30 Jan 2018 09:10:54 +0000 (17:10 +0800)]
Rollup merge of #47780 - varkor:cross-file-errors-line-col, r=estebank

Add line numbers and columns to error messages spanning multiple files

If an error message is emitted that spans several files, only the
primary file currently has line and column data attached. This is
useful information, even in files other than the one in which the error
occurs. We can often work out which line and column the error
corresponds to in other files — in this case it is helpful to add them
(in the case of ambiguity, the first relevant line/column is picked,
which is still helpful than none).

6 years agoRollup merge of #47760 - little-dude:master, r=alexcrichton
kennytm [Tue, 30 Jan 2018 09:10:53 +0000 (17:10 +0800)]
Rollup merge of #47760 - little-dude:master, r=alexcrichton

implement Send for process::Command on unix

closes https://github.com/rust-lang/rust/issues/47751

6 years agoRollup merge of #47732 - mark-i-m:markim_comments_0001, r=jseyfried
kennytm [Tue, 30 Jan 2018 09:10:52 +0000 (17:10 +0800)]
Rollup merge of #47732 - mark-i-m:markim_comments_0001, r=jseyfried

Run rustfmt and add doc comments to libsyntax/ext/tt/macro_parser.rs

Similar to #47603

cc @theotherphil since you reviewed my other PR :smile:

And because they are already assigned on #47603:

r? @arielb1

6 years agoRollup merge of #47718 - malbarbo:env-home-dir, r=nikomatsakis
kennytm [Tue, 30 Jan 2018 09:10:51 +0000 (17:10 +0800)]
Rollup merge of #47718 - malbarbo:env-home-dir, r=nikomatsakis

Make run-pass/env-home-dir.rs test more robust

Remove the assumption that home_dir always returns Some.

This allows the test to be executed with [cross](https://github.com/japaric/cross).

6 years agoRollup merge of #47603 - mark-i-m:markim_comments_0000, r=jseyfried
kennytm [Tue, 30 Jan 2018 09:10:49 +0000 (17:10 +0800)]
Rollup merge of #47603 - mark-i-m:markim_comments_0000, r=jseyfried

Run rustfmt and add doc comments to libsyntax/ext/tt/quoted.rs

I was already going to try to understand this code to try to implement rust-lang/rfcs#2298. I figured I would put that knowledge into comments and share... This PR contains _no changes_ to the code itself -- just formatting and comments.

I'm not sure what the best way to do this is. I plan to make more such PR for other files, but I figured it would have fewer conflicts if I do it file by file...

6 years agoRollup merge of #47515 - jimmantooth:patch-1, r=QuietMisdreavus
kennytm [Tue, 30 Jan 2018 09:10:48 +0000 (17:10 +0800)]
Rollup merge of #47515 - jimmantooth:patch-1, r=QuietMisdreavus

Punctuation and clarity fixes.

6 years agoAuto merge of #45294 - petrochenkov:prioplus, r=nikomatsakis
bors [Tue, 30 Jan 2018 08:23:41 +0000 (08:23 +0000)]
Auto merge of #45294 - petrochenkov:prioplus, r=nikomatsakis

syntax: Lower priority of `+` in `impl Trait`/`dyn Trait`

Now you have to write `Fn() -> (impl A + B)` instead of `Fn() -> impl A + B`, this is consistent with priority of `+` in trait objects (`Fn() -> A + B` means `(Fn() -> A) + B`).

To make this viable I changed the syntax to also permit `+` in return types in function declarations
```
fn f() -> dyn A + B { ... } // OK, don't have to write `-> (dyn A + B)`

// This is acceptable, because `dyn A + B` here is an isolated type and
// not part of a larger type with various operator priorities in play
// like `dyn A + B` in `Fn() -> dyn A + B` despite syntax similarities.
```
but you still have to use `-> (dyn A + B)` in function types and function-like trait object types (see this PR's tests for examples).

This can be a breaking change for code using `impl Trait` on nightly. The thing that is most likely to break is `&impl A + B`, it needs to be rewritten as `&(impl A + B)`.

cc https://github.com/rust-lang/rust/issues/34511 https://github.com/rust-lang/rust/issues/44662 https://github.com/rust-lang/rfcs/pull/438

6 years agoMove time::Duration to libcore
Clar Charr [Mon, 11 Dec 2017 18:42:01 +0000 (13:42 -0500)]
Move time::Duration to libcore

6 years agofix typos
Mark Mansi [Mon, 29 Jan 2018 23:08:04 +0000 (17:08 -0600)]
fix typos

6 years agoUpdate comment
Mark Mansi [Mon, 29 Jan 2018 22:37:57 +0000 (16:37 -0600)]
Update comment

6 years agoAuto merge of #47837 - eddyb:going-places, r=nikomatsakis
bors [Mon, 29 Jan 2018 19:47:48 +0000 (19:47 +0000)]
Auto merge of #47837 - eddyb:going-places, r=nikomatsakis

Replace "lvalue" terminology with "place".

See #46425 for the previous PR (which only changed MIR-related code).

r? @nikomatsakis

6 years agorustdoc: Fix link title rendering with hoedown
Oliver Middleton [Mon, 29 Jan 2018 16:44:35 +0000 (16:44 +0000)]
rustdoc: Fix link title rendering with hoedown

The link title needs to be HTML escaped.

6 years agomove comment right onto the line in question
Niko Matsakis [Mon, 29 Jan 2018 18:28:23 +0000 (13:28 -0500)]
move comment right onto the line in question

6 years agoMake run-pass/env-home-dir.rs test more robust
Marco A L Barbosa [Wed, 24 Jan 2018 17:11:15 +0000 (15:11 -0200)]
Make run-pass/env-home-dir.rs test more robust

Remove the assumption that home_dir always returns Some

This allows the test to be executed with
[cross](https://github.com/japaric/cross).

6 years agoToggle span highlighting on `-Zteach`
Esteban Küber [Mon, 29 Jan 2018 02:37:55 +0000 (18:37 -0800)]
Toggle span highlighting on `-Zteach`

6 years agoIncrease test coverage of use_nested_groups
Pietro Albini [Mon, 29 Jan 2018 16:11:09 +0000 (17:11 +0100)]
Increase test coverage of use_nested_groups

6 years agoAdd per-stage RUSTFLAGS: RUSTFLAGS_STAGE_{0,1,2} and RUSTFLAGS_STAGE_NOT_0
Mark Simulacrum [Mon, 29 Jan 2018 00:09:47 +0000 (17:09 -0700)]
Add per-stage RUSTFLAGS: RUSTFLAGS_STAGE_{0,1,2} and RUSTFLAGS_STAGE_NOT_0

Fixes #47658.

6 years agoAuto merge of #47766 - spastorino:inference-dirty-list, r=nikomatsakis
bors [Mon, 29 Jan 2018 10:51:07 +0000 (10:51 +0000)]
Auto merge of #47766 - spastorino:inference-dirty-list, r=nikomatsakis

Make region inference use a dirty list

r? @nikomatsakis

6 years agorustc_borrowck: replace "lvalue" terminology with "place" in docs.
Eduard-Mihai Burtescu [Mon, 29 Jan 2018 00:25:35 +0000 (02:25 +0200)]
rustc_borrowck: replace "lvalue" terminology with "place" in docs.

6 years agotests: replace "lvalue" terminology with "place".
Eduard-Mihai Burtescu [Sun, 28 Jan 2018 23:59:34 +0000 (01:59 +0200)]
tests: replace "lvalue" terminology with "place".

6 years agoAuto merge of #47730 - alexcrichton:multitrans, r=Mark-Simulacrum
bors [Mon, 29 Jan 2018 04:55:47 +0000 (04:55 +0000)]
Auto merge of #47730 - alexcrichton:multitrans, r=Mark-Simulacrum

rustc: Split Emscripten to a separate codegen backend

This commit introduces a separately compiled backend for Emscripten, avoiding
compiling the `JSBackend` target in the main LLVM codegen backend. This builds
on the foundation provided by #47671 to create a new codegen backend dedicated
solely to Emscripten, removing the `JSBackend` of the main codegen backend in
the process.

A new field was added to each target for this commit which specifies the backend
to use for translation, the default being `llvm` which is the main backend that
we use. The Emscripten targets specify an `emscripten` backend instead of the
main `llvm` one.

There's a whole bunch of consequences of this change, but I'll try to enumerate
them here:

* A *second* LLVM submodule was added in this commit. The main LLVM submodule
  will soon start to drift from the Emscripten submodule, but currently they're
  both at the same revision.
* Logic was added to rustbuild to *not* build the Emscripten backend by default.
  This is gated behind a `--enable-emscripten` flag to the configure script. By
  default users should neither check out the emscripten submodule nor compile
  it.
* The `init_repo.sh` script was updated to fetch the Emscripten submodule from
  GitHub the same way we do the main LLVM submodule (a tarball fetch).
* The Emscripten backend, turned off by default, is still turned on for a number
  of targets on CI. We'll only be shipping an Emscripten backend with Tier 1
  platforms, though. All cross-compiled platforms will not be receiving an
  Emscripten backend yet.

This commit means that when you download the `rustc` package in Rustup for Tier
1 platforms you'll be receiving two trans backends, one for Emscripten and one
that's the general LLVM backend. If you never compile for Emscripten you'll
never use the Emscripten backend, so we may update this one day to only download
the Emscripten backend when you add the Emscripten target. For now though it's
just an extra 10MB gzip'd.

Closes #46819

6 years agoDocument that `Index` ops can panic on `HashMap` & `BTreeMap`.
Corey Farwell [Mon, 29 Jan 2018 02:50:01 +0000 (21:50 -0500)]
Document that `Index` ops can panic on `HashMap` & `BTreeMap`.

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

6 years agorustc: Split Emscripten to a separate codegen backend
Alex Crichton [Wed, 24 Jan 2018 16:22:34 +0000 (08:22 -0800)]
rustc: Split Emscripten to a separate codegen backend

This commit introduces a separately compiled backend for Emscripten, avoiding
compiling the `JSBackend` target in the main LLVM codegen backend. This builds
on the foundation provided by #47671 to create a new codegen backend dedicated
solely to Emscripten, removing the `JSBackend` of the main codegen backend in
the process.

A new field was added to each target for this commit which specifies the backend
to use for translation, the default being `llvm` which is the main backend that
we use. The Emscripten targets specify an `emscripten` backend instead of the
main `llvm` one.

There's a whole bunch of consequences of this change, but I'll try to enumerate
them here:

* A *second* LLVM submodule was added in this commit. The main LLVM submodule
  will soon start to drift from the Emscripten submodule, but currently they're
  both at the same revision.
* Logic was added to rustbuild to *not* build the Emscripten backend by default.
  This is gated behind a `--enable-emscripten` flag to the configure script. By
  default users should neither check out the emscripten submodule nor compile
  it.
* The `init_repo.sh` script was updated to fetch the Emscripten submodule from
  GitHub the same way we do the main LLVM submodule (a tarball fetch).
* The Emscripten backend, turned off by default, is still turned on for a number
  of targets on CI. We'll only be shipping an Emscripten backend with Tier 1
  platforms, though. All cross-compiled platforms will not be receiving an
  Emscripten backend yet.

This commit means that when you download the `rustc` package in Rustup for Tier
1 platforms you'll be receiving two trans backends, one for Emscripten and one
that's the general LLVM backend. If you never compile for Emscripten you'll
never use the Emscripten backend, so we may update this one day to only download
the Emscripten backend when you add the Emscripten target. For now though it's
just an extra 10MB gzip'd.

Closes #46819

6 years agoHighlight code on diagnostics when underlined
Esteban Küber [Mon, 2 Oct 2017 22:28:52 +0000 (15:28 -0700)]
Highlight code on diagnostics when underlined

6 years agorustc: replace "lvalue" terminology with "place" in the code.
Eduard-Mihai Burtescu [Sun, 28 Jan 2018 23:49:29 +0000 (01:49 +0200)]
rustc: replace "lvalue" terminology with "place" in the code.

6 years agoAuto merge of #47663 - malbarbo:mips-crt-static, r=alexcrichton
bors [Sun, 28 Jan 2018 23:30:15 +0000 (23:30 +0000)]
Auto merge of #47663 - malbarbo:mips-crt-static, r=alexcrichton

Do not assume dynamic linking for musl/mips[el] targets

All musl targets except mips[el] assume static linking by default. This can be [confusing](https://users.rust-lang.org/t/static-cross-compiled-binaries-arent-really-static/6084).

When the musl/mips[el] targets was [added](https://github.com/rust-lang/rust/pull/31298), dynamic linking was chosen because of binary size concerns, and probably also because libunwind [didn't](https://users.rust-lang.org/t/static-cross-compiled-binaries-arent-really-static/6084/8) supported mips.

Now that we have `crt-static` target-feature (the user can choose dynamic link for musl targets), and libunwind [6.0](https://github.com/llvm-mirror/libunwind/commits/release_60) add support to mips, we do not need to assume dynamic linking.

6 years agorustc: move `expr_is_lval` to rustc_typeck and rename to `is_place_expr`.
Eduard-Mihai Burtescu [Sun, 28 Jan 2018 23:16:02 +0000 (01:16 +0200)]
rustc: move `expr_is_lval` to rustc_typeck and rename to `is_place_expr`.

6 years agorustc_typeck: rename `LvalueOp` to `PlaceOp`.
Eduard-Mihai Burtescu [Sun, 28 Jan 2018 22:55:39 +0000 (00:55 +0200)]
rustc_typeck: rename `LvalueOp` to `PlaceOp`.

6 years agorustc_typeck: rename `LvaluePreference::PreferMutLvalue` to `Needs::MutPlace`.
Eduard-Mihai Burtescu [Sun, 28 Jan 2018 22:51:34 +0000 (00:51 +0200)]
rustc_typeck: rename `LvaluePreference::PreferMutLvalue` to `Needs::MutPlace`.

6 years agorustc: remove `LvaluePreference` argument from `Ty::builtin_deref`.
Eduard-Mihai Burtescu [Sun, 28 Jan 2018 21:29:40 +0000 (23:29 +0200)]
rustc: remove `LvaluePreference` argument from `Ty::builtin_deref`.

6 years agoAuto merge of #47204 - varkor:unsafecell-into_inner-safe, r=alexcrichton
bors [Sun, 28 Jan 2018 19:01:51 +0000 (19:01 +0000)]
Auto merge of #47204 - varkor:unsafecell-into_inner-safe, r=alexcrichton

Make UnsafeCell::into_inner safe

This fixes #35067. It will require a Crater run as discussed in that
issue.

6 years agoWhitelist v7 feature for ARM and AARCH64.
gnzlbg [Sun, 28 Jan 2018 17:50:03 +0000 (18:50 +0100)]
Whitelist v7 feature for ARM and AARCH64.

Needed for `v7` features in `coresimd`.

See https://github.com/rust-lang-nursery/stdsimd/blob/b2f7be24d5043a88427f9a5258ca9a51ede6d029/coresimd/src/arm/v7.rs#L40 which used to work but doesn't anymore.

r? alexcrichton

6 years agoAuto merge of #47800 - Pulkit07:issue47755, r=sfackler
bors [Sun, 28 Jan 2018 16:17:18 +0000 (16:17 +0000)]
Auto merge of #47800 - Pulkit07:issue47755, r=sfackler

don't mention tasks in stability warnings of #[thread_local] #47755

This is a fix for issue #47755.

6 years agoAuto merge of #47794 - etaoins:fix-ice-on-const-eval-of-union-field, r=eddyb
bors [Sun, 28 Jan 2018 13:24:47 +0000 (13:24 +0000)]
Auto merge of #47794 - etaoins:fix-ice-on-const-eval-of-union-field, r=eddyb

Fix ICE on const eval of union field

MIR's `Const::get_field()` attempts to retrieve the value for a given field in a constant. In the case of a union constant it was falling through to a generic `const_get_elt` based on the field index. As union fields don't have an index this caused an ICE in `llvm_field_index`.

Fix by simply returning the current value when accessing any field in a union. This works because all union fields start at byte offset 0.

The added test uses `const_fn` it ensure the field is extracted using MIR's const evaluation. The crash is reproducible without it, however.

Fixes #47788

r? @eddyb

6 years agoWhitelist aes x86 feature flag
gnzlbg [Sun, 28 Jan 2018 12:47:06 +0000 (13:47 +0100)]
Whitelist aes x86 feature flag

Required to fix https://github.com/rust-lang-nursery/stdsimd/issues/295 in stdsimd.

r? @alexcrichton

6 years agoAuto merge of #47772 - arthurprs:iter-position-bounds-check, r=dtolnay
bors [Sun, 28 Jan 2018 10:41:34 +0000 (10:41 +0000)]
Auto merge of #47772 - arthurprs:iter-position-bounds-check, r=dtolnay

Use the slice length to hint the optimizer about iter.position result

Using the len of the iterator doesn't give the same result.
That's also why we can't generalize it to all TrustedLen iterators.

Problem demo: https://godbolt.org/g/MXg2ae
Fix demo: https://godbolt.org/g/P8q5aZ

Second attempt of #47333
Third attempt of #45501
Fixes #45964

6 years agoAuto merge of #47767 - estebank:as-suggestion, r=petrochenkov
bors [Sun, 28 Jan 2018 07:44:14 +0000 (07:44 +0000)]
Auto merge of #47767 - estebank:as-suggestion, r=petrochenkov

Correctly format `extern crate` conflict resolution help

Closes #45799. Follow up to @Cldfire's #45820.

If the `extern` statement that will have a suggestion ends on a `;`, synthesize a new span that doesn't include it.

6 years agoAuto merge of #47671 - alexcrichton:trans-c-api-only, r=Mark-Simulacrum
bors [Sun, 28 Jan 2018 03:40:26 +0000 (03:40 +0000)]
Auto merge of #47671 - alexcrichton:trans-c-api-only, r=Mark-Simulacrum

rustc: Load the `rustc_trans` crate at runtime

Building on the work of #45684 this commit updates the compiler to
unconditionally load the `rustc_trans` crate at runtime instead of linking to it
at compile time. The end goal of this work is to implement #46819 where rustc
will have multiple backends available to it to load.

This commit starts off by removing the `extern crate rustc_trans` from the
driver. This involved moving some miscellaneous functionality into the
`TransCrate` trait and also required an implementation of how to locate and load
the trans backend. This ended up being a little tricky because the sysroot isn't
always the right location (for example `--sysroot` arguments) so some extra code
was added as well to probe a directory relative to the current dll (the
rustc_driver dll).

Rustbuild has been updated accordingly as well to have a separate compilation
invocation for the `rustc_trans` crate and assembly it accordingly into the
sysroot. Finally, the distribution logic for the `rustc` package was also
updated to slurp up the trans backends folder.

A number of assorted fallout changes were included here as well to ensure tests
pass and such, and they should all be commented inline.

6 years agorustc: Load the `rustc_trans` crate at runtime
Alex Crichton [Mon, 22 Jan 2018 15:29:24 +0000 (07:29 -0800)]
rustc: Load the `rustc_trans` crate at runtime

Building on the work of # 45684 this commit updates the compiler to
unconditionally load the `rustc_trans` crate at runtime instead of linking to it
at compile time. The end goal of this work is to implement # 46819 where rustc
will have multiple backends available to it to load.

This commit starts off by removing the `extern crate rustc_trans` from the
driver. This involved moving some miscellaneous functionality into the
`TransCrate` trait and also required an implementation of how to locate and load
the trans backend. This ended up being a little tricky because the sysroot isn't
always the right location (for example `--sysroot` arguments) so some extra code
was added as well to probe a directory relative to the current dll (the
rustc_driver dll).

Rustbuild has been updated accordingly as well to have a separate compilation
invocation for the `rustc_trans` crate and assembly it accordingly into the
sysroot. Finally, the distribution logic for the `rustc` package was also
updated to slurp up the trans backends folder.

A number of assorted fallout changes were included here as well to ensure tests
pass and such, and they should all be commented inline.

6 years agoAuto merge of #47746 - varkor:never-type-ice, r=nikomatsakis
bors [Sun, 28 Jan 2018 00:40:10 +0000 (00:40 +0000)]
Auto merge of #47746 - varkor:never-type-ice, r=nikomatsakis

Fix never-type rvalue ICE

This fixes #43061.
r? @nikomatsakis

A small post-mortem as a follow-up to our investigations in https://github.com/rust-lang/rust/pull/47291:
The problem as I understand it is that when `NeverToAny` coercions are made, the expression/statement that is coerced may be enclosed in a block. In our case, the statement `x;` was being transformed to something like: `NeverToAny( {x;} )`. Then, `NeverToAny` is transformed into an expression:
https://github.com/rust-lang/rust/blob/000fbbc9b8f88adc6a417f1caef41161f104250f/src/librustc_mir/build/expr/into.rs#L52-L59
Which ends up calling `ast_block_stmts` on the block `{x;}`, which triggers this condition:
https://github.com/rust-lang/rust/blob/000fbbc9b8f88adc6a417f1caef41161f104250f/src/librustc_mir/build/block.rs#L141-L147
In our case, there is no return expression, so `push_assign_unit` is called. But the block has already been recorded as _diverging_, meaning the result of the block will be assigned to a location of type `!`, rather than `()`. This causes the MIR error.
I'm assuming the `NeverToAny` coercion code is doing what it's supposed to (there don't seem to be any other problems), so fixing the issue simply consists of checking that the destination for the return value actually _is_ supposed to be a unit. (If no return value is given, the only other possible type for the return value is `!`, which can just be ignored, as it will be unreachable anyway.)

I checked the other cases of `push_assign_unit`, and it didn't look like they could be affected by the divergence issue (blocks are kind of special-cased in this regard as far as I can tell), so this should be sufficient to fix the issue.

6 years agoRemove musl/libunwind patch for i686
Marco A L Barbosa [Sat, 27 Jan 2018 22:57:10 +0000 (20:57 -0200)]
Remove musl/libunwind patch for i686

The i686 problem was fixed upstream:
https://github.com/llvm-mirror/libunwind/commit/aa805e415f19f50ebc6f5e1e1e4bf9bb7f61816b

6 years agoAuto merge of #47420 - davidtwco:issue-46885, r=estebank
bors [Sat, 27 Jan 2018 19:41:40 +0000 (19:41 +0000)]
Auto merge of #47420 - davidtwco:issue-46885, r=estebank

Fix off-by-one spans in MIR borrowck errors

Fixes #46885.

r? @nikomatsakis

6 years agoMake `+` in `impl/dyn Trait` non-associative
Vadim Petrochenkov [Sat, 27 Jan 2018 19:37:17 +0000 (22:37 +0300)]
Make `+` in `impl/dyn Trait` non-associative

6 years agoAdd tests
Vadim Petrochenkov [Thu, 18 Jan 2018 17:59:38 +0000 (20:59 +0300)]
Add tests

6 years agosyntax: Permit `+` in return types of function declarations
Vadim Petrochenkov [Thu, 18 Jan 2018 17:59:28 +0000 (20:59 +0300)]
syntax: Permit `+` in return types of function declarations

`+` is still disallowed in function types and function-like traits

6 years agosyntax: Lower priority of `+` in `impl Trait`/`dyn Trait`
Vadim Petrochenkov [Sat, 14 Oct 2017 22:55:18 +0000 (01:55 +0300)]
syntax: Lower priority of `+` in `impl Trait`/`dyn Trait`

6 years agoImprove formatting of else block
varkor [Sat, 27 Jan 2018 15:16:42 +0000 (15:16 +0000)]
Improve formatting of else block

6 years agoFixed infinite loop issues and added some improved logging.
David Wood [Sat, 27 Jan 2018 13:30:34 +0000 (13:30 +0000)]
Fixed infinite loop issues and added some improved logging.

6 years agoNow handling case where span has same lo and hi.
David Wood [Wed, 17 Jan 2018 16:41:58 +0000 (16:41 +0000)]
Now handling case where span has same lo and hi.

6 years agoFix new test from rebase.
David Wood [Wed, 17 Jan 2018 14:30:16 +0000 (14:30 +0000)]
Fix new test from rebase.

6 years agonext_point now handles creating spans over multibyte characters.
David Wood [Wed, 17 Jan 2018 10:01:57 +0000 (10:01 +0000)]
next_point now handles creating spans over multibyte characters.

6 years agoReplaced multi-byte character handling in end_point with potentially more performant...
David Wood [Tue, 16 Jan 2018 20:41:00 +0000 (20:41 +0000)]
Replaced multi-byte character handling in end_point with potentially more performant variant.

6 years agoend_point handling multibyte characters correctly.
David Wood [Sun, 14 Jan 2018 17:29:07 +0000 (17:29 +0000)]
end_point handling multibyte characters correctly.

6 years agoMoved overflow check into end_point function.
David Wood [Sun, 14 Jan 2018 00:23:35 +0000 (00:23 +0000)]
Moved overflow check into end_point function.

6 years agoFixed off-by-one spans in MIR borrowck errors.
David Wood [Sat, 13 Jan 2018 23:28:42 +0000 (23:28 +0000)]
Fixed off-by-one spans in MIR borrowck errors.

6 years agoUpdated tests with fixed span location.
David Wood [Sat, 13 Jan 2018 23:28:00 +0000 (23:28 +0000)]
Updated tests with fixed span location.

6 years agoAuto merge of #46450 - Gilnaa:libtest_json_output, r=nrc
bors [Sat, 27 Jan 2018 10:56:56 +0000 (10:56 +0000)]
Auto merge of #46450 - Gilnaa:libtest_json_output, r=nrc

Libtest json output

A revisit to my [last PR](https://github.com/rust-lang/rust/pull/45923).

Events are now more atomic, printed in a flat hierarchy.

For the normal test output:
```
running 1 test
test f ... FAILED

failures:

---- f stdout ----
thread 'f' panicked at 'assertion failed: `(left == right)`
  left: `3`,
 right: `4`', f.rs:3:1
note: Run with `RUST_BACKTRACE=1` for a backtrace.

failures:
    f

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out
```

The JSON equivalent is:
```
{ "type": "suite", "event": "started", "test_count": "1" }
{ "type": "test", "event": "started", "name": "f" }
{ "type": "test", "event": "failed", "name": "f" }
{ "type": "suite", "event": "failed", "passed": 0, "failed": 1, "allowed_fail": 0, "ignored": 0,  "measured": 0, "filtered_out": "0" }
{ "type": "test_output", "name": "f", "output": "thread 'f' panicked at 'assertion failed: `(left == right)`
  left: `3`,
 right: `4`', f.rs:3:1
note: Run with `RUST_BACKTRACE=1` for a backtrace.
" }
```

6 years agolibtest: Fixed call to python in run-make
Gilad Naaman [Sat, 27 Jan 2018 09:50:01 +0000 (11:50 +0200)]
libtest: Fixed call to python in run-make

6 years agoAuto merge of #47690 - estebank:for-block-277, r=nikomatsakis
bors [Sat, 27 Jan 2018 08:04:12 +0000 (08:04 +0000)]
Auto merge of #47690 - estebank:for-block-277, r=nikomatsakis

For E0277 on `for` loops, point at the "head" expression

When E0277's span points at a `for` loop, the actual issue is in the
element being iterated. Instead of pointing at the entire loop, point
only at the first line (when possible) so that the span ends in the
element for which E0277 was triggered.

6 years agodon't mention tasks in stability warnings of #[thread_local] #47755
Pulkit Goyal [Sat, 27 Jan 2018 07:58:09 +0000 (13:28 +0530)]
don't mention tasks in stability warnings of #[thread_local] #47755

This is a fix for issue #47755.

6 years agoExpand union test to include different types
Ryan Cumming [Sat, 27 Jan 2018 03:18:18 +0000 (14:18 +1100)]
Expand union test to include different types

6 years agoFix ICE on const eval of union field
Ryan Cumming [Sat, 27 Jan 2018 01:14:12 +0000 (12:14 +1100)]
Fix ICE on const eval of union field

MIR's `Const::get_field()` attempts to retrieve the value for a given
field in a constant. In the case of a union constant it was falling
through to a generic `const_get_elt` based on the field index. As union
fields don't have an index this caused an ICE in `llvm_field_index`.

Fix by simply returning the current value when accessing any field in a
union. This works because all union fields start at byte offset 0.

The added test uses `const_fn` it ensure the field is extracted using
MIR's const evaluation. The crash is reproducible without it, however.

Fixes #47788

6 years agopacify the mercilous tidy
Niko Matsakis [Sat, 27 Jan 2018 01:51:40 +0000 (20:51 -0500)]
pacify the mercilous tidy

6 years agochange from `dirty_bit_vec` to `clean_bit_vec`
Niko Matsakis [Sat, 27 Jan 2018 01:13:51 +0000 (20:13 -0500)]
change from `dirty_bit_vec` to `clean_bit_vec`

Otherwise the vector is initially out of sync

6 years agoAdjust comment spacing
Niko Matsakis [Sat, 27 Jan 2018 00:58:54 +0000 (19:58 -0500)]
Adjust comment spacing

I suspect the lines would be long for tidy.

6 years agoMake region inference use a dirty list
Santiago Pastorino [Fri, 26 Jan 2018 05:14:54 +0000 (02:14 -0300)]
Make region inference use a dirty list

Fixes #47602

6 years agoAuto merge of #47571 - FenrirWolf:libunwind, r=alexcrichton
bors [Sat, 27 Jan 2018 00:28:34 +0000 (00:28 +0000)]
Auto merge of #47571 - FenrirWolf:libunwind, r=alexcrichton

Match libunwind's EABI selection with libpanic_unwind

Currently, the `libunwind` crate will only select the ARM EABI if it is compiling for ARM/Linux or Android targets. `libpanic_unwind`, however, will choose the ARM EABI if the target arch is ARM and the OS is not iOS. This means that if one tries to enable unwinding for a non-standard ARM target (such as implementing a custom stdlib via Xargo, for example), then the two crates can potentially disagree about which EABI is being targeted.

This PR makes `libunwind` use the [same logic](https://github.com/rust-lang/rust/blob/master/src/libpanic_unwind/gcc.rs#L139-L146) as `libpanic_unwind` when choosing the EABI.

I noticed there are a few comments about certain functions only differing on Android or ARM/Linux, but I *think* that those differences apply to the ARM EABI in general. Let me know if I'm wrong about that.

6 years agoInstead of modifying the item's span synthesize it
Esteban Küber [Fri, 26 Jan 2018 06:40:38 +0000 (22:40 -0800)]
Instead of modifying the item's span synthesize it

6 years agoA few more comments
Mark Mansi [Thu, 25 Jan 2018 05:23:01 +0000 (23:23 -0600)]
A few more comments

6 years agoStill more comments
Mark Mansi [Thu, 25 Jan 2018 05:10:39 +0000 (23:10 -0600)]
Still more comments

6 years agoAdded/improved comments
Mark Mansi [Thu, 25 Jan 2018 04:59:11 +0000 (22:59 -0600)]
Added/improved comments

6 years agoAdded lots of comments + minor reorganization
Mark Mansi [Thu, 25 Jan 2018 04:03:57 +0000 (22:03 -0600)]
Added lots of comments + minor reorganization

6 years agoAdded a bunch of comments to macro_parser.rs
Mark Mansi [Sat, 20 Jan 2018 02:47:39 +0000 (20:47 -0600)]
Added a bunch of comments to macro_parser.rs

6 years agoRun rustfmt on /libsyntax/ext/tt/macro_parser.rs
Mark Mansi [Sat, 20 Jan 2018 01:00:29 +0000 (19:00 -0600)]
Run rustfmt on /libsyntax/ext/tt/macro_parser.rs

6 years agoDon't add "in this macro invocation" label to desugared spans
Esteban Küber [Fri, 26 Jan 2018 19:34:12 +0000 (11:34 -0800)]
Don't add "in this macro invocation" label to desugared spans

6 years agoModify spans of expanded expression
Esteban Küber [Thu, 25 Jan 2018 22:07:45 +0000 (14:07 -0800)]
Modify spans of expanded expression

Modify the spans used for `for`-loop expression expansion, instead of
creating a new span during error creation.

6 years agoUpdated Cargo commit hash
Gilad Naaman [Fri, 26 Jan 2018 17:57:02 +0000 (19:57 +0200)]
Updated Cargo commit hash

6 years agolibtest: Failing benchmarks no longer crash the harness.
Gilad Naaman [Mon, 22 Jan 2018 20:29:41 +0000 (22:29 +0200)]
libtest: Failing benchmarks no longer crash the harness.

6 years agolibtest: Split-up formatters.rs into smaller modules
Gilad Naaman [Tue, 19 Dec 2017 21:12:24 +0000 (23:12 +0200)]
libtest: Split-up formatters.rs into smaller modules

libtest: Split HumanFormatter into {Pretty,Terse}

libtest: Fixed padding of benchmarks when not benchmarking

libtest: Fixed benchmarks' names not showing in terse-mode

libtest: Formatting

6 years agolibtest: Added UI tests for --format=json
Gilad Naaman [Tue, 19 Dec 2017 12:44:18 +0000 (14:44 +0200)]
libtest: Added UI tests for --format=json

libtest: Remove usage of jq

libtest: Fixed UI tests

- Now comparing to the right file.
- A python script checks for validity of JSON documents

6 years agolibtest: rustfmt run
Gilad Naaman [Fri, 15 Dec 2017 15:32:00 +0000 (17:32 +0200)]
libtest: rustfmt run

libtest: Whoops

6 years agolibtest: Fixed pretty-printing of test names in single-threaded code.
Gilad Naaman [Fri, 15 Dec 2017 15:25:44 +0000 (17:25 +0200)]
libtest: Fixed pretty-printing of test names in single-threaded code.

6 years agolibtest: JSON formatting is now only available in unstable builds
Gilad Naaman [Wed, 13 Dec 2017 19:12:19 +0000 (21:12 +0200)]
libtest: JSON formatting is now only available in unstable builds

libtest: Added the -Z option for unstable options

6 years agoAdded JSON output to libtest.
Gilad Naaman [Fri, 10 Nov 2017 12:00:55 +0000 (14:00 +0200)]
Added JSON output to libtest.

libtest: Json format now outputs failed tests' stdouts.

libtest: Json format now outputs failed tests' stdouts.

libtest: Json formatter now spews individiual events, not as an array

libtest: JSON fixes

libtest: Better JSON escaping

libtest: Test start event is printed on time

6 years agoRefactoring needed in order to have test json output.
Gilad Naaman [Wed, 8 Nov 2017 04:06:16 +0000 (06:06 +0200)]
Refactoring needed in order to have test json output.

6 years agoAuto merge of #47748 - alexcrichton:rollup, r=alexcrichton
bors [Fri, 26 Jan 2018 17:41:36 +0000 (17:41 +0000)]
Auto merge of #47748 - alexcrichton:rollup, r=alexcrichton

Rollup of 19 pull requests

- Successful merges: #47415, #47437, #47439, #47453, #47460, #47502, #47529, #47600, #47607, #47618, #47626, #47656, #47668, #47696, #47701, #47705, #47710, #47711, #47719
- Failed merges: #47455, #47521

6 years agoIgnore a test on emscripten
Alex Crichton [Fri, 26 Jan 2018 17:41:00 +0000 (09:41 -0800)]
Ignore a test on emscripten

6 years agoFix test in macro_backtrace
varkor [Fri, 26 Jan 2018 16:56:37 +0000 (16:56 +0000)]
Fix test in macro_backtrace

6 years agoadd test checking that process::Command is Send
Corentin Henry [Fri, 26 Jan 2018 15:33:58 +0000 (07:33 -0800)]
add test checking that process::Command is Send

6 years agoAdd clarifying comment regarding the trailing type of a block
varkor [Fri, 26 Jan 2018 15:39:19 +0000 (15:39 +0000)]
Add clarifying comment regarding the trailing type of a block