Commit Graph

103830 Commits

Author SHA1 Message Date
Dylan MacKenzie
2add77dffb Improve message when active feature indexing panics 2019-12-13 10:39:14 -08:00
Dylan MacKenzie
3325671036 Bless modified tests 2019-12-13 10:39:14 -08:00
Dylan MacKenzie
caa7c99172 Bless unrelated tests with new help message 2019-12-13 10:39:14 -08:00
Dylan MacKenzie
1122404be5 Add qualif smoke tests for const loops 2019-12-13 10:39:14 -08:00
Dylan MacKenzie
99e132db97 Extend control flow basics tests with loops 2019-12-13 10:39:14 -08:00
Dylan MacKenzie
ee233c07c6 Restructue HIR const-checker to handle features with multiple gates 2019-12-13 10:38:29 -08:00
Dylan MacKenzie
8f59902aad Put MIR checks for loops behind the feature flag 2019-12-13 10:38:29 -08:00
Dylan MacKenzie
57959b2bdc Add feature gate for const_loop 2019-12-13 10:38:29 -08:00
Dylan MacKenzie
8f3021bd2c Get active features dynamically by their Symbol 2019-12-13 10:38:29 -08:00
bors
3964a55ba5 Auto merge of #67077 - Aaron1011:build-llvm-in-binary, r=alexcrichton
rustc: Link LLVM directly into rustc again (take two)

This is a continuation of PR https://github.com/rust-lang/rust/pull/65703
2019-12-13 10:07:38 +00:00
bors
9409c208a9 Auto merge of #66405 - nnethercote:tweak-ObligForest-NodeStates, r=nikomatsakis
Remove `NodeState::{Waiting,Done}`

An optimization, and then some clean-ups.

r? @nikomatsakis
2019-12-13 06:51:28 +00:00
bors
cf7e019b42 Auto merge of #67271 - Centril:rollup-i71iqkv, r=Centril
Rollup of 6 pull requests

Successful merges:

 - #66341 (Match `VecDeque::extend` to `Vec::extend_desugared`)
 - #67243 (LinkedList: drop remaining items when drop panics)
 - #67247 (Don't suggest wrong snippet in closure)
 - #67250 (Remove the `DelimSpan` from `NamedMatch::MatchedSeq`.)
 - #67251 (Require `allow_internal_unstable` for stable min_const_fn using unsta…)
 - #67269 (parser: recover on `&'lifetime mut? $pat`.)

Failed merges:

r? @ghost
2019-12-13 03:22:20 +00:00
Mazdak Farrokhzad
d25197c52d
Rollup merge of #67269 - Centril:recover-lt-deref-pat, r=estebank
parser: recover on `&'lifetime mut? $pat`.

r? @estebank
2019-12-13 04:21:34 +01:00
Mazdak Farrokhzad
d2d5b83f6b
Rollup merge of #67251 - oli-obk:stability_sieve, r=Centril
Require `allow_internal_unstable` for stable min_const_fn using unsta…

…ble features

r? @Centril

cc @ecstatic-morse @RalfJung
2019-12-13 04:21:33 +01:00
Mazdak Farrokhzad
ac0bd42a4a
Rollup merge of #67250 - nnethercote:rm-DelimSpan-from-NamedMatch-MatchedSeq, r=Centril
Remove the `DelimSpan` from `NamedMatch::MatchedSeq`.

Because it's unused. This then allows the removal of
`MatcherPos::sp_open`. It's a tiny perf win, reducing instruction counts
by 0.1% - 0.2% on a few benchmarks.

r? @Centril
2019-12-13 04:21:31 +01:00
Mazdak Farrokhzad
98df677c3f
Rollup merge of #67247 - JohnTitor:fix-sugg, r=estebank
Don't suggest wrong snippet in closure

Fixes #67190

r? @estebank
2019-12-13 04:21:30 +01:00
Mazdak Farrokhzad
87f3b16e0b
Rollup merge of #67243 - jonas-schievink:linkedlist-drop, r=KodrAus
LinkedList: drop remaining items when drop panics

https://github.com/rust-lang/rust/pull/67235, but for `LinkedList`, which has the same issue.

I've also copied over the other drop-related tests from `VecDeque` since AFAICT `LinkedList` didn't have any.
2019-12-13 04:21:27 +01:00
Mazdak Farrokhzad
2ca7b7e539
Rollup merge of #66341 - crgl:vec-deque-extend, r=Amanieu
Match `VecDeque::extend` to `Vec::extend_desugared`

Currently, `VecDeque::extend` [does not reserve at all](https://github.com/rust-lang/rust/pull/65069#discussion_r333166522). This implementation still runs a check every iteration of the loop, but should reallocate at most once for the common cases where the `size_hint` lower bound is exact. Further optimizations in the future could improve this for some common cases, but given the complexity of the `Vec::extend` implementation it's not immediately clear that this would be worthwhile.
2019-12-13 04:21:22 +01:00
Mazdak Farrokhzad
45c1e38147 parser: recover on &'lifetime mut $pat. 2019-12-13 02:36:25 +01:00
Nicholas Nethercote
cb212938d4 Avoid re-processing nodes in find_cycles_from_node. 2019-12-13 08:36:25 +11:00
Nicholas Nethercote
76916d7a4b Remove an unnecessary local variable. 2019-12-13 08:36:25 +11:00
Nicholas Nethercote
4ec87d5cd2 Remove some debug! statements.
Because I am tired of looking at them.
2019-12-13 08:36:25 +11:00
Nicholas Nethercote
7d550445e2 Move functions around.
In particular, it has bugged me for some time that `process_cycles` is
currently located before `mark_still_waiting_nodes` despite being called
afterwards.
2019-12-13 08:36:25 +11:00
Nicholas Nethercote
a8207b1958 Remove NodeState::{Waiting,Done}.
`NodeState` has two states, `Success` and `Done`, that are only used
within `ObligationForest` methods. This commit removes them, and renames
the existing `Waiting` state as `Success`.

We are left with three states: `Pending`, `Success`, and `Error`.
`Success` is augmented with a new `WaitingState`, which indicates when
(if ever) it was last waiting on one or more `Pending` nodes. This
notion of "when" requires adding a "process generation" to
`ObligationForest`; it is incremented on each call to
`process_obligtions`.

This commit is a performance win.

- Most of the benefit comes from `mark_as_waiting` (which the commit
  renames as `mark_still_waiting_nodes`). This function used to do two
  things: (a) change all `Waiting` nodes to `Success`, and (b) mark all
  nodes that depend on a pending node as `Waiting`. In practice, many
  nodes went from `Waiting` to `Success` and then immediately back to
  `Waiting`. The use of generations lets us skip step (a).

- A smaller benefit comes from not having to change nodes to the `Done`
  state in `process_cycles`.
2019-12-13 08:36:25 +11:00
bors
3eeb8d4f2f Auto merge of #67172 - jethrogb:jb/bootstrap-linker, r=alexcrichton
Bootstrap: change logic for choosing linker and rpath

This is a follow-up from #66957 and #67023. Apparently there was one more location with a hard-coded list of targets to influence linking.

I've filed #67171 to track this madness.

r? @alexcrichton
2019-12-12 19:52:27 +00:00
Aaron Hill
47e932b96e
Fix weird implicit dependency between rustllvm and rustc_codegen_llvm
rustllvm relies on the `LLVMRustStringWriteImpl` symbol existing, but
this symbol was previously defined in a *downstream* crate
(rustc_codegen_llvm, which depends on rustc_llvm.

While this somehow worked under the old 'separate bootstrap step for
codegen' scheme, it meant that rustc_llvm could not actually be built by
itself, since it relied linking to the downstream rustc_codegen_llvm
crate.

Now that librustc_codegen_llvm is just a normal crate, we actually try
to build a standalone rustc_llvm when we run tests. This commit moves
`LLVMRustStringWriteImpl` into rustc_llvm (technically the rustllvm
directory, which has its contents built by rustc_llvm). This ensures
that we can build each crate in the graph by itself, without requiring
that any downstream crates be linked in as well.
2019-12-12 10:51:19 -05:00
bors
e9469a6aec Auto merge of #66886 - mark-i-m:simplify-borrow_check-2, r=matthewjasper
Remove the borrow check::nll submodule

NLL is the only borrow checker now, so no need to have a separate submodule.

@rustbot modify labels: +S-blocked

Waiting on #66815
2019-12-12 15:04:36 +00:00
bors
3eebe058e5 Auto merge of #67079 - nnethercote:optimize-shallow_resolve_changed, r=nikomatsakis
Optimize `shallow_resolve_changed`

r? @nikomatsakis
2019-12-12 11:51:26 +00:00
Oliver Scherer
0b1e08a9f4 Require allow_internal_unstable for stable min_const_fn using unstable features 2019-12-12 10:22:09 +01:00
Nicholas Nethercote
ffd214299e Remove the DelimSpan from NamedMatch::MatchedSeq.
Because it's unused. This then allows the removal of
`MatcherPos::sp_open`. It's a tiny perf win, reducing instruction counts
by 0.1% - 0.2% on a few benchmarks.
2019-12-12 17:36:03 +11:00
Mark Mansi
bc9582a953 fix imports after rebase 2019-12-11 21:35:51 -06:00
Mark Mansi
02d93bd703 more private 2019-12-11 21:35:51 -06:00
Mark Mansi
78ecf86291 fix imports 2019-12-11 21:35:51 -06:00
Mark Mansi
cee2c28ee8 tidy 2019-12-11 21:35:51 -06:00
Mark Mansi
697853117f fix imports 2019-12-11 21:35:50 -06:00
Mark Mansi
52a9eff7ad get rid of nll submod 2019-12-11 21:35:50 -06:00
Yuki Okushi
fa199c5f27 Don't suggest wrong snippet in closure 2019-12-12 11:13:13 +09:00
bors
f284f8b4be Auto merge of #67246 - JohnTitor:rollup-nfa7skn, r=JohnTitor
Rollup of 8 pull requests

Successful merges:

 - #62514 (Clarify `Box<T>` representation and its use in FFI)
 - #66983 (Fix `unused_parens` triggers on macro by example code)
 - #67215 (Fix `-Z print-type-sizes`'s handling of zero-sized fields.)
 - #67230 (Remove irelevant comment on `register_dtor`)
 - #67236 (resolve: Always resolve visibilities on impl items)
 - #67237 (Some small readability improvements)
 - #67238 (Small std::borrow::Cow improvements)
 - #67239 (Make TinyList::remove iterate instead of recurse)

Failed merges:

r? @ghost
2019-12-12 02:11:31 +00:00
Yuki Okushi
685d4cc746
Rollup merge of #67239 - llogiq:tiny-list-iterative-remove, r=Mark-Simulacrum
Make TinyList::remove iterate instead of recurse

Most of the diff is from from rustfmt, the actual change is in line 91..79 (or 79..89 in the "after" diff).

I had converted the other methods to iterate instead of recurse already, so this is the last recursive function on `TinyList`.
2019-12-12 10:09:29 +09:00
Yuki Okushi
60ebeda94f
Rollup merge of #67238 - llogiq:moo-and-improved, r=Dylan-DPC
Small std::borrow::Cow improvements

This is a small set of improvements (+ one more tested code path) for `Cow`.
2019-12-12 10:09:28 +09:00
Yuki Okushi
59eed49115
Rollup merge of #67237 - llogiq:improve-str, r=Dylan-DPC
Some small readability improvements
2019-12-12 10:09:26 +09:00
Yuki Okushi
0f286e855f
Rollup merge of #67236 - petrochenkov:docerr2, r=matthewjasper
resolve: Always resolve visibilities on impl items

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

Similarly to https://github.com/rust-lang/rust/pull/67106 this was an issue with visitor discipline.
Impl items were visited as a part of visiting `ast::ItemKind::Impl`, but they should be visit-able in isolation  from their parents as well, because that's how they are visited when they are expanded from macros.

I've checked that all the remaining `resolve_visibility` calls are used correctly.

r? @matthewjasper
2019-12-12 10:09:24 +09:00
Yuki Okushi
3cf799640f
Rollup merge of #67230 - chansuke:remove-irrelevant-passage, r=Dylan-DPC
Remove irelevant comment on `register_dtor`

Fixes #66572.
2019-12-12 10:09:23 +09:00
Yuki Okushi
a82390407a
Rollup merge of #67215 - nnethercote:fix-Zprint-type-size-zero-sized-fields, r=pnkfelix
Fix `-Z print-type-sizes`'s handling of zero-sized fields.

Currently, the type `struct S { x: u32, y: u32, tag: () }` is
incorrectly described like this:
```
print-type-size type: `S`: 8 bytes, alignment: 4 bytes
print-type-size     field `.x`: 4 bytes
print-type-size     field `.tag`: 0 bytes, offset: 0 bytes, alignment: 1 bytes
print-type-size     padding: 4 bytes
print-type-size     field `.y`: 4 bytes, alignment: 4 bytes
```
Specifically:
- The `padding` line is wrong. (There is no padding.)
- The `offset` and `alignment` on the `.tag` line shouldn't be printed.

The problem is that multiple fields can end up with the same offset, and
the printing code doesn't handle this correctly.

This commit fixes it by adjusting the field sorting so that zero-sized fields
are dealt with before non-zero-sized fields. With that in place, the
printing code works correctly.

The commit also corrects the "something is very wrong" comment.

The new output looks like this:
```
print-type-size type: `S`: 8 bytes, alignment: 4 bytes
print-type-size     field `.tag`: 0 bytes
print-type-size     field `.x`: 4 bytes
print-type-size     field `.y`: 4 bytes
```
r? @pnkfelix
2019-12-12 10:09:21 +09:00
Yuki Okushi
f642dc4124
Rollup merge of #66983 - weiznich:bugfix/issue_66295, r=estebank
Fix `unused_parens` triggers on macro by example code

Fix #66295

Unfortunately this does also break [an existing test](4787e97475/src/test/ui/lint/issue-47775-nested-macro-unnecessary-parens-arg.rs (L22)). I'm not sure how to handle that, because that seems to be quite similar to the allowed cases

If this gets accepted it would be great to backport this fix to beta.
2019-12-12 10:09:19 +09:00
Yuki Okushi
9860a4eeb7
Rollup merge of #62514 - stephaneyfx:box-ffi, r=nikomatsakis
Clarify `Box<T>` representation and its use in FFI

This officializes what was only shown as a code example in [the unsafe code guidelines](https://rust-lang.github.io/unsafe-code-guidelines/layout/function-pointers.html?highlight=box#use) and follows [the discussion](https://github.com/rust-lang/unsafe-code-guidelines/issues/157) in the corresponding repository.

It is also related to [the issue](https://github.com/rust-lang/rust/issues/52976) regarding marking `Box<T>` `#[repr(transparent)]`.

If the statement this PR adds is incorrect or a more in-depth discussion is warranted, I apologize. Should it be the case, the example in the unsafe code guidelines should be amended and some document should make it clear that it is not sound/supported.
2019-12-12 10:09:15 +09:00
Jonas Schievink
5e32da1849 LinkedList: drop remaining items when drop panics 2019-12-12 00:14:09 +01:00
bors
de0abf7599 Auto merge of #66650 - matthewjasper:nonuniform-array-move, r=pnkfelix
Remove uniform array move MIR passes

This PR fixes a number of bugs caused by limitations of this pass

* Projections from constant indexes weren't being canonicalized
* Constant indexes from the start weren't being canonicalized (they could have different min_lengths)
* It didn't apply to non-moves

This PR makes the following changes to support removing this pass:

* ConstantIndex of arrays are now generated in a canonical form (from the start, min_length is the actual length).
* Subslices are now split when generating move paths and when checking subslices have been moved.

Additionally

* The parent move path of a projection from an array element is now calculated correctly

closes #66502
2019-12-11 23:00:38 +00:00
Andre Bogus
ab3afc0f04 Make TinyList::remove iterate instead of recurse 2019-12-11 21:05:28 +01:00
Andre Bogus
2422797785 Small Cow improvements 2019-12-11 21:01:33 +01:00