Commit Graph

74166 Commits

Author SHA1 Message Date
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
gnzlbg
b32dbbc67e
Whitelist v7 feature for ARM and AARCH64.
Needed for `v7` features in `coresimd`. 

See b2f7be24d5/coresimd/src/arm/v7.rs (L40) which used to work but doesn't anymore.

r? alexcrichton
2018-01-28 18:50:03 +01: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
gnzlbg
2497d10ff3
Whitelist aes x86 feature flag
Required to fix https://github.com/rust-lang-nursery/stdsimd/issues/295 in stdsimd.

r? @alexcrichton
2018-01-28 13:47:06 +01: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
Marco A L Barbosa
2875f825fd Remove musl/libunwind patch for i686
The i686 problem was fixed upstream:
aa805e415f
2018-01-27 20:57:10 -02: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
Vadim Petrochenkov
f57ea7cb3d Make + in impl/dyn Trait non-associative 2018-01-27 22:38:28 +03:00
Vadim Petrochenkov
d79f7cde06 Add tests 2018-01-27 22:37:30 +03:00
Vadim Petrochenkov
95d27c3b79 syntax: Permit + in return types of function declarations
`+` is still disallowed in function types and function-like traits
2018-01-27 22:37:30 +03:00
Vadim Petrochenkov
873b77531c syntax: Lower priority of + in impl Trait/dyn Trait 2018-01-27 22:37:30 +03:00
Tobias Bucher
6c86da288a Make wording around 0-cost casts more precise 2018-01-27 17:54:01 +01:00
varkor
a21b7b3b16 Improve formatting of else block 2018-01-27 15:16:42 +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
Araam Borhanian
0984ee3051 Adding ICH to the glossary. 2018-01-26 21:10:35 -05: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
Niko Matsakis
205eba83e2
pacify the mercilous tidy 2018-01-26 20:51:40 -05:00
Niko Matsakis
b57ca9d97f
change from dirty_bit_vec to clean_bit_vec
Otherwise the vector is initially out of sync
2018-01-26 20:13:51 -05:00
Niko Matsakis
44b666816b
Adjust comment spacing
I suspect the lines would be long for tidy.
2018-01-26 19:58:54 -05:00
Santiago Pastorino
da545cee60 Make region inference use a dirty list
Fixes #47602
2018-01-26 21:56:49 -03:00
Esteban Küber
ee06559576 Tweak presentation on lifetime trait mismatch 2018-01-26 16:38:07 -08: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
fa7767e1ea review comment 2018-01-26 14:24:17 -08:00
Esteban Küber
d0bd090efb Consider all whitespace when preparing span 2018-01-26 14:24:17 -08:00
Esteban Küber
a8f77e12fc Include space in suggestion mut in bindings 2018-01-26 14:24:17 -08:00
Mark Mansi
e2d558ad56 A few more comments 2018-01-26 14:47:24 -06:00
Mark Mansi
02d1d92878 Still more comments 2018-01-26 14:47:24 -06:00
Mark Mansi
b01b481db3 Added/improved comments 2018-01-26 14:47:24 -06:00
Mark Mansi
6d4ed65585 Added lots of comments + minor reorganization 2018-01-26 14:47:24 -06:00
Mark Mansi
0d7f193dd3 Added a bunch of comments to macro_parser.rs 2018-01-26 14:47:24 -06:00
Mark Mansi
ac0c16d3b5 Run rustfmt on /libsyntax/ext/tt/macro_parser.rs 2018-01-26 14:47:24 -06:00