Commit Graph

99231 Commits

Author SHA1 Message Date
Mark Rousskov
2aa9d29c6a Remove unused code 2019-09-21 16:14:10 -04:00
Mark Rousskov
67d88f607e Remove constraints argument from path_all
It was never used
2019-09-21 15:01:39 -04:00
bors
5349e69ae2 Auto merge of #64047 - timvermeulen:cmp_min_max_by, r=cuviper
Add `cmp::{min_by, min_by_key, max_by, max_by_key}`

This adds the following functions to `core::cmp`:

- `min_by`
- `min_by_key`
- `max_by`
- `max_by_key`

`min_by` and `max_by` are somewhat trivial to implement, but not entirely because `min_by` returns the first value in case the two are equal (and `max_by` the second). `min` and `max` can be implemented in terms of `min_by` and `max_by`, but not as easily the other way around.

To give an example of why I think these functions could be useful: the `Iterator::{min_by, min_by_key, max_by, max_by_key}` methods all currently hard-code the behavior mentioned above which is an ever so small duplication of logic. If we delegate them to `cmp::{min_by, max_by}` methods instead, we get the correct behavior for free. (edit: this is now included in the PR)

I added `min_by_key` / `max_by_key` for consistency's sake but I wouldn't mind removing them. I don't have a particular use case in mind for them, and `min_by` / `max_by` seem to be more useful.

Tracking issue: #64460
2019-09-21 04:21:25 +00:00
bors
97e58c0d32 Auto merge of #64584 - nikomatsakis:issue-64477-generator-capture-types, r=eddyb
record fewer adjustment types in generator witnesses, avoid spurious drops in MIR construction

Don't record all intermediate adjustment types -- That's way more than is needed, and winds up recording types that will never appear in MIR.

Note: I'm like 90% sure that this logic is correct, but this stuff is subtle and can be hard to keep straight.  However, the risk of this PR is fairly low -- if we miss types here, I believe the most common outcome is an ICE.

This fixes the original issue cited by #64477, but I'm leaving the issue open for now since there may be other cases we can detect and improve in a targeted way.

r? @Zoxc
2019-09-20 15:35:51 +00:00
bors
9ad1e7c46c Auto merge of #64553 - alexcrichton:windows-bash-install-scripts, r=Mark-Simulacrum
azure: Convert Windows installations scripts to `bash`

Looks like `script`, which uses `cmd.exe`, doesn't have fail-fast
behavior and if a leading command fails the script doesn't actually fail
so long as the last command succeeds. We instead want the opposite
behavior where if any step fails the whole script fails.

I don't really know `cmd.exe` that well, nor powershell, so I've opted
to move everything to `bash` which should be a good common denominator
amongst all platforms to work with. Additionally I know that `set -e`
works to cause scripts to fail fast.

Closes #64551
2019-09-20 11:38:56 +00:00
bors
72252646a8 Auto merge of #64498 - estebank:point-at-arg, r=Centril
When possible point at argument causing item obligation failure

Fix https://github.com/rust-lang/rust/issues/41781, fix https://github.com/rust-lang/rust/issues/42855, fix https://github.com/rust-lang/rust/issues/46658, fix https://github.com/rust-lang/rust/issues/48099, fix https://github.com/rust-lang/rust/issues/63143.
2019-09-20 07:53:23 +00:00
bors
ea3ba36f3f Auto merge of #64576 - pietroalbini:split-aws-tokens, r=alexcrichton
ci: split aws credentials in two separate users with scoped perms

This commit changes our CI to use two separate IAM users to authenticate with AWS:

* `ci--rust-lang--rust--sccache`: has access to the `rust-lang-ci-sccache2` S3 bucket and its credentials are available during the whole build.
* `ci--rust-lang--rust--upload`: has access to the `rust-lang-ci2` S3 bucket and its credentials are available just during the upload step.

The new tokens are available in the `prod-credentials` library.

r? @alexcrichton
2019-09-20 02:43:06 +00:00
bors
53b352edb6 Auto merge of #64616 - Centril:rollup-du6728f, r=Centril
Rollup of 6 pull requests

Successful merges:

 - #63448 (fix Miri discriminant handling)
 - #64592 (Point at original span when emitting unreachable lint)
 - #64601 (Fix backticks in documentation)
 - #64606 (Remove unnecessary `mut` in doc example)
 - #64611 (rustbuild: Don't package libstd twice)
 - #64613 (rustbuild: Copy crate doc files fewer times)

Failed merges:

r? @ghost
2019-09-19 22:41:46 +00:00
Esteban Küber
c34d9e6a92 add comments 2019-09-19 14:52:38 -07:00
Niko Matsakis
77fd0a7649 add a mir-opt test that we don't add the spurious drop 2019-09-19 16:12:48 -04:00
Esteban Küber
d64c90d40b remove duplicated code 2019-09-19 12:10:23 -07:00
Esteban Küber
09f05d2c41 review comments 2019-09-19 12:10:23 -07:00
Esteban Küber
c1ed4399eb review comments 2019-09-19 12:10:23 -07:00
Esteban Küber
2fbd6927a5 When possible, suggest fn call 2019-09-19 12:10:23 -07:00
Esteban Küber
5976e0eecf Review comment: move to its own method 2019-09-19 12:10:23 -07:00
Esteban Küber
fa496c9ded Ignore obligations coming from desugared call spans 2019-09-19 12:10:23 -07:00
Esteban Küber
02e3fb89a7 When possible point at argument causing item obligation failure 2019-09-19 12:10:23 -07:00
Niko Matsakis
1962d75c10 fix mir-opt tests 2019-09-19 14:30:05 -04:00
Niko Matsakis
c78a00991b whoops, only trigger this path for avoiding DROP, not StorageDead 2019-09-19 13:42:46 -04:00
Niko Matsakis
2655663345 fix tests for 2018 2019-09-19 13:15:54 -04:00
Mazdak Farrokhzad
99cbffb15f
Rollup merge of #64613 - alexcrichton:less-doc-copies, r=Mark-Simulacrum
rustbuild: Copy crate doc files fewer times

Previously when building documentation for the standard library we'd
copy all the files 5 times, and these files include libcore/libstd docs
which are huge! This commit instead only copies the files after rustdoc
has been run for each crate, reducing the number of redundant copies
we're making.
2019-09-19 18:31:44 +02:00
Mazdak Farrokhzad
ff7a9cf276
Rollup merge of #64611 - alexcrichton:no-libstd-twice, r=Mark-Simulacrum
rustbuild: Don't package libstd twice

Looks like the packaging step for the standard library was happening
twice on CI, but it only needs to happen once! The `Analysis` packaging
step accidentally packaged `Std` instead of relying on compiling `Std`,
which meant that we ended up packaging it twice erroneously.
2019-09-19 18:31:43 +02:00
Mazdak Farrokhzad
ea58ed9421
Rollup merge of #64606 - adrianheine:patch-1, r=sfackler
Remove unnecessary `mut` in doc example
2019-09-19 18:31:41 +02:00
Mazdak Farrokhzad
908636f510
Rollup merge of #64601 - grovesNL:two-backticks, r=jonas-schievink
Fix backticks in documentation

Fix a few typos in comments/documentation where backticks were doubled-up on one side.
2019-09-19 18:31:40 +02:00
Mazdak Farrokhzad
3c286826aa
Rollup merge of #64592 - Aaron1011:feature/unreachable-span, r=Centril
Point at original span when emitting unreachable lint

Fixes #64590

When we emit an 'unreachable' lint, we now add a note pointing at the
expression that actually causes the code to be unreachable (e.g.
`return`, `break`, `panic`).

This is especially useful when macros are involved, since a diverging
expression might be hidden inside of a macro invocation.
2019-09-19 18:31:39 +02:00
Mazdak Farrokhzad
bda52e558e
Rollup merge of #63448 - RalfJung:miri-discriminant, r=eddyb
fix Miri discriminant handling

This can be reviewed commit-by-commit fairly well.

The Miri side is at https://github.com/rust-lang/miri/pull/903.

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

r? @eddyb @oli-obk
2019-09-19 18:31:37 +02:00
Niko Matsakis
b2c51c24c9 avoid generating drops for moved operands of calls
Currently, after a CALL terminator is created in MIR, we insert DROP
statements for all of its operands -- even though they were just moved
shortly before! These spurious drops are later removed, but not before
causing borrow check errors.

This PR series modifies the drop code to track operands that were
moved and avoid creating drops for them.

Right now, I'm only using this mechanism for calls, but it seems
likely it could be used in more places.
2019-09-19 11:50:00 -04:00
Alex Crichton
d7f64749c0 rustbuild: Copy crate doc files fewer times
Previously when building documentation for the standard library we'd
copy all the files 5 times, and these files include libcore/libstd docs
which are huge! This commit instead only copies the files after rustdoc
has been run for each crate, reducing the number of redundant copies
we're making.
2019-09-19 08:37:53 -07:00
Alex Crichton
2fff78038c rustbuild: Don't package libstd twice
Looks like the packaging step for the standard library was happening
twice on CI, but it only needs to happen once! The `Analysis` packaging
step accidentally packaged `Std` instead of relying on compiling `Std`,
which meant that we ended up packaging it twice erroneously.
2019-09-19 07:46:24 -07:00
Niko Matsakis
e35698371d make clear that invalidate just replaces with default 2019-09-19 10:31:01 -04:00
Alex Crichton
72ea960056 azure: Convert Windows installations scripts to bash
Looks like `script`, which uses `cmd.exe`, doesn't have fail-fast
behavior and if a leading command fails the script doesn't actually fail
so long as the last command succeeds. We instead want the opposite
behavior where if any step fails the whole script fails.

I don't really know `cmd.exe` that well, nor powershell, so I've opted
to move everything to `bash` which should be a good common denominator
amongst all platforms to work with. Additionally I know that `set -e`
works to cause scripts to fail fast.

Note that some scripts remain as `script` since they don't appear to
work in` bash`. I'm not really sure why but I reorganized them slightly
to have the "meaty command" run at the end.
2019-09-19 07:29:45 -07:00
Niko Matsakis
9a447a232e replace boolean with lazy iteration
Should probably check how this performs, but it's always nicer to
track just a bit less mutable state.
2019-09-19 10:07:50 -04:00
Adrian Heine né Lang
c23e78a38b
Remove unnecessary mut in doc example 2019-09-19 13:36:10 +02:00
Ralf Jung
1de533ac1a first determine if the variant is a niche-variant, then compute absolute variant 2019-09-19 09:15:03 +02:00
bors
9b9d2aff8d Auto merge of #64545 - nnethercote:ObligForest-more, r=nmatsakis
More `ObligationForest` improvements

Following on from #64500, these commits alsomake the code both nicer and faster.

r? @nikomatsakis
2019-09-19 06:53:54 +00:00
Pietro Albini
5384a199c7
ci: split aws credentials in two separate users with scoped perms
This commit changes our CI to use two separate IAM users to
authenticate with AWS:

* ci--rust-lang--rust--sccache: has access to the rust-lang-ci-sccache2
  S3 bucket and its credentials are available during the whole build.
* ci--rust-lang--rust--upload: has access to the rust-lang-ci2 S3 bucket
  and its credentials are available just during the upload step.

The new tokens are available in the `prod-credentials` library.
2019-09-19 08:19:57 +02:00
Joshua Groves
37bafeafe7 Fix backticks in documentation 2019-09-18 23:17:36 -06:00
bors
19d070393c Auto merge of #64598 - Centril:rollup-htmf39p, r=Centril
Rollup of 5 pull requests

Successful merges:

 - #63630 (Update installed compiler dependencies)
 - #64536 (Update Cargo)
 - #64554 (Polonius: more `ui` test suite fixes)
 - #64566 (A more generic interface for dataflow analysis)
 - #64591 (Fix a minor grammar nit, update UI tests)

Failed merges:

r? @ghost
2019-09-19 02:54:11 +00:00
Mazdak Farrokhzad
cad2d5840b
Rollup merge of #64591 - jamesmunns:grammar-fix, r=jonas-schievink
Fix a minor grammar nit, update UI tests

Minor fix, but I noticed it while debugging some code
2019-09-19 04:53:12 +02:00
Mazdak Farrokhzad
67565ae4ae
Rollup merge of #64566 - ecstatic-morse:generic-dataflow, r=oli-obk
A more generic interface for dataflow analysis

#64470 requires a transfer function that is slightly more complex than the typical `gen`/`kill` one. Namely, it must copy state bits between locals when assignments occur (see #62547 for an attempt to make this fit into the existing framework). This PR contains a dataflow interface that allows for arbitrary transfer functions. The trade-off is efficiency: we can no longer coalesce transfer functions for blocks and must visit each statement individually while iterating to fixpoint.

Another issue is that poorly behaved transfer functions can result in an analysis that fails to converge. `gen`/`kill` sets do not have this problem. I believe that, in order to guarantee convergence, flipping a bit from `false` to `true` in the entry set cannot cause an output bit to go from `true` to `false` (negate all preceding booleans when `true` is the bottom value). Perhaps someone with a more formal background can confirm and we can add a section to the docs?

This approach is not maximally generic: it still requires that the lattice used for analysis is the powerset of values of `Analysis::Idx` for the `mir::Body` of interest. This can be done at a later date. Also, this is the bare minimum to get #64470 working. I've not adapted the existing debug framework to work with the new analysis, so there are no `rustc_peek` tests either. I'm planning to do this after #64470 is merged.

Finally, my ultimate plan is to make the existing, `gen`/`kill`-based `BitDenotation` a special case of `generic::Analysis`. Currently they share a ton of code. I should be able to do this without changing any implementers of `BitDenotation`. Something like:

```rust
struct GenKillAnalysis<A: BitDenotation> {
    trans_for_block: IndexVec<BasicBlock, GenKillSet<A::Idx>>,
    analysis: A,
}

impl<A> generic::Analysis for GenKillAnalysis<A> {
    // specializations of `apply_{partial,whole}_block_effect`...
}
```

r? @pnkfelix
2019-09-19 04:53:11 +02:00
Mazdak Farrokhzad
0835100412
Rollup merge of #64554 - lqd:polonius_tests4, r=nikomatsakis
Polonius: more `ui` test suite fixes

Since #62736, new tests have been added, and the `run-pass` suite was merged into the `ui` suite.

This PR adds the missing tests expectations for Polonius, and updates the existing ones where the NLL output has changed in some manner (e.g. ordering of notes)

Those are the trivial cases, but a more-detailed explanation is available [in this write-up](https://hackmd.io/CjYB0fs4Q9CweyeTdKWyEg?both#26-async-awaitasync-borrowck-escaping-closure-errorrs-outputs-from-NLL-Polonius-diff) starting at test case 26: they are only differing in diagnostics and instances of other existing test cases differences.

Only 3 of the 9020 tests are still "failing" at the moment (1 failure, 2 OOMs).

r? @nikomatsakis
2019-09-19 04:53:09 +02:00
Mazdak Farrokhzad
11a0b968c2
Rollup merge of #64536 - Aaron1011:cargo-crate-type, r=ehuss
Update Cargo

This pulls in https://github.com/rust-lang/cargo/pull/7159, which
ensures that documenting proc macros works correctly.
2019-09-19 04:53:08 +02:00
Mazdak Farrokhzad
d2b555eef3
Rollup merge of #63630 - andjo403:bump_compiler, r=nikomatsakis
Update installed compiler dependencies

As llvm have updated the minimum toolchain
https://reviews.llvm.org/D66188
2019-09-19 04:53:07 +02:00
Aaron Hill
d67528ff7d
Merge inherent impl blocks for `Diverges 2019-09-18 21:57:50 -04:00
Aaron Hill
d440e136e7
Update Cargo
This pulls in https://github.com/rust-lang/cargo/pull/7159, which
ensures that documenting proc macros works correctly.
2019-09-18 21:53:50 -04:00
Aaron Hill
034a8fd1df
Another formatting fix
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-09-18 20:14:56 -04:00
Aaron Hill
41e1128969
Use 'if let' instead of 'match' 2019-09-18 20:07:33 -04:00
Aaron Hill
a8ce93e13a
Introduce Diverges::always constructor
Rename the existing Diverges.always method to Diverges.is_always
2019-09-18 20:04:01 -04:00
Aaron Hill
6edcfbe59a
Apply formatting fixes
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-09-18 19:48:37 -04:00
Aaron Hill
9e777eb45d
Some formatting cleanup 2019-09-18 19:31:38 -04:00