]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoImplement Error::source on IntoStringError
Linus Färnstrand [Sun, 13 Oct 2019 09:43:26 +0000 (11:43 +0200)]
Implement Error::source on IntoStringError

IntoStringError only implemented Error::cause, which is
deprecated. This implemements Error::source instead.
Error::cause will still work as before, thanks to the default
implementation.

4 years agoAuto merge of #65099 - pnkfelix:issue-63154-needed-more-normalize, r=nagisa
bors [Sun, 13 Oct 2019 03:37:25 +0000 (03:37 +0000)]
Auto merge of #65099 - pnkfelix:issue-63154-needed-more-normalize, r=nagisa

MIR typeck needed more normalize

Add some missing normalization calls (@nagisa [was right](https://github.com/rust-lang/rust/issues/63154#issuecomment-517305589)).

Fix #63154

4 years agoAuto merge of #64873 - popzxc:prettify-test-time, r=wesleywiser
bors [Sat, 12 Oct 2019 23:47:27 +0000 (23:47 +0000)]
Auto merge of #64873 - popzxc:prettify-test-time, r=wesleywiser

Enhance report-time option

## Short overview

This PR is a follow-up to a previously closed #64714 PR.

## Changes introduced by this PR

* `libtest` now retrieves the type of the test within `TestDesc` (available types are: `UnitTest`, `IntegrationTest`, `DocTest`, `Unknown`).
* `--report-time` subcommand of the `libtest` now supports colored output (disabled by default).
* Colorized output depends on the threshold values. Default values (proposed by @wesleywiser):
  - For unit-tests: 50ms warn/100ms critical,
  - For integration-tests: 500ms warn/1000ms critical,
  - For doctests: same as for integration tests,
  - For unknown tests: `TEST_WARN_TIMEOUT_S` warn/ `TEST_WARN_TIMEOUT_S * 2` critical (it will only applied single-threaded mode, because otherwise test will be interrupted after reaching `TEST_WARN_TIMEOUT_S`).
  - These values can be overrided by setting environment variables (since those thresholds are somewhat constant for every project, it's more flexible to use environment variables than command line arguments).
* New optional flag `--ensure-test-time` for `libtest`. With this flag applied, exectuion time limit excesss will cause test failure.

## What have not been done

There was a comment that it would be nice to have an entry in the Cargo book about it.

However, changes introduced by this PR (and #64663 in which `report-time` flag was added) aren't related directly to `cargo`, it's more about `libtest` itself.
I'm considering that [The Unstable Book](https://doc.rust-lang.org/unstable-book/) is more appropriate place, but not sure if I'm right (and if so, how exactly it should be described).

As one possible option, this PR may be merged without denoting it in the documentation, and in the next PR adding support of this feature to the `cargo` itself, I'll add a note in the Cargo book.

## Scope of this PR

Logical scope of this PR is `libtest` only. However, to get test types, I had to modify also `libsyntax_ext` and `librustdoc` for them to provide information about test type.

## Rationale

Rationale for colored output was submitted in #64714

Providing the information about kind of test was also proposed in #64714, and as an additional benefit this information may be useful for the tools using `libtest` (e.g. `cargo`).

Adding flag to treat time limits excess seems logical to me, so projects that do care about test execution time won't have to invent a wheel.

## Backward compatibility

All the changes are completely backward compatible.

## Demo

![rustc_enhanced_time](https://user-images.githubusercontent.com/12111581/65818381-c04f6800-e219-11e9-9875-322463abe24f.gif)

r? @wesleywiser

4 years agoAuto merge of #65328 - lzutao:bump-rls-rustfmt, r=Xanewok
bors [Sat, 12 Oct 2019 18:23:13 +0000 (18:23 +0000)]
Auto merge of #65328 - lzutao:bump-rls-rustfmt, r=Xanewok

Update rls and rustfmt

cc @Xanewok

Fixes #65084
Fixes #65085
Suppressed  #65311

4 years agoAuto merge of #65190 - GuillaumeGomez:dont-pass-doctest-feature-by-default, r=Mark...
bors [Sat, 12 Oct 2019 11:39:20 +0000 (11:39 +0000)]
Auto merge of #65190 - GuillaumeGomez:dont-pass-doctest-feature-by-default, r=Mark-Simulacrum

Don't pass doctest feature by default

As asked in https://github.com/rust-lang/rust/pull/63803#issuecomment-539064434.

r? @QuietMisdreavus

4 years agoBump home crate
Lzu Tao [Sat, 12 Oct 2019 08:29:27 +0000 (08:29 +0000)]
Bump home crate

4 years agoUpdate RLS and Rustfmt
Igor Matuszewski [Fri, 11 Oct 2019 14:28:02 +0000 (16:28 +0200)]
Update RLS and Rustfmt

This also bumps rustc-ap-* crates and fixes the relevant toolstate.

4 years agoAuto merge of #65322 - tmandry:rollup-frr651r, r=tmandry
bors [Sat, 12 Oct 2019 06:25:03 +0000 (06:25 +0000)]
Auto merge of #65322 - tmandry:rollup-frr651r, r=tmandry

Rollup of 15 pull requests

Successful merges:

 - #64337 (libstd: Fix typos in doc)
 - #64986 (Function pointers as const generic arguments)
 - #65048 (Added doc about behavior of extend on HashMap)
 - #65191 (Add some regression tests)
 - #65200 (Add ?Sized bound to a supertrait listing in E0038 error documentation)
 - #65205 (Add long error explanation for E0568)
 - #65220 (Update LLVM for Emscripten exception handling support)
 - #65263 (Deduplicate is_{freeze,copy,sized}_raw)
 - #65266 (Mark Path::join as must_use)
 - #65276 (Don't cc rust-lang/compiler for toolstate changes)
 - #65277 (Query generator kind for error reporting)
 - #65283 (stability: Do not use `buffer_lint` after lowering to HIR)
 - #65289 (Fix suggested bound addition diagnostic)
 - #65310 (deriving: avoid dummy Span on an artificial `type_ident` path)
 - #65321 (Remove painful test that is not pulling its weight)

Failed merges:

r? @ghost

4 years agoAuto merge of #65020 - pnkfelix:targetted-fix-for-always-marking-rust-abi-unwind...
bors [Sat, 12 Oct 2019 02:31:03 +0000 (02:31 +0000)]
Auto merge of #65020 - pnkfelix:targetted-fix-for-always-marking-rust-abi-unwind-issue-64655, r=alexcrichton

Always mark rust and rust-call abi's as unwind

PR #63909 identified a bug that had been injected by PR #55982. As discussed on https://github.com/rust-lang/rust/issues/64655#issuecomment-537517428 , we started marking extern items as nounwind, *even* extern items that said they were using "Rust" or "rust-call" ABI.

This is a more targeted variant of PR #63909 that fixes the above bug.

Fix #64655

----

I personally suspect we will want PR #63909 to land in the long-term

But:
 *  it is not certain that PR #63909 *will* land,
 * more importantly, PR #63909 almost certainly will not be backported to beta/stable.

The identified bug was more severe than I think anyone realized (apart from perhaps @gnzlbg, as noted [here](https://github.com/rust-lang/rust/pull/63909#issuecomment-524818838)).

Thus, I was motivated to write this PR, which fixes *just* the issue with extern rust/rust-call functions, and deliberately avoids injecting further deviation from current behavior (you can see further notes on this in the comments of the code added here).

4 years agoRollup merge of #65321 - Mark-Simulacrum:remove-linker-no-utf8-test, r=nikomatsakis
Tyler Mandry [Fri, 11 Oct 2019 22:10:01 +0000 (15:10 -0700)]
Rollup merge of #65321 - Mark-Simulacrum:remove-linker-no-utf8-test, r=nikomatsakis

Remove painful test that is not pulling its weight

Research suggests that we are not properly testing this case anyway, and
even if we were, it is unlikely that we will regress here -- or, perhaps
more accurately, if we do, I am uncertain that we care too much. It
definitely seems like an edge case, and one that is particularly
unlikely to occur as time goes on.

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

4 years agoRollup merge of #65310 - da-x:issue-56195, r=petrochenkov
Tyler Mandry [Fri, 11 Oct 2019 22:10:00 +0000 (15:10 -0700)]
Rollup merge of #65310 - da-x:issue-56195, r=petrochenkov

deriving: avoid dummy Span on an artificial `type_ident` path

The dummy Span pointed to the beginning of the source file instead to where the `#[derive]` is located. Later, it tripped the `in_derive_expansion(span)` check at `src/librustc/middle/stability.rs`, causing a span-less deprecation warning to be emitted.

Fixes #56195, Fixes #55417.

4 years agoRollup merge of #65289 - varkor:issue-65284, r=estebank
Tyler Mandry [Fri, 11 Oct 2019 22:09:58 +0000 (15:09 -0700)]
Rollup merge of #65289 - varkor:issue-65284, r=estebank

Fix suggested bound addition diagnostic

Fixes #65284.

4 years agoRollup merge of #65283 - petrochenkov:softstab2, r=estebank
Tyler Mandry [Fri, 11 Oct 2019 22:09:57 +0000 (15:09 -0700)]
Rollup merge of #65283 - petrochenkov:softstab2, r=estebank

stability: Do not use `buffer_lint` after lowering to HIR

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

4 years agoRollup merge of #65277 - csmoe:fix-move, r=estebank
Tyler Mandry [Fri, 11 Oct 2019 22:09:56 +0000 (15:09 -0700)]
Rollup merge of #65277 - csmoe:fix-move, r=estebank

Query generator kind for error reporting

Fixes https://github.com/rust-lang/rust/pull/65166#discussion_r333114545
r? @estebank
cc @cramertj

4 years agoRollup merge of #65276 - varkor:toolstate-no-ping, r=Mark-Simulacrum
Tyler Mandry [Fri, 11 Oct 2019 22:09:54 +0000 (15:09 -0700)]
Rollup merge of #65276 - varkor:toolstate-no-ping, r=Mark-Simulacrum

Don't cc rust-lang/compiler for toolstate changes

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

4 years agoRollup merge of #65266 - rust-lang:must-use-join, r=dtolnay
Tyler Mandry [Fri, 11 Oct 2019 22:09:53 +0000 (15:09 -0700)]
Rollup merge of #65266 - rust-lang:must-use-join, r=dtolnay

Mark Path::join as must_use

I've accidentally did `mut_path_buf.jon(a_path);`, expecting this to be an in-place modification. Seems like we can easily warn in such cases?

4 years agoRollup merge of #65263 - mbStavola:dedup-raw-item-fns, r=Centril
Tyler Mandry [Fri, 11 Oct 2019 22:09:51 +0000 (15:09 -0700)]
Rollup merge of #65263 - mbStavola:dedup-raw-item-fns, r=Centril

Deduplicate is_{freeze,copy,sized}_raw

Fixes #65259

Deduplicates `is_{freeze,copy,sized}_raw` by delegating to a new method which takes in a `LangItem`.

4 years agoRollup merge of #65220 - tlively:update-llvm-for-emscripten-exceptions, r=nikic
Tyler Mandry [Fri, 11 Oct 2019 22:09:50 +0000 (15:09 -0700)]
Rollup merge of #65220 - tlively:update-llvm-for-emscripten-exceptions, r=nikic

Update LLVM for Emscripten exception handling support

Updates LLVM to pick up the cherry-picked support for correctly
handling exception handling with aggregates passed by value. This will
be necessary to continue to support Emscripten's exception handling
once we switch using Emscripten's LLVM backend. See #63649.

4 years agoRollup merge of #65205 - GuillaumeGomez:long-err-explanation-E0568, r=estebank
Tyler Mandry [Fri, 11 Oct 2019 22:09:48 +0000 (15:09 -0700)]
Rollup merge of #65205 - GuillaumeGomez:long-err-explanation-E0568, r=estebank

Add long error explanation for E0568

Part of #61137.

4 years agoRollup merge of #65200 - xfix:patch-20, r=GuillaumeGomez
Tyler Mandry [Fri, 11 Oct 2019 22:09:47 +0000 (15:09 -0700)]
Rollup merge of #65200 - xfix:patch-20, r=GuillaumeGomez

Add ?Sized bound to a supertrait listing in E0038 error documentation

This example failed to compile because of implicit `Sized` bound for `A` parameter that wasn't required by `Trait`.

4 years agoRollup merge of #65191 - varkor:const-generics-test-cases, r=nikomatsakis
Tyler Mandry [Fri, 11 Oct 2019 22:09:45 +0000 (15:09 -0700)]
Rollup merge of #65191 - varkor:const-generics-test-cases, r=nikomatsakis

Add some regression tests

- Add a test for #62187.
- Clean up the directory structure in `src/test/ui/const-generics`
- Closes #64792.
- Closes #57399.
- Closes #57271.

4 years agoRollup merge of #65048 - Kixunil:patch-1, r=KodrAus
Tyler Mandry [Fri, 11 Oct 2019 22:09:44 +0000 (15:09 -0700)]
Rollup merge of #65048 - Kixunil:patch-1, r=KodrAus

Added doc about behavior of extend on HashMap

It was unclear what the implementation does when it encounters existing keys. This change makes it clear by documenting the trait impl.

4 years agoRollup merge of #64986 - skinny121:fn-ptr-const-generics, r=varkor
Tyler Mandry [Fri, 11 Oct 2019 22:09:42 +0000 (15:09 -0700)]
Rollup merge of #64986 - skinny121:fn-ptr-const-generics, r=varkor

Function pointers as const generic arguments

Makes function pointers as const generic arguments usable.

Fixes #62395

r? @varkor

4 years agoRollup merge of #64337 - rick68:patch-17, r=Dylan-DPC
Tyler Mandry [Fri, 11 Oct 2019 22:09:41 +0000 (15:09 -0700)]
Rollup merge of #64337 - rick68:patch-17, r=Dylan-DPC

libstd: Fix typos in doc

4 years agoRemove painful test that is not pulling its weight
Mark Rousskov [Fri, 11 Oct 2019 21:41:55 +0000 (17:41 -0400)]
Remove painful test that is not pulling its weight

Research suggests that we are not properly testing this case anyway, and
even if we were, it is unlikely that we will regress here -- or, perhaps
more accurately, if we do, I am uncertain that we care too much. It
definitely seems like an edge case, and one that is particularly
unlikely to occur as time goes on.

4 years agoAuto merge of #64877 - lzutao:stabilize-repeat_generic_slice, r=SimonSapin
bors [Fri, 11 Oct 2019 18:03:20 +0000 (18:03 +0000)]
Auto merge of #64877 - lzutao:stabilize-repeat_generic_slice, r=SimonSapin

Stabilize `slice::repeat` (feature `repeat_generic_slice`)

Closes #48784
r? @SimonSapin

4 years agotest: extend derive_on_deprecated to include more derivations
Dan Aloni [Fri, 11 Oct 2019 13:20:04 +0000 (16:20 +0300)]
test: extend derive_on_deprecated to include more derivations

4 years agoderiving: avoid dummy Span on an artificial `type_ident` path
Dan Aloni [Fri, 11 Oct 2019 12:14:23 +0000 (15:14 +0300)]
deriving: avoid dummy Span on an artificial `type_ident` path

The dummy Span pointed to the beginning of the source file instead to
where the `#[derive]` is located. Later, it tripped the
`in_derive_expansion(span)` check at `src/librustc/middle/stability.rs`,
causing a span-less deprecation warning to be emitted.

Fixes #56195, #55417.

4 years agoemcscripten: ignore another thread-using test
Ralf Jung [Fri, 11 Oct 2019 12:58:05 +0000 (14:58 +0200)]
emcscripten: ignore another thread-using test

4 years agoAuto merge of #64716 - jonhoo:stabilize-mem-take, r=SimonSapin
bors [Fri, 11 Oct 2019 12:45:20 +0000 (12:45 +0000)]
Auto merge of #64716 - jonhoo:stabilize-mem-take, r=SimonSapin

Stabilize mem::take (mem_take)

Tracking issue: https://github.com/rust-lang/rust/issues/61129

r? @matklad

4 years agoignore-emcscripten as it does not support threads
Ralf Jung [Fri, 11 Oct 2019 07:57:44 +0000 (09:57 +0200)]
ignore-emcscripten as it does not support threads

4 years agoFix issue 65284
varkor [Thu, 10 Oct 2019 23:51:36 +0000 (00:51 +0100)]
Fix issue 65284

4 years agoAuto merge of #64823 - cuviper:min-std, r=Mark-Simulacrum
bors [Thu, 10 Oct 2019 23:43:55 +0000 (23:43 +0000)]
Auto merge of #64823 - cuviper:min-std, r=Mark-Simulacrum

minimize the rust-std component

This changes the `rust-std` dist component to only include the artifacts of compiling the `libstd` step, as listed in `.libstd.stamp`. This does include `test` and `proc-macro` as well. The remaining _unstable_ libraries that are built as part of `rustc` are packaged into a new `rustc-dev` component, intended for use in the development of closely related tools (clippy, miri, rls).

Here are the component sizes from the [try build](https://dev-static.rust-lang.org/dist/2019-10-07/index.html):

| Name | Size
| --- | ---
| rust-std-nightly-x86_64-unknown-linux-gnu.tar.gz | 23.94 MiB
| rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz | 17.4 MiB
| rustc-dev-nightly-x86_64-unknown-linux-gnu.tar.gz | 182.03 MiB
| rustc-dev-nightly-x86_64-unknown-linux-gnu.tar.xz | 157.91 MiB

Fixes #61978
Fixes #62486

4 years agostability: Do not use `buffer_lint` after lowering to HIR
Vadim Petrochenkov [Thu, 10 Oct 2019 20:37:41 +0000 (23:37 +0300)]
stability: Do not use `buffer_lint` after lowering to HIR

4 years agoAuto merge of #65153 - da-x:issue-58017, r=petrochenkov
bors [Thu, 10 Oct 2019 19:40:48 +0000 (19:40 +0000)]
Auto merge of #65153 - da-x:issue-58017, r=petrochenkov

Improve message when attempting to instantiate tuple structs with private fields

Fixes #58017, fixes #39703.

```
error[E0603]: tuple struct `Error` is private
  --> main.rs:22:16
   |
2  |     pub struct Error(usize, pub usize, usize);
   |                      -----             ----- field is private
   |                      |
   |                      field is private
...
22 |     let x = a::Error(3, 1, 2);
   |                ^^^^^
   |
   = note: a tuple struct constructor is private if any of its fields is private
```

4 years agoquery generator kind for error reporting
csmoe [Thu, 10 Oct 2019 14:20:57 +0000 (22:20 +0800)]
query generator kind for error reporting

4 years agoDon't cc rust-lang/compiler for toolstate changes
varkor [Thu, 10 Oct 2019 16:23:28 +0000 (17:23 +0100)]
Don't cc rust-lang/compiler for toolstate changes

4 years agoAuto merge of #59546 - sfanxiang:interminable-ub, r=nagisa
bors [Thu, 10 Oct 2019 15:40:39 +0000 (15:40 +0000)]
Auto merge of #59546 - sfanxiang:interminable-ub, r=nagisa

Add llvm.sideeffect to potential infinite loops and recursions

LLVM assumes that a thread will eventually cause side effect. This is
not true in Rust if a loop or recursion does nothing in its body,
causing undefined behavior even in common cases like `loop {}`.
Inserting llvm.sideeffect fixes the undefined behavior.

As a micro-optimization, only insert llvm.sideeffect when jumping back
in blocks or calling a function.

A patch for LLVM is expected to allow empty non-terminate code by
default and fix this issue from LLVM side.

https://github.com/rust-lang/rust/issues/28728

**UPDATE:** [Mentoring instructions here](https://github.com/rust-lang/rust/pull/59546#issuecomment-515072429) to unstall this PR

4 years agoUpdate ui tests
Guillaume Gomez [Tue, 8 Oct 2019 11:51:58 +0000 (13:51 +0200)]
Update ui tests

4 years agoAdd long error explanation for E0568
Guillaume Gomez [Tue, 8 Oct 2019 11:51:44 +0000 (13:51 +0200)]
Add long error explanation for E0568

4 years agoAuto merge of #65140 - petrochenkov:disapp, r=nikomatsakis
bors [Thu, 10 Oct 2019 12:02:47 +0000 (12:02 +0000)]
Auto merge of #65140 - petrochenkov:disapp, r=nikomatsakis

resolve: Remove an incorrect assert

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

4 years agoMark Path::join as must_use
Aleksey Kladov [Thu, 10 Oct 2019 09:42:04 +0000 (12:42 +0300)]
Mark Path::join as must_use

I've accidentally did `mut_path_buf.jon(a_path);`, expecting this to be an in-place modification. Seems like we can easily warn in such cases?

4 years agoAdd and update rustdoc ui test
Guillaume Gomez [Tue, 8 Oct 2019 08:26:31 +0000 (10:26 +0200)]
Add and update rustdoc ui test

4 years agoDon't pass doctest feature by default
Guillaume Gomez [Mon, 7 Oct 2019 21:08:54 +0000 (23:08 +0200)]
Don't pass doctest feature by default

4 years agoPreserve output of raw pointers in mir dump.
ben [Thu, 10 Oct 2019 09:01:55 +0000 (22:01 +1300)]
Preserve output of raw pointers in mir dump.

4 years agoAuto merge of #65129 - andjo403:cargo_args, r=alexcrichton
bors [Thu, 10 Oct 2019 08:10:49 +0000 (08:10 +0000)]
Auto merge of #65129 - andjo403:cargo_args, r=alexcrichton

make it possible to add args to cargo in x.py

eg. make it easier to test -Ztimings for rustc

cc https://github.com/rust-lang/rust/issues/65088

4 years agoQualify LangItem
Matt Stavola [Thu, 10 Oct 2019 06:10:35 +0000 (23:10 -0700)]
Qualify LangItem

4 years agoDelegate is_{freeze,copy,sized}_raw to is_item_raw
Matt Stavola [Thu, 10 Oct 2019 05:37:05 +0000 (22:37 -0700)]
Delegate is_{freeze,copy,sized}_raw to is_item_raw

4 years agoAuto merge of #65077 - estebank:mut-trait-expected, r=nikomatsakis
bors [Thu, 10 Oct 2019 04:07:02 +0000 (04:07 +0000)]
Auto merge of #65077 - estebank:mut-trait-expected, r=nikomatsakis

Note when a mutable trait object is needed

Fix https://github.com/rust-lang/rust/issues/63619, fix https://github.com/rust-lang/rust/issues/37914. CC https://github.com/rust-lang/rust/issues/64068.

4 years agoAuto merge of #64939 - nnethercote:snapshot-cleanups, r=nikomatsakis
bors [Thu, 10 Oct 2019 00:19:29 +0000 (00:19 +0000)]
Auto merge of #64939 - nnethercote:snapshot-cleanups, r=nikomatsakis

Snapshot clean-ups

Two minor clean-ups involving snapshots.

4 years agoAuto merge of #65249 - matthewjasper:revert-into-drop, r=nnethercote
bors [Wed, 9 Oct 2019 20:29:05 +0000 (20:29 +0000)]
Auto merge of #65249 - matthewjasper:revert-into-drop, r=nnethercote

Revert "Make `into` schedule drop for the destination"

This was a *very* large perf regression in some cases. I'll undo the revert once I have time to avoid the regression.

4 years agoRevert "Make `into` schedule drop for the destination"
Matthew Jasper [Wed, 9 Oct 2019 19:06:15 +0000 (20:06 +0100)]
Revert "Make `into` schedule drop for the destination"

This reverts commit 37026837a3f23486d3cf1009d9136927168ddb33.

4 years agoPretty print raw pointers in consts as '{pointer}'.
ben [Wed, 9 Oct 2019 19:11:31 +0000 (08:11 +1300)]
Pretty print raw pointers in consts as '{pointer}'.

4 years agoOnly suggest change mut if vars are resolved
Esteban Küber [Wed, 9 Oct 2019 18:42:29 +0000 (11:42 -0700)]
Only suggest change mut if vars are resolved

4 years agoreview comments
Esteban Küber [Mon, 7 Oct 2019 01:38:15 +0000 (18:38 -0700)]
review comments

4 years agoreview comments
Esteban Küber [Sat, 5 Oct 2019 18:37:21 +0000 (11:37 -0700)]
review comments

4 years agoObligation must apply modulo regions
Esteban Küber [Sat, 5 Oct 2019 17:41:24 +0000 (10:41 -0700)]
Obligation must apply modulo regions

4 years agoTweak wording
Esteban Küber [Fri, 4 Oct 2019 00:39:58 +0000 (17:39 -0700)]
Tweak wording

4 years agoNote when a mutable trait object is needed
Esteban Küber [Fri, 4 Oct 2019 00:10:37 +0000 (17:10 -0700)]
Note when a mutable trait object is needed

4 years agoAuto merge of #65228 - Wind-River:real_master, r=dtolnay
bors [Wed, 9 Oct 2019 16:31:49 +0000 (16:31 +0000)]
Auto merge of #65228 - Wind-River:real_master, r=dtolnay

vxworks: add checking (r == 0)

4 years agomake it possible to add args to cargo in x.py
Andreas Jonson [Wed, 9 Oct 2019 15:45:19 +0000 (17:45 +0200)]
make it possible to add args to cargo in x.py

eg. make it easier to test -Ztimings for rustc

4 years agoresolve: Use field spans for reporting the private constructor error
Vadim Petrochenkov [Wed, 9 Oct 2019 14:37:48 +0000 (17:37 +0300)]
resolve: Use field spans for reporting the private constructor error

4 years agoresolve: Keep field spans for diagnostics
Vadim Petrochenkov [Wed, 9 Oct 2019 14:37:28 +0000 (17:37 +0300)]
resolve: Keep field spans for diagnostics

4 years agoMove unstable book entry into compiler flags directory
Igor Aleksanov [Wed, 9 Oct 2019 14:43:27 +0000 (17:43 +0300)]
Move unstable book entry into compiler flags directory

4 years agoAuto merge of #65208 - michaelwoerister:sp-events-review-2, r=wesleywiser
bors [Wed, 9 Oct 2019 12:51:07 +0000 (12:51 +0000)]
Auto merge of #65208 - michaelwoerister:sp-events-review-2, r=wesleywiser

self-profiling: Add events for everything except trait selection.

This is the followup PR to https://github.com/rust-lang/rust/pull/64840.

Trait selection events are still missing (at least those not covered by regular queries).

r? @wesleywiser (or @Mark-Simulacrum if @wesleywiser is not available at the moment)

4 years agoself-profiling: Add events for everything except trait selection.
Michael Woerister [Tue, 8 Oct 2019 12:05:41 +0000 (14:05 +0200)]
self-profiling: Add events for everything except trait selection.

4 years agoAdd failing example for Self in supertrait listing in E0038 documentation
Konrad Borowski [Wed, 9 Oct 2019 10:33:24 +0000 (12:33 +0200)]
Add failing example for Self in supertrait listing in E0038 documentation

4 years agoAuto merge of #65198 - nnethercote:fix-65080, r=Mark-Simulacrum
bors [Wed, 9 Oct 2019 08:57:26 +0000 (08:57 +0000)]
Auto merge of #65198 - nnethercote:fix-65080, r=Mark-Simulacrum

Speed up `TokenStream` concatenation

This PR fixes the quadratic behaviour identified in #65080.

r? @Mark-Simulacrum

4 years agoFollow the styling guide
Igor Aleksanov [Wed, 9 Oct 2019 07:29:20 +0000 (10:29 +0300)]
Follow the styling guide

4 years agoAdd an entry to the unstable book
Igor Aleksanov [Wed, 9 Oct 2019 07:03:27 +0000 (10:03 +0300)]
Add an entry to the unstable book

4 years agoMake interface of the feature more convenient
Igor Aleksanov [Wed, 9 Oct 2019 07:03:08 +0000 (10:03 +0300)]
Make interface of the feature more convenient

4 years agoResolve divergency with master
Igor Aleksanov [Wed, 9 Oct 2019 06:52:08 +0000 (09:52 +0300)]
Resolve divergency with master

4 years agoAuto merge of #65229 - Centril:rollup-wnr46vg, r=Centril
bors [Wed, 9 Oct 2019 03:32:21 +0000 (03:32 +0000)]
Auto merge of #65229 - Centril:rollup-wnr46vg, r=Centril

Rollup of 4 pull requests

Successful merges:

 - #64656 (Implement (HashMap) Entry::insert as per #60142)
 - #65037 (`#[track_caller]` feature gate (RFC 2091 1/N))
 - #65166 (Suggest to add `move` keyword for generator capture)
 - #65175 (add more info in debug traces for gcu merging)

Failed merges:

r? @ghost

4 years agoRollup merge of #65175 - andjo403:partitioning, r=zackmdavis
Mazdak Farrokhzad [Wed, 9 Oct 2019 03:31:38 +0000 (05:31 +0200)]
Rollup merge of #65175 - andjo403:partitioning, r=zackmdavis

add more info in debug traces for gcu merging

to help in investigation of CGU partitioning problems e.g https://github.com/rust-lang/rust/issues/64913

4 years agoRollup merge of #65166 - csmoe:async-move, r=estebank
Mazdak Farrokhzad [Wed, 9 Oct 2019 03:31:36 +0000 (05:31 +0200)]
Rollup merge of #65166 - csmoe:async-move, r=estebank

Suggest to add `move` keyword for generator capture

 Closes #64382
r? @estebank

4 years agoRollup merge of #65037 - anp:track-caller, r=oli-obk
Mazdak Farrokhzad [Wed, 9 Oct 2019 03:31:35 +0000 (05:31 +0200)]
Rollup merge of #65037 - anp:track-caller, r=oli-obk

`#[track_caller]` feature gate (RFC 2091 1/N)

RFC text: https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md
Tracking issue: https://github.com/rust-lang/rust/issues/47809

I started with @ayosec's commit to add the feature gate with tests and rebased it onto current master. I fixed up some tidy lints and added a test.

4 years agoRollup merge of #64656 - passcod:map-entry-insert, r=Amanieu
Mazdak Farrokhzad [Wed, 9 Oct 2019 03:31:33 +0000 (05:31 +0200)]
Rollup merge of #64656 - passcod:map-entry-insert, r=Amanieu

Implement (HashMap) Entry::insert as per #60142

Implementation of `Entry::insert` as per @SimonSapin's comment on #60142. This requires a patch to hashbrown:

```diff
diff --git a/src/rustc_entry.rs b/src/rustc_entry.rs
index fefa5c3..7de8300 100644
--- a/src/rustc_entry.rs
+++ b/src/rustc_entry.rs
@@ -546,6 +546,32 @@ impl<'a, K, V> RustcVacantEntry<'a, K, V> {
         let bucket = self.table.insert_no_grow(self.hash, (self.key, value));
         unsafe { &mut bucket.as_mut().1 }
     }
+
+    /// Sets the value of the entry with the RustcVacantEntry's key,
+    /// and returns a RustcOccupiedEntry.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use hashbrown::HashMap;
+    /// use hashbrown::hash_map::RustcEntry;
+    ///
+    /// let mut map: HashMap<&str, u32> = HashMap::new();
+    ///
+    /// if let RustcEntry::Vacant(v) = map.rustc_entry("poneyland") {
+    ///     let o = v.insert_and_return(37);
+    ///     assert_eq!(o.get(), &37);
+    /// }
+    /// ```
+     #[inline]
+    pub fn insert_and_return(self, value: V) -> RustcOccupiedEntry<'a, K, V> {
+        let bucket = self.table.insert_no_grow(self.hash, (self.key, value));
+        RustcOccupiedEntry {
+            key: None,
+            elem: bucket,
+            table: self.table
+        }
+    }
 }

 impl<K, V> IterMut<'_, K, V> {
```

This is also only an implementation for HashMap. I tried implementing for BTreeMap, but I don't really understand BTreeMap's internals and require more guidance on implementing the equivalent `VacantEntry::insert_and_return` such that it returns an `OccupiedEntry`. Notably, following the original PR's modifications I end up needing a `Handle<NodeRef<marker::Mut<'_>, _, _, marker::LeafOrInternal>, _>` while I only have a `Handle<NodeRef<marker::Mut<'_>, _, _, marker::Internal>, _>` and don't know how to proceed.

(To be clear, I'm not asking for guidance right now; I'd be happy getting only the HashMap implementation — the subject of this PR — reviewed and ready, and leave the BTreeMap implementation for a latter PR.)

4 years agoadd checking (r == 0)
Baoshan Pang [Mon, 7 Oct 2019 16:59:08 +0000 (09:59 -0700)]
add checking (r == 0)

4 years agoChange incorrect trait name in E0038 error documentation
Konrad Borowski [Tue, 8 Oct 2019 23:03:56 +0000 (01:03 +0200)]
Change incorrect trait name in E0038 error documentation

4 years agoStabilize mem::take (mem_take)
Jon Gjengset [Mon, 23 Sep 2019 17:54:37 +0000 (13:54 -0400)]
Stabilize mem::take (mem_take)

Tracking issue: https://github.com/rust-lang/rust/issues/61129

4 years agoImplement (HashMap) Entry::insert as per #60142
Félix Saparelli [Sat, 21 Sep 2019 10:56:05 +0000 (22:56 +1200)]
Implement (HashMap) Entry::insert as per #60142

4 years agoAuto merge of #65223 - Centril:rollup-5sdvdni, r=Centril
bors [Tue, 8 Oct 2019 21:32:07 +0000 (21:32 +0000)]
Auto merge of #65223 - Centril:rollup-5sdvdni, r=Centril

Rollup of 7 pull requests

Successful merges:

 - #64284 (Warn if include macro fails to include entire file)
 - #65081 (Remove -Zprofile-queries)
 - #65133 (typeck: prohibit foreign statics w/ generics)
 - #65135 (Add check for missing tests for error codes)
 - #65141 (Replace code of conduct with link)
 - #65194 (Use structured suggestion for removal of `as_str()` call)
 - #65213 (Ignore `ExprKind::DropTemps` for some ref suggestions)

Failed merges:

r? @ghost

4 years agoRollup merge of #65213 - estebank:peel-drop-temps, r=Centril
Mazdak Farrokhzad [Tue, 8 Oct 2019 21:31:28 +0000 (23:31 +0200)]
Rollup merge of #65213 - estebank:peel-drop-temps, r=Centril

Ignore `ExprKind::DropTemps` for some ref suggestions

Introduce `Expr::peel_drop_temps()` to ignore `ExprKind::DropTemps` for suggestions that depend on the `ExprKind` for accuracy.

4 years agoRollup merge of #65194 - estebank:remove_str, r=petrochenkov
Mazdak Farrokhzad [Tue, 8 Oct 2019 21:31:27 +0000 (23:31 +0200)]
Rollup merge of #65194 - estebank:remove_str, r=petrochenkov

Use structured suggestion for removal of `as_str()` call

Follow up to #64739.

4 years agoRollup merge of #65141 - BO41:code-of-conduct, r=Mark-Simulacrum
Mazdak Farrokhzad [Tue, 8 Oct 2019 21:31:25 +0000 (23:31 +0200)]
Rollup merge of #65141 - BO41:code-of-conduct, r=Mark-Simulacrum

Replace code of conduct with link

This will replace the code of conduct and link to a single version at https://www.rust-lang.org/conduct.html
Fixes https://github.com/rust-lang/rust/pull/61531#issuecomment-501473787

r? @Mark-Simulacrum

4 years agoRollup merge of #65135 - GuillaumeGomez:add-error-code-check, r=Mark-Simulacrum
Mazdak Farrokhzad [Tue, 8 Oct 2019 21:31:24 +0000 (23:31 +0200)]
Rollup merge of #65135 - GuillaumeGomez:add-error-code-check, r=Mark-Simulacrum

Add check for missing tests for error codes

Fixes #64811.

r? @Mark-Simulacrum

4 years agoRollup merge of #65133 - davidtwco:issue-65035-static-with-generic-in-foreign-mod...
Mazdak Farrokhzad [Tue, 8 Oct 2019 21:31:22 +0000 (23:31 +0200)]
Rollup merge of #65133 - davidtwco:issue-65035-static-with-generic-in-foreign-mod, r=petrochenkov

typeck: prohibit foreign statics w/ generics

Fixes #65035 and fixes #65025.

This PR modifies resolve to disallow foreign statics that have
generics.

`improper_ctypes` is not written to support type parameters, as these
are normally disallowed before the lint is run. Thus, type parameters in
foreign statics must be prohibited before the lint.

The only other case where this *could* have occured is in functions,
but typeck prohibits this with a "foreign items may not have type
parameters" error - a similar error did not exist for statics, because
statics cannot have type parameters, but they can use any
type parameters that are in scope (which isn't the case for functions).

4 years agoRollup merge of #65081 - Mark-Simulacrum:remove-profile-queries, r=michaelwoerister
Mazdak Farrokhzad [Tue, 8 Oct 2019 21:31:20 +0000 (23:31 +0200)]
Rollup merge of #65081 - Mark-Simulacrum:remove-profile-queries, r=michaelwoerister

Remove -Zprofile-queries

r? @michaelwoerister

Per [zulip thread](https://zulip-archive.rust-lang.org/131828tcompiler/57361RemoveZprofilequeries.html).

4 years agoRollup merge of #64284 - Mark-Simulacrum:include-warn, r=petrochenkov
Mazdak Farrokhzad [Tue, 8 Oct 2019 21:31:19 +0000 (23:31 +0200)]
Rollup merge of #64284 - Mark-Simulacrum:include-warn, r=petrochenkov

Warn if include macro fails to include entire file

This currently introduces an error, mainly because that was just simpler, and I'm not entirely certain if we can introduce a lint without an RFC and such.

This is primarily to get feedback on the approach and overall aim -- in particular, do we think this is helpful? If so, we probably will need lang-team sign off and decide if it should be an error (as currently introduced by this PR), a lint, or a warning.

r? @petrochenkov

cc https://github.com/rust-lang/rust/issues/35560

4 years agoUpdate LLVM for Emscripten exception handling support
Thomas Lively [Tue, 8 Oct 2019 20:07:27 +0000 (13:07 -0700)]
Update LLVM for Emscripten exception handling support

Updates LLVM to pick up the cherry-picked support for correctly
handling exception handling with aggregates passed by value. This will
be necessary to continue to support Emscripten's exception handling
once we switch using Emscripten's LLVM backend. See #63649.

4 years agoUpdate ui tests
ben [Tue, 8 Oct 2019 17:58:39 +0000 (06:58 +1300)]
Update ui tests

4 years agoresolve: prohibit foreign statics w/ generics
David Wood [Sat, 5 Oct 2019 15:55:58 +0000 (16:55 +0100)]
resolve: prohibit foreign statics w/ generics

This commit modifies resolve to disallow foreign statics that use
parent generics.

`improper_ctypes` is not written to support type parameters, as these
are normally disallowed before the lint is run. Thus, type parameters in
foreign statics must be prohibited before the lint.

The only other case where this *could* have occured is in functions,
but typeck prohibits this with a "foreign items may not have type
parameters" error - a similar error did not exist for statics, because
statics cannot have type parameters, but they can use any
type parameters that are in scope (which isn't the case for functions).

Signed-off-by: David Wood <david@davidtw.co>
4 years agoAuto merge of #65209 - Centril:rollup-tzc0j87, r=Centril
bors [Tue, 8 Oct 2019 17:31:35 +0000 (17:31 +0000)]
Auto merge of #65209 - Centril:rollup-tzc0j87, r=Centril

Rollup of 8 pull requests

Successful merges:

 - #64404 (Add long error explanation for E0495)
 - #64918 (Add long error explanation for E0551)
 - #65102 (Disable stack probe when thread sanitizer is enabled)
 - #65120 (Correctly estimate the required space for string in `StyledBuffer::prepend`)
 - #65145 (When suggesting assoc function with type params, include turbofish)
 - #65162 (Remove loaded_from_cache map from DepGraph)
 - #65176 (Remove query-related macros)
 - #65179 (Add long error explanation for E0567)

Failed merges:

r? @ghost

4 years agoreview comments
Esteban Küber [Tue, 8 Oct 2019 16:46:57 +0000 (09:46 -0700)]
review comments

4 years agoUpdate feature gate error message
Ben Lewis [Mon, 7 Oct 2019 18:55:47 +0000 (07:55 +1300)]
Update feature gate error message

Co-Authored-By: varkor <github@varkor.com>
4 years agoFix reify_fn_ptr test as we now pretty print const function pointers.
ben [Sat, 5 Oct 2019 01:03:41 +0000 (14:03 +1300)]
Fix reify_fn_ptr test as we now pretty print const function pointers.

4 years agoRefactor pretty print const to use a big match statement
ben [Fri, 4 Oct 2019 23:57:12 +0000 (12:57 +1300)]
Refactor pretty print const to use a big match statement

4 years agoSubstitute and normalize all types of consts within collect const
ben [Fri, 4 Oct 2019 22:19:24 +0000 (11:19 +1300)]
Substitute and normalize all types of consts within collect const

4 years agoGate use of raw and function pointers in const generics behind
ben [Fri, 4 Oct 2019 21:49:24 +0000 (10:49 +1300)]
Gate use of raw and function pointers in const generics behind
const_compare_raw_pointers.

4 years agoPretty print function pointer const values.
ben [Wed, 2 Oct 2019 07:29:16 +0000 (20:29 +1300)]
Pretty print function pointer const values.