Commit Graph

73925 Commits

Author SHA1 Message Date
Vitaly _Vi Shukela
bc277b271d
Revert "rustdoc: Move collapse toggle to the left"
This reverts commit 0885865e90.
2018-02-07 00:44:47 +03:00
Vitaly _Vi Shukela
28efcfc083
rustdoc: Fix erroneous collapsing of second+ inherent impl. 2018-02-01 17:07:43 +03:00
Vitaly _Vi Shukela
a3acd10297
rustdoc: Auto-collapse all non-inherent impls 2018-02-01 16:53:29 +03:00
Vitaly _Vi Shukela
0885865e90
rustdoc: Move collapse toggle to the left 2018-02-01 16:52:44 +03:00
Vitaly _Vi Shukela
c904b1bef4
rustdoc: Fix some minor issues per reviewer 2018-01-31 17:35:57 +03:00
Vitaly _Vi Shukela
7cd0280226
rustdoc: Fix tidy errors found by travis 2018-01-31 04:02:51 +03:00
Vitaly _Vi Shukela
73f52d3d8f
rustdoc: Foldable impl blocks
Addresses #40363, #45720, #24483, #23986 and so on

* Expands and refactors collapseDocs and toggleAllDocs
* Adds [-] toggle to all impls (including inherent impl)
* Makes it hiding though main css file, not though element style

May need to be addressed:

* "[-]" and anchor link copier are overlaid a bit
* Inherent methods are also hidden by the global [-] toggle.
* Auto-collapsing "Iterator" and so on by default is not implemented yet
* Tested only shallowly and only in Chromiuim
* No tests. Are there tests for css/js part here?
* The new implementation may be a bit slower.
2018-01-31 03:48:16 +03:00
bors
21882aad72 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.
2018-01-28 19:01:51 +00:00
bors
771873c841 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.
2018-01-28 16:17:18 +00:00
bors
5e7fd65419 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
2018-01-28 13:24:47 +00:00
bors
0119b44270 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
2018-01-28 10:41:34 +00:00
bors
7046a40623 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.
2018-01-28 07:44:14 +00:00
bors
87990a119a 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.
2018-01-28 03:40:26 +00:00
Alex Crichton
884715c654 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.
2018-01-27 19:16:21 -08:00
bors
6beb06ee5e 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:
000fbbc9b8/src/librustc_mir/build/expr/into.rs (L52-L59)
Which ends up calling `ast_block_stmts` on the block `{x;}`, which triggers this condition:
000fbbc9b8/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.
2018-01-28 00:40:10 +00:00
bors
7d6e5b9da0 Auto merge of #47420 - davidtwco:issue-46885, r=estebank
Fix off-by-one spans in MIR borrowck errors

Fixes #46885.

r? @nikomatsakis
2018-01-27 19:41:40 +00:00
David Wood
0bd96671f0
Fixed infinite loop issues and added some improved logging. 2018-01-27 13:30:34 +00:00
David Wood
0c467d5d09
Now handling case where span has same lo and hi. 2018-01-27 11:46:29 +00:00
David Wood
71b7500241
Fix new test from rebase. 2018-01-27 11:46:28 +00:00
David Wood
be465b0b85
next_point now handles creating spans over multibyte characters. 2018-01-27 11:46:28 +00:00
David Wood
62356471b3
Replaced multi-byte character handling in end_point with potentially more performant variant. 2018-01-27 11:46:28 +00:00
David Wood
c71cec8834
end_point handling multibyte characters correctly. 2018-01-27 11:46:27 +00:00
David Wood
c6e6428d1a
Moved overflow check into end_point function. 2018-01-27 11:46:26 +00:00
David Wood
f6fee2a479
Fixed off-by-one spans in MIR borrowck errors. 2018-01-27 11:46:26 +00:00
David Wood
6d00c9686b
Updated tests with fixed span location. 2018-01-27 11:46:22 +00:00
bors
6b99adeb11 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.
" }
```
2018-01-27 10:56:56 +00:00
Gilad Naaman
8b7f1d0cec libtest: Fixed call to python in run-make 2018-01-27 11:50:01 +02:00
bors
6272b60dca 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.
2018-01-27 08:04:12 +00:00
Pulkit Goyal
5ce2b02997 don't mention tasks in stability warnings of #[thread_local] #47755
This is a fix for issue #47755.
2018-01-27 13:28:09 +05:30
Ryan Cumming
ed7e4e1e27 Expand union test to include different types 2018-01-27 14:26:14 +11:00
Ryan Cumming
75c79bdb02 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
2018-01-27 12:57:01 +11:00
bors
5c41fcec4c 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.
2018-01-27 00:28:34 +00:00
Esteban Küber
445e404ba4 Instead of modifying the item's span synthesize it 2018-01-26 15:06:09 -08:00
Esteban Küber
106e5c554d Don't add "in this macro invocation" label to desugared spans 2018-01-26 11:35:27 -08:00
Esteban Küber
f90c445637 Modify spans of expanded expression
Modify the spans used for `for`-loop expression expansion, instead of
creating a new span during error creation.
2018-01-26 11:05:02 -08:00
Gilad Naaman
100ead353a Updated Cargo commit hash 2018-01-26 19:57:02 +02:00
Gilad Naaman
cb86f38497 libtest: Failing benchmarks no longer crash the harness. 2018-01-26 19:46:04 +02:00
Gilad Naaman
360b26389c 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
2018-01-26 19:46:04 +02:00
Gilad Naaman
adddb0f41a 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
2018-01-26 19:46:04 +02:00
Gilad Naaman
8b3fd98f4c libtest: rustfmt run
libtest: Whoops
2018-01-26 19:46:04 +02:00
Gilad Naaman
94bd1216bb libtest: Fixed pretty-printing of test names in single-threaded code. 2018-01-26 19:46:04 +02:00
Gilad Naaman
e570e9e79a libtest: JSON formatting is now only available in unstable builds
libtest: Added the -Z option for unstable options
2018-01-26 19:46:04 +02:00
Gilad Naaman
588a6a35be 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
2018-01-26 19:46:04 +02:00
Gilad Naaman
d24f9af31c Refactoring needed in order to have test json output. 2018-01-26 19:46:04 +02:00
bors
bacb5c58df 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
2018-01-26 17:41:36 +00:00
Alex Crichton
a06d333a14 Ignore a test on emscripten 2018-01-26 09:41:00 -08:00
varkor
adcb37e275 Add clarifying comment regarding the trailing type of a block 2018-01-26 15:39:19 +00:00
Alex Crichton
9bb18239de Fix a test case on Windows 2018-01-26 07:37:57 -08:00
Alex Crichton
c915e3a10a Merge branch 'mlsm' of https://github.com/dotdash/rust into rollup 2018-01-26 06:53:18 -08:00
Alex Crichton
b741d7d7ac Merge branch 'beta-prerelease' of https://github.com/cuviper/rust into rollup 2018-01-26 06:52:55 -08:00