]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoClean up E0368 and E0369 explanations
Guillaume Gomez [Mon, 24 Feb 2020 11:55:49 +0000 (12:55 +0100)]
Clean up E0368 and E0369 explanations

4 years agoAuto merge of #69290 - wesleywiser:speed_up_ctfe_stress_4, r=RalfJung
bors [Fri, 21 Feb 2020 06:43:40 +0000 (06:43 +0000)]
Auto merge of #69290 - wesleywiser:speed_up_ctfe_stress_4, r=RalfJung

Check `RUSTC_CTFE_BACKTRACE` much less by generating fewer errors

Before this change, `get_size_and_align()`  calls `get_fn_alloc()` *a
lot* in CTFE heavy code. This previously returned an `Error` which would
check if `RUSTC_CTFE_BACKTRACE` was set on construction. Doing this
turned out to be a performance hotspot as @nnethercote discovered in
#68792.

This is an alternate take on that PR which resolves the performance
issue by generating *many* fewer errors. Previously, `ctfe-stress-4`
would generate over 5,000,000 errors each of which would check for the
presence of the environment variable. With these changes, that number is
reduced to 30.

r? @RalfJung

4 years agoAuto merge of #69281 - nnethercote:inline-some-encoding-decoding-methods, r=Centril
bors [Fri, 21 Feb 2020 03:14:55 +0000 (03:14 +0000)]
Auto merge of #69281 - nnethercote:inline-some-encoding-decoding-methods, r=Centril

Inline some encoding and decoding methods.

This is a small performance win.

r? @Centril

4 years agoAuto merge of #69072 - ecstatic-morse:associated-items, r=petrochenkov
bors [Thu, 20 Feb 2020 22:44:01 +0000 (22:44 +0000)]
Auto merge of #69072 - ecstatic-morse:associated-items, r=petrochenkov

O(log n) lookup of associated items by name

Resolves #68957, in which compile time is quadratic in the number of associated items. This PR makes name lookup use binary search instead of a linear scan to improve its asymptotic performance. As a result, the pathological case from that issue now runs in 8 seconds on my local machine, as opposed to many minutes on the current stable.

Currently, method resolution must do a linear scan through all associated items of a type to find one with a certain name. This PR changes the result of the `associated_items` query to a data structure that preserves the definition order of associated items (which is used, e.g., for the layout of trait object vtables) while adding an index of those items sorted by (unhygienic) name. When doing name lookup, we first find all items with the same `Symbol` using binary search, then run hygienic comparison to find the one we are looking for. Ideally, this would be implemented using an insertion-order preserving, hash-based multi-map, but one is not readily available.

Someone who is more familiar with identifier hygiene could probably make this better by auditing the uses of the `AssociatedItems` interface. My goal was to preserve the current behavior exactly, even if it seemed strange (I left at least one FIXME to this effect). For example, some places use comparison with `ident.modern()` and some places use `tcx.hygienic_eq` which requires the `DefId` of the containing `impl`. I don't know whether those approaches are equivalent or which one should be preferred.

4 years agoAuto merge of #69325 - Centril:rollup-vce2ko2, r=Centril
bors [Thu, 20 Feb 2020 19:19:54 +0000 (19:19 +0000)]
Auto merge of #69325 - Centril:rollup-vce2ko2, r=Centril

Rollup of 5 pull requests

Successful merges:

 - #68877 (On mismatched argument count point at arguments)
 - #69185 (Unify and improve const-prop lints)
 - #69305 (Tweak binding lifetime suggestion text)
 - #69311 (Clean up E0321 and E0322)
 - #69317 (Fix broken link to the rustc guide)

Failed merges:

r? @ghost

4 years agoRollup merge of #69317 - LeSeulArtichaut:patch-1, r=Dylan-DPC
Mazdak Farrokhzad [Thu, 20 Feb 2020 19:18:55 +0000 (20:18 +0100)]
Rollup merge of #69317 - LeSeulArtichaut:patch-1, r=Dylan-DPC

Fix broken link to the rustc guide

4 years agoRollup merge of #69311 - GuillaumeGomez:clean-up-e0321-e0322, r=Dylan-DPC
Mazdak Farrokhzad [Thu, 20 Feb 2020 19:18:53 +0000 (20:18 +0100)]
Rollup merge of #69311 - GuillaumeGomez:clean-up-e0321-e0322, r=Dylan-DPC

Clean up E0321 and E0322

r? @Dylan-DPC

4 years agoRollup merge of #69305 - estebank:consider-lt, r=Dylan-DPC
Mazdak Farrokhzad [Thu, 20 Feb 2020 19:18:52 +0000 (20:18 +0100)]
Rollup merge of #69305 - estebank:consider-lt, r=Dylan-DPC

Tweak binding lifetime suggestion text

We already have a structured suggestion, but the wording made it seem like that wasn't the case.

Fix #65286. r? @varkor

4 years agoRollup merge of #69185 - RalfJung:const-prop-lints, r=oli-obk
Mazdak Farrokhzad [Thu, 20 Feb 2020 19:18:50 +0000 (20:18 +0100)]
Rollup merge of #69185 - RalfJung:const-prop-lints, r=oli-obk

Unify and improve const-prop lints

Add a single helper method for all lints emitted by const-prop, and make that lint different from the CTFE `const_err` lint. Also consistently check overflow on *arithmetic*, not on the assertion, to make behavior the same for debug and release builds.

See [this summary comment](https://github.com/rust-lang/rust/pull/69185#issuecomment-587924754) for details and the latest status.

In terms of lint formatting, I went for what seems to be the better style: have a general message above the code, and then a specific message at the span:
```
error: this arithmetic operation will overflow
  --> $DIR/const-err2.rs:21:18
   |
LL |     let a_i128 = -std::i128::MIN;
   |                  ^^^^^^^^^^^^^^^ attempt to negate with overflow
```
We could also just have the specific message above and no text at the span if that is preferred.

I also converted some of the existing tests to use compiletest revisions, so that the same test can check a bunch of different compile flags.

Fixes https://github.com/rust-lang/rust/issues/69020.
Helps with https://github.com/rust-lang/rust/issues/69021: debug/release are now consistent, but the assoc-const test in that issue still fails (there is a FIXME in the PR for this). The reason seems to be that const-prop notices the assoc const in `T::N << 42` and does not even bother calling `const_prop` on that operation.
Has no effect on https://github.com/rust-lang/rust/issues/61821; the duplication there has entirely different reasons.

4 years agoRollup merge of #68877 - estebank:point-at-params, r=petrochenkov
Mazdak Farrokhzad [Thu, 20 Feb 2020 19:18:48 +0000 (20:18 +0100)]
Rollup merge of #68877 - estebank:point-at-params, r=petrochenkov

On mismatched argument count point at arguments

4 years agoFix broken link to the rustc guide
LeSeulArtichaut [Thu, 20 Feb 2020 16:20:31 +0000 (17:20 +0100)]
Fix broken link to the rustc guide

4 years agoAuto merge of #69145 - matthewjasper:mir-typeck-static-ty, r=nikomatsakis
bors [Thu, 20 Feb 2020 15:52:57 +0000 (15:52 +0000)]
Auto merge of #69145 - matthewjasper:mir-typeck-static-ty, r=nikomatsakis

Fix MIR typeck soundness holes

* Check types of static items
* Always check lifetime bounds of `Copy` impls

r? @nikomatsakis
closes #69114

4 years agoGreatly improve E0322 explanation
Guillaume Gomez [Thu, 20 Feb 2020 13:26:56 +0000 (14:26 +0100)]
Greatly improve E0322 explanation

4 years agoclean up E0321 explanation
Guillaume Gomez [Thu, 20 Feb 2020 13:26:43 +0000 (14:26 +0100)]
clean up E0321 explanation

4 years agoAuto merge of #69309 - Dylan-DPC:rollup-gjdqx7l, r=Dylan-DPC
bors [Thu, 20 Feb 2020 12:06:12 +0000 (12:06 +0000)]
Auto merge of #69309 - Dylan-DPC:rollup-gjdqx7l, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #68705 (Add LinkedList::remove())
 - #68945 (Stabilize Once::is_completed)
 - #68978 (Make integer exponentiation methods unstably const)
 - #69266 (Fix race condition when allocating source files in SourceMap)
 - #69287 (Clean up E0317 explanation)

Failed merges:

r? @ghost

4 years agoRollup merge of #69287 - GuillaumeGomez:clean-e0317, r=Dylan-DPC
Dylan DPC [Thu, 20 Feb 2020 09:49:14 +0000 (10:49 +0100)]
Rollup merge of #69287 - GuillaumeGomez:clean-e0317, r=Dylan-DPC

Clean up E0317 explanation

r? @Dylan-DPC

4 years agoRollup merge of #69266 - Zoxc:fix-source-map-race, r=wesleywiser
Dylan DPC [Thu, 20 Feb 2020 09:49:13 +0000 (10:49 +0100)]
Rollup merge of #69266 - Zoxc:fix-source-map-race, r=wesleywiser

Fix race condition when allocating source files in SourceMap

This makes allocating address space in the source map an atomic operation. `rustc` does not currently do this in parallel, so this bug can't trigger, but parsing files in parallel could trigger it, and that is something we want to do.

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

r? @wesleywiser

4 years agoRollup merge of #68978 - ecstatic-morse:const-int-pow, r=oli-obk
Dylan DPC [Thu, 20 Feb 2020 09:49:12 +0000 (10:49 +0100)]
Rollup merge of #68978 - ecstatic-morse:const-int-pow, r=oli-obk

Make integer exponentiation methods unstably const

cc #53718

This makes the following inherent methods on integer primitives into unstable `const fn`:
- `pow`
- `checked_pow`
- `wrapping_pow`
- `overflowing_pow`
- `saturating_pow`
- `next_power_of_two`
- `checked_next_power_of_two`
- `wrapping_next_power_of_two`

Only two changes were made to the implementation of these methods. First, I had to switch from the `?` operator, which is not yet implemented in a const context, to a `try_opt` macro. Second, `next_power_of_two` was using `ops::Add::add` (see the first commit) to "get overflow checks", so I switched to `#[rustc_inherit_overflow_checks]`. I'm not quite sure why the attribute wasn't used in the first place.

4 years agoRollup merge of #68945 - mjbshaw:once_is_completed, r=LukasKalbertodt
Dylan DPC [Thu, 20 Feb 2020 09:49:10 +0000 (10:49 +0100)]
Rollup merge of #68945 - mjbshaw:once_is_completed, r=LukasKalbertodt

Stabilize Once::is_completed

Closes #54890

This function has been around for some time. I haven't seen anyone raise any objections to it. I've personally found it useful myself. It would be nice to finally stabilize it and

4 years agoRollup merge of #68705 - BijanT:ll_remove, r=Mark-Simulacrum
Dylan DPC [Thu, 20 Feb 2020 09:49:08 +0000 (10:49 +0100)]
Rollup merge of #68705 - BijanT:ll_remove, r=Mark-Simulacrum

Add LinkedList::remove()

LinkedList::remove() removes the element at the specified index and returns it.

I added this because I think having a remove function would be useful to have, and similar functions are in other containers, like Vec and HashMap.

I'm not sure if adding a feature like this requires an RFC or not, so I'm sorry if this PR is premature.

4 years agoAuto merge of #68847 - ecstatic-morse:const-impl, r=oli-obk
bors [Thu, 20 Feb 2020 08:41:17 +0000 (08:41 +0000)]
Auto merge of #68847 - ecstatic-morse:const-impl, r=oli-obk

Allow trait methods to be called on concrete types in a const context

This partially implements [RFC 2632](https://github.com/rust-lang/rfcs/pull/2632) by const-checking methods inside an `impl const` block and allowing those methods to be called on concrete types. Calling trait methods on type parameters in a const context is not yet allowed. Implementing this will require much more work. Since we are only concerned with methods on concrete types, we are able to take advantage of the machinery in `Instance::resolve`, which is doing most of the work.

This also propagates `#[rustc_const_unstable]` from parent items to child items, making that attribute behave like `#[stable]` and `#[unstable]` do. This allows trait methods to be marked as unstably const.

cc #67792 #57563
cc @rust-lang/wg-const-eval
r? @oli-obk

4 years agoAuto merge of #67925 - petertodd:2020-fromstr-infallible, r=LukasKalbertodt
bors [Thu, 20 Feb 2020 05:18:18 +0000 (05:18 +0000)]
Auto merge of #67925 - petertodd:2020-fromstr-infallible, r=LukasKalbertodt

Change FromStr for String to use Infallible directly

Fixes the confusing documentation on `ParseError` by making it irrelevant.

It might be fine to mark it as depreciated right now too - I can't imagine much code uses `ParseError` directly.

4 years agoTweak binding lifetime suggestion text
Esteban Küber [Thu, 20 Feb 2020 02:04:03 +0000 (18:04 -0800)]
Tweak binding lifetime suggestion text

We already have a structured suggestion, but the wording made it seem
like that wasn't the case.
Fix #65286. r? @varkor

4 years agoAuto merge of #69256 - nnethercote:misc-inlining, r=Centril
bors [Thu, 20 Feb 2020 02:00:31 +0000 (02:00 +0000)]
Auto merge of #69256 - nnethercote:misc-inlining, r=Centril

Miscellaneous inlining improvements

These commits inline some hot functions that aren't currently inlined, for some speed wins.

r? @Centril

4 years agoCheck `RUSTC_CTFE_BACKTRACE` much less by generating fewer errors
Wesley Wiser [Wed, 19 Feb 2020 12:59:21 +0000 (07:59 -0500)]
Check `RUSTC_CTFE_BACKTRACE` much less by generating fewer errors

Before this change, `get_size_and_align()`  calls `get_fn_alloc()` *a
lot* in CTFE heavy code. This previously returned an `Error` which would
check if `RUSTC_CTFE_BACKTRACE` was set on construction. Doing this
turned out to be a performance hotspot as @nnethercote discovered in
#68792.

This is an alternate take on that PR which resolves the performance
issue by generating *many* fewer errors. Previously, `ctfe-stress-4`
would generate over 5,000,000 errors each of which would check for the
presence of the environment variable. With these changes, that number is
reduced to 30.

4 years agoAuto merge of #68988 - Zoxc:query-caches, r=eddyb
bors [Wed, 19 Feb 2020 22:29:07 +0000 (22:29 +0000)]
Auto merge of #68988 - Zoxc:query-caches, r=eddyb

Add an abstraction for custom query caches

r? @eddyb

4 years agoChange FromStr for String to use Infallible directly
Peter Todd [Wed, 19 Feb 2020 21:37:58 +0000 (16:37 -0500)]
Change FromStr for String to use Infallible directly

Fixes the confusing documentation on `ParseError` by making it
irrelevant.

4 years agoConstruct `AssociatedItems` from an iterator instead of a `Vec`
Dylan MacKenzie [Wed, 19 Feb 2020 20:55:59 +0000 (12:55 -0800)]
Construct `AssociatedItems` from an iterator instead of a `Vec`

4 years agofix 32bit-only test
Ralf Jung [Wed, 19 Feb 2020 19:12:01 +0000 (20:12 +0100)]
fix 32bit-only test

4 years agoAuto merge of #69293 - Dylan-DPC:rollup-imcbvgo, r=Dylan-DPC
bors [Wed, 19 Feb 2020 19:10:58 +0000 (19:10 +0000)]
Auto merge of #69293 - Dylan-DPC:rollup-imcbvgo, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #68863 (ci: switch macOS builders to 10.15)
 - #69142 (Add shared script for linkchecking books.)
 - #69248 (Don't eliminate frame pointers on thumb targets)
 - #69280 (Remove special case for `simd_shuffle` arg promotion)
 - #69284 (Reword OpenOptions::{create, create_new} doc.)

Failed merges:

r? @ghost

4 years agoReplace FIXME with explanation
Dylan MacKenzie [Mon, 17 Feb 2020 21:35:49 +0000 (13:35 -0800)]
Replace FIXME with explanation

4 years agoMake lookup of associated item by name O(log n)
Dylan MacKenzie [Mon, 17 Feb 2020 21:09:01 +0000 (13:09 -0800)]
Make lookup of associated item by name O(log n)

4 years agoReplace `rustc_typeck::Namespace` with `rustc_hir::def::Namespace`
Dylan MacKenzie [Tue, 11 Feb 2020 18:41:28 +0000 (10:41 -0800)]
Replace `rustc_typeck::Namespace` with `rustc_hir::def::Namespace`

4 years agoImplement an insertion-order preserving, efficient multi-map
Dylan MacKenzie [Sun, 16 Feb 2020 22:40:12 +0000 (14:40 -0800)]
Implement an insertion-order preserving, efficient multi-map

4 years agoUpdate tests
Dylan MacKenzie [Tue, 18 Feb 2020 23:45:54 +0000 (15:45 -0800)]
Update tests

4 years agoRollup merge of #69284 - jumbatm:openoptions-create-doc, r=Dylan-DPC
Dylan DPC [Wed, 19 Feb 2020 17:12:13 +0000 (18:12 +0100)]
Rollup merge of #69284 - jumbatm:openoptions-create-doc, r=Dylan-DPC

Reword OpenOptions::{create, create_new} doc.

Closes #69254.

Currently, the doc comment for `fs::OpenOptions::create` doesn't mention its behaviour when opening an existing file, and `fs::OpenOptions::create_new`'s doc comment is worded in a way that doesn't make it clear that it actually _fails_ if the file already exists, not overwrite the existing file with a new one.

This PR addresses addresses this by rewording the doc comments to be more explicit.

r? @GuillaumeGomez

4 years agoRollup merge of #69280 - ecstatic-morse:promote-shuffle-no-special-case, r=petrochenkov
Dylan DPC [Wed, 19 Feb 2020 17:12:11 +0000 (18:12 +0100)]
Rollup merge of #69280 - ecstatic-morse:promote-shuffle-no-special-case, r=petrochenkov

Remove special case for `simd_shuffle` arg promotion

After rust-lang/stdarch#825, these intrinsics are now defined with `#[rustc_args_required_const(2)]`, so the special-case is no longer necessary.

4 years agoRollup merge of #69248 - jonas-schievink:thumb-fp, r=japaric
Dylan DPC [Wed, 19 Feb 2020 17:12:10 +0000 (18:12 +0100)]
Rollup merge of #69248 - jonas-schievink:thumb-fp, r=japaric

Don't eliminate frame pointers on thumb targets

This should hopefully fix issues https://github.com/rust-lang/rust/issues/69231 and https://github.com/rust-embedded/cortex-m-rt/issues/139.

~~I couldn't test this locally as the rustc I produced does not create binaries (no idea why).~~ Resolved.

4 years agoRollup merge of #69142 - ehuss:linkcheck-script, r=alexcrichton
Dylan DPC [Wed, 19 Feb 2020 17:12:09 +0000 (18:12 +0100)]
Rollup merge of #69142 - ehuss:linkcheck-script, r=alexcrichton

Add shared script for linkchecking books.

This adds a script that can be used on each book's CI to ensure they don't break local links.

I've been running something similar on the reference CI.  The intent here is to add this to all the external books' CI scripts. This will help avoid dealing with broken links when updating submodules on rust-lang/rust.

4 years agoRollup merge of #68863 - pietroalbini:azure-macos-10.15, r=Mark-Simulacrum
Dylan DPC [Wed, 19 Feb 2020 17:12:07 +0000 (18:12 +0100)]
Rollup merge of #68863 - pietroalbini:azure-macos-10.15, r=Mark-Simulacrum

ci: switch macOS builders to 10.15

Azure Pipelines is deprecating the macOS 10.13 image we're currently running, [and they plan to remove them](https://devblogs.microsoft.com/devops/removing-older-images-in-azure-pipelines-hosted-pools/) on March 23, 2020. This PR switches our macOS builders to macOS 10.15.

r? @Mark-Simulacrum

4 years agoAdd LinkedList::remove()
Bijan Tabatabai [Fri, 31 Jan 2020 16:16:55 +0000 (10:16 -0600)]
Add LinkedList::remove()

LinkedList::remove() removes the element at the specified index and returns it.

Signed-off-by: Bijan Tabatabai <bijan311@yahoo.com>
4 years agoAuto merge of #69198 - ollie27:rustbuild_rustdoc-js, r=Mark-Simulacrum
bors [Wed, 19 Feb 2020 15:55:57 +0000 (15:55 +0000)]
Auto merge of #69198 - ollie27:rustbuild_rustdoc-js, r=Mark-Simulacrum

Fix running rustdoc-js test suite individually

Without `Compiletest.path` set running `x.py test src/test/rustdoc-js` would run the `rustdoc-js` test suite with everything filtered out.

As this was the only place setting `Compiletest.path` to `None` this removes the `Option` wrapper as well.

4 years agoClean up E0317 explanation
Guillaume Gomez [Wed, 19 Feb 2020 11:59:35 +0000 (12:59 +0100)]
Clean up E0317 explanation

4 years agoUse a constructor function per dep node instead of an enum and a single function
John Kåre Alsaker [Mon, 17 Feb 2020 18:04:06 +0000 (19:04 +0100)]
Use a constructor function per dep node instead of an enum and a single function

4 years agoRemove support for dep node structs
John Kåre Alsaker [Mon, 17 Feb 2020 17:41:21 +0000 (18:41 +0100)]
Remove support for dep node structs

4 years agoTune inlining
John Kåre Alsaker [Mon, 17 Feb 2020 17:38:30 +0000 (18:38 +0100)]
Tune inlining

4 years agoFix cache hit stats
John Kåre Alsaker [Sat, 15 Feb 2020 11:00:31 +0000 (12:00 +0100)]
Fix cache hit stats

4 years agoAdd a stat for local DefId density
John Kåre Alsaker [Sat, 15 Feb 2020 09:44:27 +0000 (10:44 +0100)]
Add a stat for local DefId density

4 years agoSplit query stats into its own file
John Kåre Alsaker [Sat, 15 Feb 2020 08:48:10 +0000 (09:48 +0100)]
Split query stats into its own file

4 years agoAdd a `storage` query modifier to override the query cache
John Kåre Alsaker [Fri, 14 Feb 2020 17:29:20 +0000 (18:29 +0100)]
Add a `storage` query modifier to override the query cache

4 years agoAdd an abstraction for custom query caches
John Kåre Alsaker [Sat, 8 Feb 2020 06:38:00 +0000 (07:38 +0100)]
Add an abstraction for custom query caches

4 years agoMake `try_get_cached` take closures
John Kåre Alsaker [Thu, 13 Feb 2020 11:18:57 +0000 (12:18 +0100)]
Make `try_get_cached` take closures

4 years agoSplit query execution into hot and cold paths
John Kåre Alsaker [Wed, 12 Feb 2020 20:04:36 +0000 (21:04 +0100)]
Split query execution into hot and cold paths

4 years agoAuto merge of #69278 - matthiaskrgr:submodule_upd, r=Dylan-DPC
bors [Wed, 19 Feb 2020 11:16:01 +0000 (11:16 +0000)]
Auto merge of #69278 - matthiaskrgr:submodule_upd, r=Dylan-DPC

submodules: update clippy from b91ae16e to 2855b214

Changes:
````
Rustup to rust-lang/rust#69194
Rustup to rust-lang/rust#69181
Add `LOG2_10` and `LOG10_2` to `approx_const` lint
Clean up imports
Use `Vec::with_capacity()` as possible
needless_doctest_main: False positive for async fn
Remove use of `TyKind`.
Use `if_chain`.
Fix ICE.
Add tests and improve checks.
Add `Future` detection for `missing_errors_doc`.
````

Fixes #69269

4 years agoavoid excessive number of revisions
Ralf Jung [Wed, 19 Feb 2020 10:25:41 +0000 (11:25 +0100)]
avoid excessive number of revisions

4 years agoReword OpenOptions::{create, create_new} doc.
jumbatm [Wed, 19 Feb 2020 09:57:32 +0000 (19:57 +1000)]
Reword OpenOptions::{create, create_new} doc.

4 years agoAuto merge of #69265 - ehuss:update-cargo, r=Dylan-DPC
bors [Wed, 19 Feb 2020 08:07:42 +0000 (08:07 +0000)]
Auto merge of #69265 - ehuss:update-cargo, r=Dylan-DPC

Update cargo

9 commits in 3c53211c3d7fee4f430f170115af5baad17a3da9..e02974078a692d7484f510eaec0e88d1b6cc0203
2020-02-07 15:35:03 +0000 to 2020-02-18 15:24:43 +0000
- Set an environment variable for tests to find executables. (rust-lang/cargo#7697)
- Rework internal errors. (rust-lang/cargo#7896)
- Improvements to StringList config handling. (rust-lang/cargo#7891)
- Add new/old rustflags to fingerprint log. (rust-lang/cargo#7890)
- Fix inaccurate doc comment on `env_args`. (rust-lang/cargo#7889)
- Add some extra fingerprint debug information. (rust-lang/cargo#7888)
- Link the licenses into crates/cargo-platform (rust-lang/cargo#7886)
- Modify test to make `rustc` PR mergeable (rust-lang/cargo#7883)
- Keep environment variables in a BTreeMap to preserve sort order (rust-lang/cargo#7877)

4 years agoAdd `#[rustc_args_required_const]` to `simd_shuffle` tests
Dylan MacKenzie [Wed, 19 Feb 2020 07:17:21 +0000 (23:17 -0800)]
Add `#[rustc_args_required_const]` to `simd_shuffle` tests

4 years agoInline some encoding and decoding methods.
Nicholas Nethercote [Wed, 19 Feb 2020 05:54:36 +0000 (16:54 +1100)]
Inline some encoding and decoding methods.

This is a small performance win.

4 years agoRemove mention of `simd_shuffle` promotion from comments
Dylan MacKenzie [Wed, 19 Feb 2020 05:32:38 +0000 (21:32 -0800)]
Remove mention of `simd_shuffle` promotion from comments

4 years agoRemove special case for `simd_shuffle` arg promotion
Dylan MacKenzie [Wed, 19 Feb 2020 05:28:56 +0000 (21:28 -0800)]
Remove special case for `simd_shuffle` arg promotion

After rust-lang/stdarch#825, these intrinsics are now defined with
`#[rustc_args_required_const(2)]`, so the special-case is no longer
necessary.

4 years agoPrevent const trait methods from being marked stable
Dylan MacKenzie [Tue, 18 Feb 2020 23:45:39 +0000 (15:45 -0800)]
Prevent const trait methods from being marked stable

4 years agoMake `fn_queries` helpers module-private
Dylan MacKenzie [Tue, 18 Feb 2020 23:45:14 +0000 (15:45 -0800)]
Make `fn_queries` helpers module-private

4 years agoAdd passing test for `Add` on generic struct
Dylan MacKenzie [Mon, 10 Feb 2020 19:26:40 +0000 (11:26 -0800)]
Add passing test for `Add` on generic struct

4 years agoRemove outdated FIXME
Dylan MacKenzie [Fri, 7 Feb 2020 20:32:49 +0000 (12:32 -0800)]
Remove outdated FIXME

4 years agoAdd ignored test for associated types in const impl
Dylan MacKenzie [Fri, 7 Feb 2020 19:06:44 +0000 (11:06 -0800)]
Add ignored test for associated types in const impl

4 years agoTest `rustc_const_unstable` on trait fns
Dylan MacKenzie [Fri, 7 Feb 2020 19:06:12 +0000 (11:06 -0800)]
Test `rustc_const_unstable` on trait fns

4 years agoPropagate `rustc_const_unstable` to children
Dylan MacKenzie [Fri, 7 Feb 2020 18:24:22 +0000 (10:24 -0800)]
Propagate `rustc_const_unstable` to children

4 years agoUse early return when forbidding unstable attrs
Dylan MacKenzie [Fri, 7 Feb 2020 17:56:56 +0000 (09:56 -0800)]
Use early return when forbidding unstable attrs

4 years agoEnsure const impl cannot coexist with non-const impl
Dylan MacKenzie [Wed, 5 Feb 2020 17:40:47 +0000 (09:40 -0800)]
Ensure const impl cannot coexist with non-const impl

4 years agoSplit const trait method test and impl `ops::Add`
Dylan MacKenzie [Wed, 5 Feb 2020 17:35:32 +0000 (09:35 -0800)]
Split const trait method test and impl `ops::Add`

4 years agoAdd tests for calling trait methods on concrete types
Dylan MacKenzie [Tue, 4 Feb 2020 22:03:37 +0000 (14:03 -0800)]
Add tests for calling trait methods on concrete types

4 years agoCheck for trait methods on concrete types in const checking
Dylan MacKenzie [Tue, 4 Feb 2020 22:03:16 +0000 (14:03 -0800)]
Check for trait methods on concrete types in const checking

4 years agoRemove "not yet implemented" warning
Dylan MacKenzie [Mon, 3 Feb 2020 23:02:30 +0000 (15:02 -0800)]
Remove "not yet implemented" warning

4 years agoAuto merge of #69113 - ecstatic-morse:unified-dataflow-borrowed, r=wesleywiser
bors [Wed, 19 Feb 2020 04:57:10 +0000 (04:57 +0000)]
Auto merge of #69113 - ecstatic-morse:unified-dataflow-borrowed, r=wesleywiser

Combine `HaveBeenBorrowedLocals` and `IndirectlyMutableLocals` into one dataflow analysis

This PR began as an attempt to port `HaveBeenBorrowedLocals` to the new dataflow framework (see #68241 for prior art). Along the way, I noticed that it could share most of its code with `IndirectlyMutableLocals` and then found a few bugs in the two analyses:
- Neither one marked locals as borrowed after an `Rvalue::AddressOf`.
- `IndirectlyMutableLocals` was missing a minor fix that `HaveBeenBorrowedLocals` got in #61069. This is not a problem today since it is only used during const-checking, where custom drop glue is forbidden. However, this may change some day.

I decided to combine the two analyses so that they wouldn't diverge in the future while ensuring that they remain distinct types (called `MaybeBorrowedLocals` and `MaybeMutBorrowedLocals` to be consistent with the `Maybe{Un,}InitializedPlaces` naming scheme). I fixed the bugs and switched to exhaustive matching where possible to make them less likely in the future. Finally, I added comments explaining some of the finer points of the transfer function for these analyses (see #61069 and #65006).

4 years agoConst-check functions in a `const` impl
Dylan MacKenzie [Mon, 3 Feb 2020 22:57:45 +0000 (14:57 -0800)]
Const-check functions in a `const` impl

4 years agoAdd `is_const_impl_raw` query
Dylan MacKenzie [Mon, 3 Feb 2020 20:21:27 +0000 (12:21 -0800)]
Add `is_const_impl_raw` query

4 years agosubmodules: update clippy from b91ae16e to 2855b214
Matthias Krüger [Wed, 19 Feb 2020 02:45:10 +0000 (03:45 +0100)]
submodules: update clippy from b91ae16e to 2855b214

Changes:
````
Rustup to rust-lang/rust#69194
Rustup to rust-lang/rust#69181
Add `LOG2_10` and `LOG10_2` to `approx_const` lint
Clean up imports
Use `Vec::with_capacity()` as possible
needless_doctest_main: False positive for async fn
Remove use of `TyKind`.
Use `if_chain`.
Fix ICE.
Add tests and improve checks.
Add `Future` detection for `missing_errors_doc`.
````

Fixes #69269

4 years agoAuto merge of #69241 - shahn:checked_add_revert, r=Mark-Simulacrum,lqd
bors [Wed, 19 Feb 2020 01:36:31 +0000 (01:36 +0000)]
Auto merge of #69241 - shahn:checked_add_revert, r=Mark-Simulacrum,lqd

Revert "Remove `checked_add` in `Layout::repeat`"

This fixes a a segfault in safe code, a stable regression. Reported in #69225.

This reverts commit a983e0590a43ed8b0f60417828efd4e79b51f494.

4 years agoRevert "Remove `checked_add` in `Layout::repeat`"
Sebastian Hahn [Mon, 17 Feb 2020 17:55:41 +0000 (18:55 +0100)]
Revert "Remove `checked_add` in `Layout::repeat`"

This fixes a a segfault in safe code, a stable regression. Reported in
\#69225.

This reverts commit a983e0590a43ed8b0f60417828efd4e79b51f494.

Also adds a test for the expected behaviour.

4 years agoAuto merge of #69271 - Centril:rollup-iupsol6, r=Centril
bors [Tue, 18 Feb 2020 22:29:06 +0000 (22:29 +0000)]
Auto merge of #69271 - Centril:rollup-iupsol6, r=Centril

Rollup of 6 pull requests

Successful merges:

 - #69146 (Always const qualify literals by type)
 - #69159 (Select an appropriate unused lifetime name in suggestion)
 - #69194 (parse: fuse associated and extern items up to defaultness)
 - #69211 (parser: Simplify treatment of macro variables in `Parser::bump`)
 - #69217 (Do not emit note suggesting to implement operation trait to foreign type)
 - #69236 (parse: recover `mut (x @ y)` as `(mut x @ mut y)`.)

Failed merges:

r? @ghost

4 years agobetter lint names
Ralf Jung [Tue, 18 Feb 2020 21:49:47 +0000 (22:49 +0100)]
better lint names

4 years agoFix race condition when allocating source files in SourceMap
John Kåre Alsaker [Tue, 18 Feb 2020 17:24:36 +0000 (18:24 +0100)]
Fix race condition when allocating source files in SourceMap

4 years agoRollup merge of #69236 - Centril:mut-parens-at-recovery, r=estebank
Mazdak Farrokhzad [Tue, 18 Feb 2020 21:16:31 +0000 (22:16 +0100)]
Rollup merge of #69236 - Centril:mut-parens-at-recovery, r=estebank

parse: recover `mut (x @ y)` as `(mut x @ mut y)`.

Follow up to https://github.com/rust-lang/rust/pull/68992#discussion_r376829749 and https://github.com/rust-lang/rust/pull/63945.

Specifically, when given `let mut (x @ y)` we recover with `let (mut x @ mut y)` as the suggestion:

```rust
error: `mut` must be attached to each individual binding
  --> $DIR/mut-patterns.rs:12:9
   |
LL |     let mut (x @ y) = 0;
   |         ^^^^^^^^^^^ help: add `mut` to each binding: `(mut x @ mut y)`
   |
   = note: `mut` may be followed by `variable` and `variable @ pattern`
```

r? @matthewjasper @estebank

4 years agoRollup merge of #69217 - LeSeulArtichaut:remove-lint-impl-op, r=estebank
Mazdak Farrokhzad [Tue, 18 Feb 2020 21:16:29 +0000 (22:16 +0100)]
Rollup merge of #69217 - LeSeulArtichaut:remove-lint-impl-op, r=estebank

Do not emit note suggesting to implement operation trait to foreign type

When a binary operation isn't valid, you will get a lint proposing to add a trait implementation to make the operation possible. However, this cannot be done for foreign types, such as types from `core` or `std`.

For example:
```
= note: an implementation of `std::ops::Add` might be missing for `std::option::Option<i8>`
```
As mentioned in https://github.com/rust-lang/rust/issues/60497#issuecomment-562665539:
> The note suggesting implementing Add<i8> should only be emitted if Option<i8> were local to the current crate, which it isn't, so in this case it shouldn't be emitted.

(I will use the CI to check tests for me, or my computer will just burn... and running IDEs is not possible on a pile of ashes)

r? @estebank

4 years agoRollup merge of #69211 - petrochenkov:prevtok, r=Centril
Mazdak Farrokhzad [Tue, 18 Feb 2020 21:16:28 +0000 (22:16 +0100)]
Rollup merge of #69211 - petrochenkov:prevtok, r=Centril

parser: Simplify treatment of macro variables in `Parser::bump`

Follow-up to https://github.com/rust-lang/rust/pull/69006.

Token normalization for `$ident` and `$lifetime` is merged directly into `bump`.
Special "unknown macro variable" diagnostic for unexpected `$`s is removed as preventing legal code from compiling (as a result `bump` also doesn't call itself recursively anymore and can't make `prev_token` inconsistent).

r? @Centril

4 years agoRollup merge of #69194 - Centril:assoc-extern-fuse, r=petrochenkov
Mazdak Farrokhzad [Tue, 18 Feb 2020 21:16:26 +0000 (22:16 +0100)]
Rollup merge of #69194 - Centril:assoc-extern-fuse, r=petrochenkov

parse: fuse associated and extern items up to defaultness

Language changes:

- The grammar of extern `type` aliases is unified with associated ones, and becomes:
  ```rust
  TypeItem = "type" ident generics {":" bounds}? where_clause {"=" type}? ";" ;
  ```

  Semantic restrictions (`ast_validation`) are added to forbid any parameters in `generics`, any bounds in `bounds`, and any predicates in `where_clause`, as well as the presence of a type expression (`= u8`).

  (Work still remains to fuse this with free `type` aliases, but this can be done later.)

- The grammar of constants and static items (free, associated, and extern) now permits the absence of an expression, and becomes:

  ```rust
  GlobalItem = {"const" {ident | "_"} | "static" "mut"? ident} {"=" expr}? ";" ;
  ```

  - A semantic restriction is added to enforce the presence of the expression (the body).
  - A semantic restriction is added to reject `const _` in associated contexts.

Together, these changes allow us to fuse the grammar of associated items and extern items up to `default`ness which is the main goal of the PR.

-----------------------

We are now very close to fully fusing the entirely of item parsing and their ASTs. To progress further, we must make a decision: should we parse e.g. `default use foo::bar;` and whatnot? Accepting that is likely easiest from a parsing perspective, as it does not require using look-ahead, but it is perhaps not too onerous to only accept it for `fn`s (and all their various qualifiers), `const`s, `static`s, and `type`s.

r? @petrochenkov

4 years agoRollup merge of #69159 - estebank:use-appropriate-lt-name, r=ecstatic-morse
Mazdak Farrokhzad [Tue, 18 Feb 2020 21:16:24 +0000 (22:16 +0100)]
Rollup merge of #69159 - estebank:use-appropriate-lt-name, r=ecstatic-morse

Select an appropriate unused lifetime name in suggestion

Follow up to #69048.

4 years agoRollup merge of #69146 - matthewjasper:literal-qualif, r=eddyb
Mazdak Farrokhzad [Tue, 18 Feb 2020 21:16:23 +0000 (22:16 +0100)]
Rollup merge of #69146 - matthewjasper:literal-qualif, r=eddyb

Always const qualify literals by type

r? @eddyb

4 years agoAuto merge of #69262 - Dylan-DPC:rollup-m6dt9cn, r=Dylan-DPC
bors [Tue, 18 Feb 2020 17:51:29 +0000 (17:51 +0000)]
Auto merge of #69262 - Dylan-DPC:rollup-m6dt9cn, r=Dylan-DPC

Rollup of 5 pull requests

Successful merges:

 - #69181 (Change const eval to just return the value )
 - #69192 (Add more regression tests)
 - #69200 (Fix printing of `Yield` terminator)
 - #69205 (Allow whitespaces in revision flags)
 - #69233 (Clean up E0310 explanation)

Failed merges:

r? @ghost

4 years agoUpdate cargo
Eric Huss [Tue, 18 Feb 2020 17:21:34 +0000 (09:21 -0800)]
Update cargo

4 years agoRollup merge of #69233 - GuillaumeGomez:cleanup-e0310, r=Dylan-DPC
Dylan DPC [Tue, 18 Feb 2020 15:07:29 +0000 (16:07 +0100)]
Rollup merge of #69233 - GuillaumeGomez:cleanup-e0310, r=Dylan-DPC

Clean up E0310 explanation

r? @Dylan-DPC

4 years agoRollup merge of #69205 - JohnTitor:allow-whitespaces, r=Mark-Simulacrum
Dylan DPC [Tue, 18 Feb 2020 15:07:27 +0000 (16:07 +0100)]
Rollup merge of #69205 - JohnTitor:allow-whitespaces, r=Mark-Simulacrum

Allow whitespaces in revision flags

Allow whitespaces in revision flags, like `// [foo]`.

Fixes #69183

4 years agoRollup merge of #69200 - jonas-schievink:yield-print, r=eddyb,Zoxc
Dylan DPC [Tue, 18 Feb 2020 15:07:25 +0000 (16:07 +0100)]
Rollup merge of #69200 - jonas-schievink:yield-print, r=eddyb,Zoxc

Fix printing of `Yield` terminator

Addresses the bug found in https://github.com/rust-lang/rust/issues/69039#issuecomment-586633495

4 years agoRollup merge of #69192 - JohnTitor:add-tests, r=Centril
Dylan DPC [Tue, 18 Feb 2020 15:07:24 +0000 (16:07 +0100)]
Rollup merge of #69192 - JohnTitor:add-tests, r=Centril

Add more regression tests

Closes #39618
Closes #51798
Closes #62894
Closes #63952
Closes #68653

r? @Centril

4 years agoRollup merge of #69181 - skinny121:const-eval-return, r=oli-obk
Dylan DPC [Tue, 18 Feb 2020 15:07:22 +0000 (16:07 +0100)]
Rollup merge of #69181 - skinny121:const-eval-return, r=oli-obk

Change const eval to just return the value

As discussed in https://github.com/rust-lang/rust/pull/68505#discussion_r370956535, the type of consts shouldn't be returned from const eval queries.

r? @eddyb
cc @nikomatsakis

4 years agoAuto merge of #69234 - JohnTitor:clippy-up, r=JohnTitor
bors [Tue, 18 Feb 2020 14:49:28 +0000 (14:49 +0000)]
Auto merge of #69234 - JohnTitor:clippy-up, r=JohnTitor

Update Clippy

Fixes #69221

r? @ghost

4 years agoClean up E0310 explanation
Guillaume Gomez [Mon, 17 Feb 2020 13:16:45 +0000 (14:16 +0100)]
Clean up E0310 explanation

4 years agoAuto merge of #69258 - JohnTitor:rollup-n2hljai, r=JohnTitor
bors [Tue, 18 Feb 2020 11:10:51 +0000 (11:10 +0000)]
Auto merge of #69258 - JohnTitor:rollup-n2hljai, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #67272 (recursion_limit parsing handles overflows)
 - #68597 (Simplify `Skip::nth` and `Skip::last` implementations)
 - #68767 (macOS: avoid calling pthread_self() twice)
 - #69175 (Do not ICE when encountering `yield` inside `async` block)
 - #69223 (Ignore GDB versions with broken str printing.)
 - #69244 (configure: set LLVM flags with a value)
 - #69249 (Stabilize {f32, f64}::{LOG2_10, LOG10_2})
 - #69252 (Clean out unused directories for extra disk space)

Failed merges:

r? @ghost

4 years agoRollup merge of #69252 - Mark-Simulacrum:disk-try, r=pietroalbini
Yuki Okushi [Tue, 18 Feb 2020 11:09:11 +0000 (20:09 +0900)]
Rollup merge of #69252 - Mark-Simulacrum:disk-try, r=pietroalbini

Clean out unused directories for extra disk space

This cleans out some of the unused (but large) directories on our linux builders to hopefully allow them to complete without running out of disk space.