]> git.lizzy.rs Git - rust.git/log
rust.git
6 years agoRollup merge of #47898 - Aaron1011:static-ref-nll, r=nikomatsakis Fix ICE when assign...
kennytm [Fri, 2 Feb 2018 08:29:19 +0000 (16:29 +0800)]
Rollup merge of #47898 - Aaron1011:static-ref-nll, r=nikomatsakis Fix ICE when assigning references to a static mut with NLL is_unsafe_place only filters out statics in the rhs, not the lhs. Since it's possible to reach that 'Place::Static', we handle statics the same way as we do locals. Fixes #47789

6 years agoRollup merge of #47842 - Manishearth:dead-code, r=nagisa Remove dead code The Clone...
kennytm [Fri, 2 Feb 2018 08:29:17 +0000 (16:29 +0800)]
Rollup merge of #47842 - Manishearth:dead-code, r=nagisa Remove dead code The Clone impl makes the lint ignore the type.

6 years agoRollup merge of #47829 - estebank:break-in-for, r=cramertj Suggest removing value...
kennytm [Fri, 2 Feb 2018 08:29:16 +0000 (16:29 +0800)]
Rollup merge of #47829 - estebank:break-in-for, r=cramertj Suggest removing value from `break` when invalid When attempting to use `break` with a value in a type of loop where it'd be invalid (any non-`loop`), suggest using `break` on its own. Close #34359.

6 years agoRollup merge of #46156 - SimonSapin:patch-14, r=withoutboats
kennytm [Fri, 2 Feb 2018 08:29:11 +0000 (16:29 +0800)]
Rollup merge of #46156 - SimonSapin:patch-14, r=withoutboats

Document the size of bool

6 years agoAuto merge of #47465 - estebank:include-space-after-mut, r=nikomatsakis
bors [Fri, 2 Feb 2018 04:19:12 +0000 (04:19 +0000)]
Auto merge of #47465 - estebank:include-space-after-mut, r=nikomatsakis

Include space in suggestion `mut` in bindings

Fix #46614.

6 years agoRemove dead code
Manish Goregaokar [Mon, 29 Jan 2018 05:44:55 +0000 (11:14 +0530)]
Remove dead code

6 years agoAuto merge of #47102 - Diggsey:wasm-syscall, r=alexcrichton
bors [Fri, 2 Feb 2018 01:27:14 +0000 (01:27 +0000)]
Auto merge of #47102 - Diggsey:wasm-syscall, r=alexcrichton

Implement extensible syscall interface for wasm

Currently it's possible to run tests with the native wasm target, but it's not possible to tell whether they pass or to capture the output, because libstd throws away stdout, stderr and the exit code. While advanced libstd features should probably require more specific targets (eg. wasm-unknown-web) I think even the unknown target should at least support basic I/O.

Any solution is constrained by these factors:
- It must not be javascript specific
- There must not be too strong coupling between libstd and the host environment (because it's an "unknown" target)
- WebAssembly does not allow "optional" imports - all imports *must* be resolved.
- WebAssembly does not support calling the host environment through any channel *other* than imports.

The best solution I could find to these constraints was to give libstd a single required import, and implement a syscall-style interface through that import. Each syscall is designed such that a no-op implementation gives the most reasonable fallback behaviour. This means that the following import table would be perfectly valid:
```javascript
imports.env = { rust_wasm_syscall: function(index, data) {} }
```

Currently I have implemented these system calls:
- Read from stdin
- Write to stdout/stderr
- Set the exit code
- Get command line arguments
- Get environment variable
- Set environment variable
- Get time

It need not be extended beyond this set if being able to run tests for this target is the only goal.

edit:
As part of this PR I had to make a further change. Previously, the rust entry point would be automatically called when the webassembly module was instantiated. This was problematic because from the javascript side it was impossible to call exported functions, access program memory or get a reference to the instance.

To solve this, ~I changed the default behaviour to not automatically call the entry point, and added a crate-level attribute to regain the old behaviour. (`#![wasm_auto_run]`)~ I disabled this behaviour when building tests.

6 years agoChange offset to `0`
Esteban Küber [Thu, 1 Feb 2018 20:02:22 +0000 (12:02 -0800)]
Change offset to `0`

6 years agoAuto merge of #47738 - nikomatsakis:issue-47139-master, r=arielb1
bors [Thu, 1 Feb 2018 07:33:35 +0000 (07:33 +0000)]
Auto merge of #47738 - nikomatsakis:issue-47139-master, r=arielb1

remove intercrate ambiguity hints

The scheme was causing overflows during coherence checking (e.g. #47139). This is sort of a temporary fix; the proper fix I think involves reworking trait selection in deeper ways.

cc @sgrif -- this *should* fix diesel

cc @qnighy -- I'd like to discuss you with alternative techniques for achieving the same end. =) Actually, it might be good to put some energy into refactoring traits first.

r? @eddyb

6 years agoAuto merge of #47540 - Manishearth:suggestion, r=nrc
bors [Thu, 1 Feb 2018 04:47:46 +0000 (04:47 +0000)]
Auto merge of #47540 - Manishearth:suggestion, r=nrc

Add approximate suggestions for rustfix

This adds `span_approximate_suggestion()` that lets you emit a
suggestion marked as "non-machine applicable" in the JSON output. UI
users see no difference. This is for when rustc and clippy wish to
 emit suggestions which will make sense to the reader (e.g. they may
have placeholders like `<type>`) but are not source-applicable, so that
rustfix/etc can ignore these.

fixes #39254

6 years agoAuto merge of #47900 - kennytm:rollup, r=kennytm
bors [Wed, 31 Jan 2018 20:51:02 +0000 (20:51 +0000)]
Auto merge of #47900 - kennytm:rollup, r=kennytm

Rollup of 16 pull requests

- Successful merges: #47838, #47840, #47844, #47874, #47875, #47876, #47884, #47886, #47889, #47890, #47891, #47795, #47677, #47893, #47895, #47552
- Failed merges:

6 years agoRollup merge of #47552 - oberien:stepby-nth, r=dtolnay
kennytm [Wed, 31 Jan 2018 18:34:15 +0000 (02:34 +0800)]
Rollup merge of #47552 - oberien:stepby-nth, r=dtolnay

Specialize StepBy::nth

This allows optimizations of implementations of the inner iterator's `.nth` method.

6 years agoRollup merge of #47895 - varkor:non-utf-stdin, r=estebank
kennytm [Wed, 31 Jan 2018 18:32:10 +0000 (02:32 +0800)]
Rollup merge of #47895 - varkor:non-utf-stdin, r=estebank

Fix ICE when reading non-UTF-8 input from stdin

Fixes #22387.

6 years agoRollup merge of #47893 - alexcrichton:move-codegen-backends, r=alexcrichton
kennytm [Wed, 31 Jan 2018 18:29:38 +0000 (02:29 +0800)]
Rollup merge of #47893 - alexcrichton:move-codegen-backends, r=alexcrichton

rustc: Move location of `codegen-backends` dir

Right now this directory is located under:

```
$sysroot/lib/rustlib/$target/lib/codegen-backends
```

but after seeing what we do in a few other places it seems that a more
appropriate location would be:

```
$sysroot/lib/rustlib/$target/codegen-backends
```

so this commit moves it!

6 years agoRollup merge of #47677 - etaoins:avoid-underflow-in-rennder-source-line, r=estebank
kennytm [Wed, 31 Jan 2018 18:26:48 +0000 (02:26 +0800)]
Rollup merge of #47677 - etaoins:avoid-underflow-in-rennder-source-line, r=estebank

Avoid underflow in render_source_line

While testing rust-lang/rust#47655 I was able to make the compiler panic when it's compiled with debug assertions:

```shell
> rustc /dev/null --crate-type proc-macro

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.25.0-dev running on x86_64-apple-darwin

note: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'attempt to subtract with overflow', librustc_errors/emitter.rs:287:49
```

Without debug assertions the following warning is emitted:

```shell
> rustc /dev/null --crate-type proc-macro

warning: unused variable: `registrar`
 --> /dev/null:0:1
  |
  |
  = note: #[warn(unused_variables)] on by default
  = note: to avoid this warning, consider using `_registrar` instead
```

The panic is due to the unused variable warning being spanned to `/dev/null:0:1`. When `render_source_line` subtracts 1 from the line number to look up the source line it panics due to underflow. Without debug assertions this would wrap and cause us to return a blank string instead.

Fix by explicitly testing for 0 and exiting early. I'm unsure how to automatically test this now that rust-lang/rust#46655 has been approved.

6 years agorustc: Move location of `codegen-backends` dir
Alex Crichton [Tue, 30 Jan 2018 23:40:44 +0000 (15:40 -0800)]
rustc: Move location of `codegen-backends` dir

Right now this directory is located under:

  $sysroot/lib/rustlib/$target/lib/codegen-backends

but after seeing what we do in a few other places it seems that a more
appropriate location would be:

  $sysroot/lib/rustlib/$target/codegen-backends

so this commit moves it!

6 years agoRollup merge of #47795 - avborhanian:master, r=rkruppe
kennytm [Wed, 31 Jan 2018 14:11:12 +0000 (22:11 +0800)]
Rollup merge of #47795 - avborhanian:master, r=rkruppe

Adding ICH to the glossary.

Fixes #47782.

6 years agoUse file containing non-UTF-8 character instead of echo -e
varkor [Wed, 31 Jan 2018 11:56:15 +0000 (11:56 +0000)]
Use file containing non-UTF-8 character instead of echo -e

6 years agoAdd echo escape flag
varkor [Wed, 31 Jan 2018 10:23:15 +0000 (10:23 +0000)]
Add echo escape flag

6 years agoRollup merge of #47891 - eddyb:issue-47638, r=nikomatsakis
kennytm [Wed, 31 Jan 2018 08:36:18 +0000 (16:36 +0800)]
Rollup merge of #47891 - eddyb:issue-47638, r=nikomatsakis

rustc_trans: keep LLVM types for trait objects anonymous.

Fixes #47638 by reverting the addition of readable LLVM trait object type names.
r? @nikomatsakis

6 years agoRollup merge of #47890 - pftbest:no_trap, r=alexcrichton
kennytm [Wed, 31 Jan 2018 08:36:17 +0000 (16:36 +0800)]
Rollup merge of #47890 - pftbest:no_trap, r=alexcrichton

[MSP430] Don't enable trap_unreachable option by default on msp.

Since MSP430 doesn't meaningfully support faulting on illegal
instructions, LLVM generates a call to abort() function instead
of a trap instruction. Such calls are 4 bytes long, and that is
too much overhead for such small target.

r? @alexcrichton

6 years agoRollup merge of #47889 - alexcrichton:wasm-hidden-by-default, r=cramertj
kennytm [Wed, 31 Jan 2018 08:36:15 +0000 (16:36 +0800)]
Rollup merge of #47889 - alexcrichton:wasm-hidden-by-default, r=cramertj

rustc: Add an option to default hidden visibility

This commit adds a new option to target specifictions to specify that symbols
should be "hidden" visibility by default in LLVM. While there are no existing
targets that take advantage of this the `wasm32-unknown-unknown` target will
soon start to use this visibility. The LLD linker currently interprets `hidden`
as "don't export this from the wasm module" which is what we want for 90% of our
functions. While the LLD linker does have a "export this symbol" argument which
is what we use for other linkers, it was also somewhat easier to do this change
instead which'll involve less arguments flying around. Additionally there's no
need for non-`hidden` visibility for most of our symbols!

This change should not immediately impact the wasm targets as-is, but rather
this is laying the foundations for soon integrating LLD as a linker for wasm
code.

6 years agoRollup merge of #47886 - alexcrichton:llvm-7-start, r=eddyb
kennytm [Wed, 31 Jan 2018 08:36:14 +0000 (16:36 +0800)]
Rollup merge of #47886 - alexcrichton:llvm-7-start, r=eddyb

rustc: Add some defines for LLVM 7 compat

I was testing out the tip support to see what's going on with wasm, and this was
I believe the only issue encountered with LLVM 7 support so far.

6 years agoRollup merge of #47884 - cuviper:run-pass-sse2, r=alexcrichton
kennytm [Wed, 31 Jan 2018 08:36:13 +0000 (16:36 +0800)]
Rollup merge of #47884 - cuviper:run-pass-sse2, r=alexcrichton

Ignore run-pass/sse2 when using system LLVM

This is a test of `target_feature`, which needs a rust-specific patch to
LLVM to add `MCSubtargetInfo::getFeatureTable()`.

6 years agoRollup merge of #47876 - GuillaumeGomez:associated-const-error, r=nikomatsakis
kennytm [Wed, 31 Jan 2018 08:36:11 +0000 (16:36 +0800)]
Rollup merge of #47876 - GuillaumeGomez:associated-const-error, r=nikomatsakis

Update associated constants error message

Fixes #47570.

6 years agoRollup merge of #47875 - jcowgill:mips-clobber-at, r=rkruppe
kennytm [Wed, 31 Jan 2018 08:36:10 +0000 (16:36 +0800)]
Rollup merge of #47875 - jcowgill:mips-clobber-at, r=rkruppe

rustc_trans: clobber $1 (aka $at) on mips

This copies what clang does. There is a long explanation as to why this is needed in the clang source (tools/clang/lib/Basic/Targets/Mips.h).

6 years agoRollup merge of #47874 - jcowgill:mips-from_raw_os_error, r=dtolnay
kennytm [Wed, 31 Jan 2018 08:36:09 +0000 (16:36 +0800)]
Rollup merge of #47874 - jcowgill:mips-from_raw_os_error, r=dtolnay

std: use more portable error number in from_raw_os_error docs

On MIPS, error number 98 is not `EADDRINUSE` (it is `EPROTOTYPE`). To fix the resulting test failure this causes, use a more portable error number in the example documentation. `EINVAL` shold be more reliable because it was defined in the original Unix as 22 so hopefully most derivatives have defined it the same way.

6 years agoRollup merge of #47844 - CAD97:patch-1, r=estebank
kennytm [Wed, 31 Jan 2018 08:36:08 +0000 (16:36 +0800)]
Rollup merge of #47844 - CAD97:patch-1, r=estebank

Fix regression: account for trait methods in arg count mismatch error

Fixed #47706 (https://github.com/rust-lang/rust/issues/47706#issuecomment-361161495)

Original PR #47747 missed methods on trait definitions.

This edit was done in GitHub. I think I got the signature of the variant right, going by the ICE debug output and the other cases above.

6 years agoRollup merge of #47840 - penpalperson:master, r=bluss
kennytm [Wed, 31 Jan 2018 08:36:06 +0000 (16:36 +0800)]
Rollup merge of #47840 - penpalperson:master, r=bluss

Marked Debug implementations for primitive types as #[inline]

Change for issue #47792.

6 years agoRollup merge of #47838 - euclio:snakecase-suggestion, r=petrochenkov
kennytm [Wed, 31 Jan 2018 08:36:05 +0000 (16:36 +0800)]
Rollup merge of #47838 - euclio:snakecase-suggestion, r=petrochenkov

use correct casing for rename suggestions

If the original name is uppercase, use camel case. Otherwise, use snake
case.

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 agoFix ICE when assigning references to a static mut with NLL
Aaron Hill [Wed, 31 Jan 2018 02:44:35 +0000 (21:44 -0500)]
Fix ICE when assigning references to a static mut with NLL

is_unsafe_place only filters out statics in the rhs, not the lhs. Since
it's possible to reach that 'Place::Static', we handle statics the same
way as we do locals.

Fixes #47789

6 years agoFix ICE when reading non-UTF-8 input from stdin
varkor [Wed, 31 Jan 2018 00:59:20 +0000 (00:59 +0000)]
Fix ICE when reading non-UTF-8 input from stdin

Fixes #22387.

6 years agoAdd wasm_syscall feature to build system
Diggory Blake [Thu, 11 Jan 2018 17:51:49 +0000 (17:51 +0000)]
Add wasm_syscall feature to build system

6 years agoImplement extensible syscall interface for wasm
Diggory Blake [Sun, 31 Dec 2017 16:40:34 +0000 (16:40 +0000)]
Implement extensible syscall interface for wasm

6 years agorustc_trans: keep LLVM types for trait objects anonymous.
Eduard-Mihai Burtescu [Tue, 30 Jan 2018 22:23:25 +0000 (00:23 +0200)]
rustc_trans: keep LLVM types for trait objects anonymous.

6 years ago[MSP430] Don't enable trap_unreachable option by default on msp.
Vadzim Dambrouski [Tue, 30 Jan 2018 21:57:30 +0000 (00:57 +0300)]
[MSP430] Don't enable trap_unreachable option by default on msp.

Since MSP430 doesn't meaningfully support faulting on illegal
instructions, LLVM generates a call to abort() function instead
of a trap instruction. Such calls are 4 bytes long, and that is
too much overhead for such small target.

6 years agorustc: Add an option to default hidden visibility
Alex Crichton [Tue, 30 Jan 2018 19:54:07 +0000 (11:54 -0800)]
rustc: Add an option to default hidden visibility

This commit adds a new option to target specifictions to specify that symbols
should be "hidden" visibility by default in LLVM. While there are no existing
targets that take advantage of this the `wasm32-unknown-unknown` target will
soon start to use this visibility. The LLD linker currently interprets `hidden`
as "don't export this from the wasm module" which is what we want for 90% of our
functions. While the LLD linker does have a "export this symbol" argument which
is what we use for other linkers, it was also somewhat easier to do this change
instead which'll involve less arguments flying around. Additionally there's no
need for non-`hidden` visibility for most of our symbols!

This change should not immediately impact the wasm targets as-is, but rather
this is laying the foundations for soon integrating LLD as a linker for wasm
code.

6 years agorustc: Add some defines for LLVM 7 compat
Alex Crichton [Tue, 30 Jan 2018 19:53:18 +0000 (11:53 -0800)]
rustc: Add some defines for LLVM 7 compat

I was testing out the tip support to see what's going on with wasm, and this was
I believe the only issue encountered with LLVM 7 support so far.

6 years agotrack intercrate ambiguity only when there is a coherence error
Niko Matsakis [Fri, 26 Jan 2018 22:21:43 +0000 (17:21 -0500)]
track intercrate ambiguity only when there is a coherence error

6 years agochange `overlapping_impls` to take a tcx and create the infcx
Niko Matsakis [Mon, 29 Jan 2018 22:40:13 +0000 (17:40 -0500)]
change `overlapping_impls` to take a tcx and create the infcx

6 years agomake `overlapping_impls` call closures instead of returning
Niko Matsakis [Mon, 29 Jan 2018 23:20:24 +0000 (18:20 -0500)]
make `overlapping_impls` call closures instead of returning

6 years agoIgnore run-pass/sse2 when using system LLVM
Josh Stone [Tue, 30 Jan 2018 18:18:54 +0000 (10:18 -0800)]
Ignore run-pass/sse2 when using system LLVM

This is a test of `target_feature`, which needs a rust-specific patch to
LLVM to add `MCSubtargetInfo::getFeatureTable()`.

6 years agoUpdate associated constants error message
Guillaume Gomez [Tue, 30 Jan 2018 13:20:20 +0000 (14:20 +0100)]
Update associated constants error message

6 years agoChanged back inline markings.
penpalperson [Tue, 30 Jan 2018 12:31:38 +0000 (05:31 -0700)]
Changed back inline markings.

6 years agorustc_trans: clobber $1 (aka $at) on mips
James Cowgill [Wed, 24 Jan 2018 11:50:10 +0000 (11:50 +0000)]
rustc_trans: clobber $1 (aka $at) on mips

This copies what clang does. There is a long explanation as to why this
is needed in the clang source (tools/clang/lib/Basic/Targets/Mips.h).

6 years agostd: use more portable error number in from_raw_os_error docs
James Cowgill [Tue, 23 Jan 2018 14:47:30 +0000 (14:47 +0000)]
std: use more portable error number in from_raw_os_error docs

On MIPS, error number 98 is not EADDRINUSE (it is EPROTOTYPE). To fix the
resulting test failure this causes, use a more portable error number in
the example documentation. EINVAL shold be more reliable because it was
defined in the original Unix as 22 so hopefully most derivatives have
defined it the same way.

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 agoFix regression: account for trait methods in arg count mismatch error
Christopher Durham [Mon, 29 Jan 2018 07:43:44 +0000 (02:43 -0500)]
Fix regression: account for trait methods in arg count mismatch error

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 agoAdd internal-only rustc_serialize_exclude_null attribute for making the field only...
Manish Goregaokar [Wed, 24 Jan 2018 06:20:30 +0000 (11:50 +0530)]
Add internal-only rustc_serialize_exclude_null attribute for making the field only exist in the json if the flag is passed

6 years agoAdd -Zapproximate-suggestions
Manish Goregaokar [Fri, 19 Jan 2018 07:34:14 +0000 (13:04 +0530)]
Add -Zapproximate-suggestions

6 years agoAdd approximate suggestions for rustfix
Manish Goregaokar [Thu, 18 Jan 2018 11:47:46 +0000 (17:17 +0530)]
Add approximate suggestions for rustfix

This adds `span_approximate_suggestion()` that lets you emit a
suggestion marked as "approximate" in the JSON output. UI
users see no difference. This is for when rustc and clippy wish to
 emit suggestions which will make sense to the reader (e.g. they may
have placeholders like `<type>`) but are not source-applicable, so that
rustfix/etc can ignore these.

fixes #39254

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 agoAdded inline to fmt for debug implementations of primitives.
penpalperson [Mon, 29 Jan 2018 04:55:05 +0000 (21:55 -0700)]
Added inline to fmt for debug implementations of primitives.

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 agouse correct casing for rename suggestions
Andy Russell [Mon, 29 Jan 2018 01:48:54 +0000 (20:48 -0500)]
use correct casing for rename suggestions

If the original name is uppercase, use camel case. Otherwise, use snake
case.

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 agoSuggest removing value from `break` when invalid
Esteban Küber [Sun, 28 Jan 2018 19:14:09 +0000 (11:14 -0800)]
Suggest removing value from `break` when invalid

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.