Commit graph

143038 commits

Author SHA1 Message Date
Dylan DPC
77abe7a5f4
Rollup merge of #84744 - kornelski:enomem, r=joshtriplett
Add ErrorKind::OutOfMemory

Ability to express `ENOMEM` as an `io::Error`.

I've used `OutOfMemory` as opposed to `NotEnoughMem` or `AllocationFailed`, because "OOM" is used in Rust already.

See also #84612
2021-05-03 00:32:41 +02:00
Dylan DPC
966e9e2471
Rollup merge of #84072 - nagisa:target-family-two-the-movie, r=petrochenkov
Allow setting `target_family` to multiple values, and implement `target_family="wasm"`

As per the conclusion in [this thread](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Are.20we.20comfortable.20with.20adding.20an.20insta-stable.20cfg.28wasm.29.3F/near/233158441), this implements an ability to specify any number of `target_family` values, allowing for more flexible generic groups, or "families", to be created than just the OS-based unix/windows dichotomy.

cc https://github.com/rust-lang/reference/pull/1006
2021-05-03 00:32:40 +02:00
bors
8a8ed07883 Auto merge of #82576 - gilescope:to_string, r=Amanieu
i8 and u8::to_string() specialisation (far less asm).

Take 2. Around 1/6th of the assembly to without specialisation.

https://godbolt.org/z/bzz8Mq

(partially fixes #73533 )
2021-05-02 22:01:57 +00:00
Simonas Kazlauskas
1a491e2304 Set target_family="wasm" for wasm targets 2021-05-03 00:32:44 +03:00
bors
6b5de7aaec Auto merge of #84754 - GuillaumeGomez:toggle-migration, r=jsha
Migrate trait and impl blocks' toggles into

Part of #83332

After this, I think only the "global" doc comment will be used as JS toggle. Once this PR is merged, I check what remains and remove them.

There is one change that this PR brings:

![Screenshot from 2021-04-30 15-39-04](https://user-images.githubusercontent.com/3050060/116713412-0f9ce200-a9d5-11eb-979c-2e7a73d16706.png)
![Screenshot from 2021-04-30 15-39-07](https://user-images.githubusercontent.com/3050060/116713415-10357880-a9d5-11eb-9868-1ba9e5ebf65e.png)

As you can see, I had to move the "undocumented" items below, they're not mixed with the others anymore. Unfortunately, I don't see a way to keep the current appearance without JS. As a a reminder, currently it looks like this:

![Screenshot from 2021-04-30 15-39-12](https://user-images.githubusercontent.com/3050060/116713547-31966480-a9d5-11eb-90bb-686042eefeec.png)
![Screenshot from 2021-04-30 15-39-15](https://user-images.githubusercontent.com/3050060/116713549-322efb00-a9d5-11eb-94a9-cfea073120db.png)

r? `@jsha`
2021-05-02 19:46:10 +00:00
Scott McMurray
40ffa94244 PR feedback 2021-05-02 12:29:23 -07:00
Justus K
9ca6d5863b
Do not print visibility in external traits 2021-05-02 21:16:50 +02:00
Mark Rousskov
5065144d6d Use new thread-local const-init
Let's see if this gives us any speedup - some of the TLS state modified in this
commit *is* pretty heavily accessed, so we can hope!
2021-05-02 14:06:07 -04:00
Guillaume Gomez
0d52eb9de8 Improve code readability 2021-05-02 19:12:20 +02:00
Mark Rousskov
981135ae8e Streamline try_start code
This shifts some branches around and avoids interleaving parallel and
non-parallel versions of the function too much.
2021-05-02 12:25:48 -04:00
bors
e10cbc33c1 Auto merge of #84822 - Dylan-DPC:rollup-wego8d6, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #84358 (Update closure capture error logging for disjoint captures for disjoint captures)
 - #84392 (Make AssertKind::fmt_assert_args public)
 - #84752 (Fix debuginfo for generators)
 - #84763 (shrink doctree::Module)
 - #84821 (Fix nit in rustc_session::options)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-05-02 15:01:52 +00:00
Dylan DPC
0bc9727e29
Rollup merge of #84821 - jyn514:fix-nit, r=Mark-Simulacrum
Fix nit in rustc_session::options

Addresses https://github.com/rust-lang/rust/pull/84802#discussion_r624578203 - I never actually pushed the commit before that PR got merged.

r? `@Mark-Simulacrum`
2021-05-02 17:00:25 +02:00
Dylan DPC
e643e2ebdf
Rollup merge of #84763 - tdelabro:shrink-doctree-module, r=jyn514
shrink doctree::Module

helps https://github.com/rust-lang/rust/issues/76382
2021-05-02 17:00:24 +02:00
Dylan DPC
2553053828
Rollup merge of #84752 - lrh2000:generator-debuginfo, r=tmandry
Fix debuginfo for generators

First, all fields except the discriminant (including `outer_fields`) should be put into structures inside the variant part, which gives an equivalent layout but offers us much better integration with debuggers.

Second, artificial flags in generator variants should be removed.
 - Literally, variants are not artificial. We have `yield` statements, upvars and inner variables in the source code.
 - Functionally, we don't want debuggers to suppress the variants. It contains the state of the generator, which is useful when debugging. So they shouldn't be marked artificial.
 - Debuggers may use artificial flags to find the active variant. In this case, marking variants artificial will make debuggers not work properly.

Fixes #62572.
Fixes #79009.

And refer https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Debuginfo.20for.20generators.
2021-05-02 17:00:23 +02:00
Dylan DPC
4198d0a87c
Rollup merge of #84392 - dario23:fmt-assert-args-pub, r=varkor,RalfJung
Make AssertKind::fmt_assert_args public
2021-05-02 17:00:22 +02:00
Dylan DPC
a00edce017
Rollup merge of #84358 - sexxi-goose:print_captures_borrowck_rebased, r=nikomatsakis
Update closure capture error logging for disjoint captures for disjoint captures

Improved error logging when `#![feature(capture_disjoint_fields)]` is used.

Closes https://github.com/rust-lang/project-rfc-2229/issues/8
Closes https://github.com/rust-lang/project-rfc-2229/issues/36
Closes https://github.com/rust-lang/project-rfc-2229/issues/39
Closes #76005
2021-05-02 17:00:21 +02:00
Joshua Nelson
d5bda3c4fe Fix nit in rustc_session::options 2021-05-02 10:08:08 -04:00
Guillaume Gomez
29777fc6cd Update tests 2021-05-02 14:17:07 +02:00
Guillaume Gomez
5bd9146858 Add missing CSS rules for associated types 2021-05-02 14:17:07 +02:00
Guillaume Gomez
dfde867fcd Migrate trait and impl blocks' toggles into 2021-05-02 14:17:07 +02:00
Aliénore Bouttefeux
5cc21d9051 add suggestion for unit enum variant when matched with a patern 2021-05-02 13:58:38 +02:00
bors
89ebad52a8 Auto merge of #84802 - jyn514:option-dead-code, r=Mark-Simulacrum
Remove dead code in `rustc_session::Options`

- Don't recompile the same functions for each debugging option
  This reduces the amount of items in the crate by quite a lot.
- Remove unused `parse_opt_list` and `parse_pathbuf_push` functions
- Remove unused macro parameters
- Remove `allow(dead_code)`.
2021-05-02 11:43:39 +00:00
Kornel
19568f9a83 Use ErrorKind::OutOfMemory in unix, windows, and wasi 2021-05-02 11:40:32 +01:00
Kornel
541c8d898e Add ErrorKind::OutOfMemory 2021-05-02 11:40:31 +01:00
bors
3a1cd0ed36 Auto merge of #84805 - Mark-Simulacrum:no-dup-extend, r=cjgillot
Avoid generating QueryMap::extend for each key type

Should be a small win on compile times for rustc_query_impl, where this ends up getting codegen'd.
2021-05-02 09:22:13 +00:00
Chris Pardy
404cc33eda fix nll test stderr 2021-05-02 04:01:45 -04:00
bors
6d4e3c1ed6 Auto merge of #84750 - jyn514:nix-cargo, r=Mark-Simulacrum
Don't download cargo twice when download-rustc is set

Previously, this caused a bug on NixOS:

1. bootstrap.py would download and patch stage0/cargo
2. bootstrap.py would download nightly cargo, but extract it to
   stage0/cargo instead of ci-rustc/cargo. It would still try (and fail) to patch ci-rustc/cargo.
3. bootstrap.py would fail to build rustbuild because stage0/cargo
   wasn't patched.

The "proper" fix is to extract nightly cargo to ci-rustc instead, but it
doesn't seem to be necessary at all, so this just skips downloading it
instead.

Fixes https://github.com/rust-lang/rust/issues/84702
2021-05-02 07:09:38 +00:00
Scott McMurray
fe540ae1bb RustDoc: Fix bounds linking trait.Foo instead of traitalias.Foo 2021-05-01 23:14:18 -07:00
bors
e244e840f2 Auto merge of #84725 - sebpop:arm64-isb, r=joshtriplett
[Arm64] use isb instruction instead of yield in spin loops

On arm64 we have seen on several databases that ISB (instruction synchronization
barrier) is better to use than yield in a spin loop.  The yield instruction is a
nop.  The isb instruction puts the processor to sleep for some short time.  isb
is a good equivalent to the pause instruction on x86.

Below is an experiment that shows the effects of yield and isb on Arm64 and the
time of a pause instruction on x86 Intel processors.  The micro-benchmarks use
https://github.com/google/benchmark.git

```
$ cat a.cc
static void BM_scalar_increment(benchmark::State& state) {
  int i = 0;
  for (auto _ : state)
    benchmark::DoNotOptimize(i++);
}
BENCHMARK(BM_scalar_increment);
static void BM_yield(benchmark::State& state) {
  for (auto _ : state)
    asm volatile("yield"::);
}
BENCHMARK(BM_yield);
static void BM_isb(benchmark::State& state) {
  for (auto _ : state)
    asm volatile("isb"::);
}
BENCHMARK(BM_isb);
BENCHMARK_MAIN();

$ g++ -o run a.cc -O2 -lbenchmark -lpthread
$ ./run

--------------------------------------------------------------
Benchmark                    Time             CPU   Iterations
--------------------------------------------------------------

AWS Graviton2 (Neoverse-N1) processor:
BM_scalar_increment      0.485 ns        0.485 ns   1000000000
BM_yield                 0.400 ns        0.400 ns   1000000000
BM_isb                    13.2 ns         13.2 ns     52993304

AWS Graviton (A-72) processor:
BM_scalar_increment      0.897 ns        0.874 ns    801558633
BM_yield                 0.877 ns        0.875 ns    800002377
BM_isb                    13.0 ns         12.7 ns     55169412

Apple Arm64 M1 processor:
BM_scalar_increment      0.315 ns        0.315 ns   1000000000
BM_yield                 0.313 ns        0.313 ns   1000000000
BM_isb                    9.06 ns         9.06 ns     77259282
```

```
static void BM_pause(benchmark::State& state) {
  for (auto _ : state)
    asm volatile("pause"::);
}
BENCHMARK(BM_pause);

Intel Skylake processor:
BM_scalar_increment      0.295 ns        0.295 ns   1000000000
BM_pause                  41.7 ns         41.7 ns     16780553
```

Tested on Graviton2 aarch64-linux with `./x.py test`.
2021-05-02 04:54:31 +00:00
bors
bd38aa104a Auto merge of #84638 - mark-i-m:unignore-tests, r=Mark-Simulacrum
Unignore a couple of tests
2021-05-02 02:04:29 +00:00
Esteban Küber
1e89b583c3 Account for unsatisfied bounds in E0599
Fix #84769, follow up to #84499, #83667.
2021-05-01 17:18:04 -07:00
Mark Rousskov
61fd56fdb9 Avoid generating QueryMap::extend for each key type 2021-05-01 20:13:18 -04:00
bors
7e717e99be Auto merge of #84471 - jyn514:linkcheck-llvm, r=Mark-Simulacrum
Allow running `x.py test --stage 2 src/tools/linkchecker` with `download-rustc = true`

Previously, the LD_LIBRARY_PATH for the linkchecker looked like
`build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib`, because the linkchecker depends on the master copy of the standard library. This is true, but doesn't include the library path for the compiler libraries:

```
/home/joshua/src/rust/rust/build/x86_64-unknown-linux-gnu/stage1-tools-bin/error_index_generator: error while loading shared libraries: libLLVM-12-rust-1.53.0-nightly.so: cannot open shared object file: No such file or directory
```

That file is in
`build/x86_64-unknown-linux-gnu/stage1/lib/libLLVM-12-rust-1.53.0-nightly.so`,
which wasn't included in the dynamic path. This adds `build/x86_64-unknown-linux-gnu/stage1/lib` to the dynamic path for the linkchecker.
2021-05-01 23:16:12 +00:00
Joshua Nelson
dd43d13325 Reduce duplication in impl_dep_tracking_hash macros 2021-05-01 19:12:36 -04:00
Joshua Nelson
b19c02cce0 Remove unused macro parameters 2021-05-01 19:01:49 -04:00
Joshua Nelson
5cf4499181 Remove unused parse_pathbuf_push function
This also remove the `allow(dead_code)`.
2021-05-01 19:01:45 -04:00
Joshua Nelson
a88a94e8aa Don't recompile the same functions for each debugging option
This reduces the amount of items in the crate by quite a lot.
2021-05-01 19:01:10 -04:00
Chris Pardy
d19c46870f add docstrings and add issue to FIXMEs 2021-05-01 19:01:06 -04:00
ChrisPardy
e612f7abfc Update compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2021-05-01 19:01:06 -04:00
ChrisPardy
20a1315cbb Update compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2021-05-01 19:01:06 -04:00
ChrisPardy
25beade8df Update compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs
Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
2021-05-01 19:01:05 -04:00
Chris Pardy
08c4fbcea7 Closure capture borrow diagnostics for disjoint captures 2021-05-01 19:01:05 -04:00
Joshua Nelson
85ee3d0f23 Remove unused parse_opt_list function 2021-05-01 18:58:05 -04:00
Rich Kadel
0b0d293c7c Report coverage 0 of dead blocks
Fixes: #84018

With `-Z instrument-coverage`, coverage reporting of dead blocks
(for example, blocks dropped because a conditional branch is dropped,
based on const evaluation) is now supported.

If `instrument-coverage` is enabled, `simplify::remove_dead_blocks()`
finds all dropped coverage `Statement`s and adds their `code_region`s as
`Unreachable` coverage `Statement`s to the `START_BLOCK`, so they are
still included in the coverage map.

Check out the resulting changes in the test coverage reports in this PR.
2021-05-01 15:04:48 -07:00
kadmin
50c86db4fa Add help message for unused type param 2021-05-01 21:58:06 +00:00
Aaron Hill
091b7ddcdd
Add regression test 2021-05-01 17:55:19 -04:00
bors
4de7572097 Auto merge of #84410 - BoxyUwU:blue, r=varkor
Fix generic arg mismatch errors being ignored with explicit late bound lifetimes

Fixes #83466

r? `@varkor`
2021-05-01 21:07:10 +00:00
Aaron Hill
91daf705b4
Make TypeFoldable::is_global() false when fresh tys/consts are present
This ensures that `ParamEnv::and` preserves the original `caller_bounds`
when we have a value containing fresh tys/consts. This ensures that when
we cache a `SelectionCandidate`, the cache key (a `ParamEnvAnd`)
contains all of the information that influenced the computation of our
result (e.g. we may end up choosing a `ParamCandidate`)
2021-05-01 16:58:33 -04:00
Chris Denton
e40faeffa2
Deduplicate native libs before they are passed to the linker 2021-05-01 21:30:26 +01:00
bors
6e2a34474b Auto merge of #83114 - cjgillot:hop, r=eddyb
Move HIR parenting information out of hir_owner

Split out of #82681.

The parent of a HIR node and its content are currently bundled together, but are rarely used together.
This PR separates both information in two distinct queries for HIR owners.
This reduces incremental invalidation for HIR items that appear within a function body when this body (and the local ids) changes.
2021-05-01 18:03:25 +00:00