100453 Commits

Author SHA1 Message Date
bjorn3
ea60335c28 Add top level provide/provide_extern to cg_ssa and cg_utils 2019-10-13 14:43:58 +02:00
bjorn3
bcb01bca86 Remove MiscMethods::instances 2019-10-13 14:43:57 +02:00
bjorn3
dad8ddbfdd Inline functions from cg_ssa::callee and remove the mod
Fixes #65271
2019-10-13 14:42:59 +02:00
bjorn3
f1ed3a8786 s/FuncId/Function 2019-10-13 14:35:14 +02:00
bjorn3
5f6ddb94a6 Move span_invalid_monomorphization_error from cg_llvm to cg_ssa
The associated long diagnostic didn't get registered before
2019-10-13 14:35:14 +02:00
bjorn3
5f203d5988 Move some provides from cg_llvm to rustc_interface 2019-10-13 14:35:14 +02:00
bjorn3
41d329c10d Remove unused method CodegenBackend::diagnostics 2019-10-13 14:35:14 +02:00
bjorn3
cf858a8ac0 Remove is_const_integral method from ConstMethods 2019-10-13 14:35:14 +02:00
bjorn3
4d1a5ade9b Introduce FuncId backend type 2019-10-13 14:35:14 +02:00
bors
29b6e0f0a1 Auto merge of #65182 - anp:reify-shim, r=eddyb
Add `Instance::resolve_for_fn_ptr` (RFC 2091 #2/N)

Supercedes: https://github.com/rust-lang/rust/pull/65082
Depends on: https://github.com/rust-lang/rust/pull/65037
Tracking issue: https://github.com/rust-lang/rust/issues/47809
[RFC text](https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md)

steps taken:

* [x] add a `ReifyShim` that is similar to `VirtualShim` in behavior (see #54183)
* [x] add `ty::Instance::resolve_for_fn_ptr` (leave `ty::Instance::resolve_vtable` alone), migrate appropriate callers
* [x] `resolve_for_fn_ptr` returns the shim if calling a `#[track_caller]` function
2019-10-13 07:32:38 +00:00
bors
3da6836cc9 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
2019-10-13 03:37:25 +00:00
bors
80b861bed1 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
2019-10-12 23:47:27 +00:00
Adam Perry
19f26fafdd Remove the fn pointer #[track_caller] test.
The ICE stderr isn't normalizing correctly on some builders.
2019-10-12 14:25:47 -07:00
bors
1721c9685b Auto merge of #65328 - lzutao:bump-rls-rustfmt, r=Xanewok
Update rls and rustfmt

cc @Xanewok

Fixes #65084
Fixes #65085
Suppressed  #65311
2019-10-12 18:23:13 +00:00
bors
152527f443 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
2019-10-12 11:39:20 +00:00
Lzu Tao
81d813dd67 Bump home crate 2019-10-12 08:29:27 +00:00
Igor Matuszewski
ae79ea3422 Update RLS and Rustfmt
This also bumps rustc-ap-* crates and fixes the relevant toolstate.
2019-10-12 08:28:12 +00:00
bors
026447b9b0 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
2019-10-12 06:25:03 +00:00
bors
4b42e919d6 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).
2019-10-12 02:31:03 +00:00
Tyler Mandry
b93203ff07
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
2019-10-11 15:10:01 -07:00
Tyler Mandry
c8e3c51782
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.
2019-10-11 15:10:00 -07:00
Tyler Mandry
811bd38ae1
Rollup merge of #65289 - varkor:issue-65284, r=estebank
Fix suggested bound addition diagnostic

Fixes #65284.
2019-10-11 15:09:58 -07:00
Tyler Mandry
976a57a4af
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
2019-10-11 15:09:57 -07:00
Tyler Mandry
60482be070
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
2019-10-11 15:09:56 -07:00
Tyler Mandry
9917f062a9
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.
2019-10-11 15:09:54 -07:00
Tyler Mandry
48051e4a79
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?
2019-10-11 15:09:53 -07:00
Tyler Mandry
e4eb54dae8
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`.
2019-10-11 15:09:51 -07:00
Tyler Mandry
2403c37ede
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.
2019-10-11 15:09:50 -07:00
Tyler Mandry
7a2bb04eb5
Rollup merge of #65205 - GuillaumeGomez:long-err-explanation-E0568, r=estebank
Add long error explanation for E0568

Part of #61137.
2019-10-11 15:09:48 -07:00
Tyler Mandry
6687edcbef
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`.
2019-10-11 15:09:47 -07:00
Tyler Mandry
728adc446c
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.
2019-10-11 15:09:45 -07:00
Tyler Mandry
ec1d008f65
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.
2019-10-11 15:09:44 -07:00
Tyler Mandry
ea0d155f2d
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
2019-10-11 15:09:42 -07:00
Tyler Mandry
215b09194f
Rollup merge of #64337 - rick68:patch-17, r=Dylan-DPC
libstd: Fix typos in doc
2019-10-11 15:09:41 -07:00
Mark Rousskov
000fe63b6f 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.
2019-10-11 17:41:55 -04:00
bors
6767d9b90b Auto merge of #64877 - lzutao:stabilize-repeat_generic_slice, r=SimonSapin
Stabilize `slice::repeat` (feature `repeat_generic_slice`)

Closes #48784
r? @SimonSapin
2019-10-11 18:03:20 +00:00
Adam Perry
2d5ef8f9ff Clarify comment about purpose of ReifyShim. 2019-10-11 07:45:59 -07:00
Adam Perry
d92cef7473 resolve_for_fn_ptr checks that the instance is an Item before returning shim. 2019-10-11 07:44:01 -07:00
Dan Aloni
e285175b63 test: extend derive_on_deprecated to include more derivations 2019-10-11 16:38:54 +03:00
Dan Aloni
a32aec021e 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.
2019-10-11 16:38:47 +03:00
Ralf Jung
028f53e38e emcscripten: ignore another thread-using test 2019-10-11 14:58:05 +02:00
bors
d4f7f974b8 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
2019-10-11 12:45:20 +00:00
Ralf Jung
63d67fa273 ignore-emcscripten as it does not support threads 2019-10-11 09:57:44 +02:00
varkor
c97d71538a Fix issue 65284 2019-10-11 00:51:36 +01:00
bors
000d90b11f 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
2019-10-10 23:43:55 +00:00
Vadim Petrochenkov
ceb4c3fa30 stability: Do not use buffer_lint after lowering to HIR 2019-10-10 23:38:35 +03:00
bors
898f36c83c 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
```
2019-10-10 19:40:48 +00:00
csmoe
9f6942066b query generator kind for error reporting 2019-10-10 17:27:23 +00:00
varkor
fb392c5ed6
Don't cc rust-lang/compiler for toolstate changes 2019-10-10 17:23:28 +01:00
bors
58b54911fa 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
2019-10-10 15:40:39 +00:00