]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #84833 - Mark-Simulacrum:thread-local-consts, r=varkor
bors [Tue, 4 May 2021 03:14:32 +0000 (03:14 +0000)]
Auto merge of #84833 - Mark-Simulacrum:thread-local-consts, r=varkor

"const" initialized thread locals in rustc

This appears to give a slight speedup on many of our benchmarks.

3 years agoAuto merge of #84472 - Aaron1011:conservative-paramenv-and, r=lcnr
bors [Tue, 4 May 2021 00:48:42 +0000 (00:48 +0000)]
Auto merge of #84472 - Aaron1011:conservative-paramenv-and, r=lcnr

Be more conservative about discarding caller_bound in `ParamEnv::and`

3 years agoAuto merge of #84862 - GuillaumeGomez:rollup-cbc93h4, r=GuillaumeGomez
bors [Mon, 3 May 2021 14:35:12 +0000 (14:35 +0000)]
Auto merge of #84862 - GuillaumeGomez:rollup-cbc93h4, r=GuillaumeGomez

Rollup of 6 pull requests

Successful merges:

 - #84835 (Add link to Issue #34202 in udp docs)
 - #84852 (Change librustdoc write!(.. \n) to writeln!(..); fix comment grammar)
 - #84854 (use double quotes and full path for E0761)
 - #84856 (Correct stability of ErrorKind::OutOfMemory)
 - #84858 (Fix stability attributes of byte-to-string specialization)
 - #84860 (Link to MCP from target tier policy)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoRollup merge of #84860 - badboy:link-to-mcp, r=GuillaumeGomez
Guillaume Gomez [Mon, 3 May 2021 13:08:12 +0000 (15:08 +0200)]
Rollup merge of #84860 - badboy:link-to-mcp, r=GuillaumeGomez

Link to MCP from target tier policy

Promoting new targets requires filing a MCP. Probably good to link to the documentation what that even is.

3 years agoRollup merge of #84858 - LingMan:patch-1, r=JohnTitor
Guillaume Gomez [Mon, 3 May 2021 13:08:11 +0000 (15:08 +0200)]
Rollup merge of #84858 - LingMan:patch-1, r=JohnTitor

Fix stability attributes of byte-to-string specialization

3 years agoRollup merge of #84856 - kornelski:enomem, r=JohnTitor
Guillaume Gomez [Mon, 3 May 2021 13:08:10 +0000 (15:08 +0200)]
Rollup merge of #84856 - kornelski:enomem, r=JohnTitor

Correct stability of ErrorKind::OutOfMemory

Fix for #84744

3 years agoRollup merge of #84854 - hi-rustin:rustin-patch-E0761, r=varkor
Guillaume Gomez [Mon, 3 May 2021 13:08:09 +0000 (15:08 +0200)]
Rollup merge of #84854 - hi-rustin:rustin-patch-E0761, r=varkor

use double quotes and full path for E0761

close https://github.com/rust-lang/rust/issues/84828

3 years agoRollup merge of #84852 - mautamu:master, r=GuillaumeGomez
Guillaume Gomez [Mon, 3 May 2021 13:08:07 +0000 (15:08 +0200)]
Rollup merge of #84852 - mautamu:master, r=GuillaumeGomez

Change librustdoc write!(.. \n) to writeln!(..); fix comment grammar

Howdy,

This PR does the following:
1. Updates the grammar of a comment in librustdoc.
2. Replaces a few write!(..\n) macros with writeln!(..\n) for clarity. (Please let me know if there is a reason why this might be wrong!)

Best,
Mautamu

3 years agoRollup merge of #84835 - wcampbell0x2a:add-issue-34202-link, r=m-ou-se
Guillaume Gomez [Mon, 3 May 2021 13:08:02 +0000 (15:08 +0200)]
Rollup merge of #84835 - wcampbell0x2a:add-issue-34202-link, r=m-ou-se

Add link to Issue #34202 in udp docs

3 years agoLink to MCP from target tier policy
Jan-Erik Rediger [Mon, 3 May 2021 11:48:56 +0000 (13:48 +0200)]
Link to MCP from target tier policy

3 years agoFix stability attributes of byte-to-string specialization
LingMan [Mon, 3 May 2021 11:00:34 +0000 (13:00 +0200)]
Fix stability attributes of byte-to-string specialization

3 years agouse full path for E0761
hi-rustin [Mon, 3 May 2021 10:57:48 +0000 (18:57 +0800)]
use full path for E0761

3 years agoAuto merge of #83312 - petrochenkov:noinner, r=Aaron1011
bors [Mon, 3 May 2021 10:56:15 +0000 (10:56 +0000)]
Auto merge of #83312 - petrochenkov:noinner, r=Aaron1011

parser: Remove support for inner attributes on non-block expressions

Remove support for attributes like
```rust
fn attrs() {
    (#![print_target_and_args(fifth)] 1, 2);

    [#![print_target_and_args(sixth)] 1 , 2];
    [#![print_target_and_args(seventh)] true ; 5];

    match 0 {
        #![print_target_and_args(eighth)]
        _ => {}
    }

    MyStruct { #![print_target_and_args(ninth)] field: true };
}
```
They are
- useless
- unstable (modulo holes like https://github.com/rust-lang/rust/issues/65860)
- pessimize compiler performance, namely token collection for macros (cc https://github.com/rust-lang/rust/pull/82608)

I still want to run crater on this to check whether the stability holes are exploited in practice, and whether such attributes are used at all.

3 years agoparser: Remove support for inner attributes on non-block expressions
Vadim Petrochenkov [Fri, 19 Mar 2021 23:52:07 +0000 (02:52 +0300)]
parser: Remove support for inner attributes on non-block expressions

3 years agoCorrect stability of ErrorKind::OutOfMemory
Kornel [Mon, 3 May 2021 09:28:19 +0000 (10:28 +0100)]
Correct stability of ErrorKind::OutOfMemory

3 years agoAuto merge of #84845 - wcampbell0x2a:clippy-redundant-field-names, r=joshtriplett
bors [Mon, 3 May 2021 08:05:12 +0000 (08:05 +0000)]
Auto merge of #84845 - wcampbell0x2a:clippy-redundant-field-names, r=joshtriplett

[clippy] remove redundant field names

3 years agouse double quotes for E0761
hi-rustin [Mon, 3 May 2021 08:02:54 +0000 (16:02 +0800)]
use double quotes for E0761

3 years agoChange librustdoc write(.. \n) to writeln(..); fix comment in grammar
mautamu [Mon, 3 May 2021 07:14:56 +0000 (02:14 -0500)]
Change librustdoc write(.. \n) to writeln(..); fix comment in grammar

More grammar

3 years agoAuto merge of #84842 - blkerby:null_lowercase, r=joshtriplett
bors [Mon, 3 May 2021 05:41:23 +0000 (05:41 +0000)]
Auto merge of #84842 - blkerby:null_lowercase, r=joshtriplett

Replace 'NULL' with 'null'

This replaces occurrences of "NULL" with "null" in docs, comments, and compiler error/lint messages. This is for the sake of consistency, as the lowercase "null" is already the dominant form in Rust. The all-caps NULL looks like the C macro (or SQL keyword), which seems out of place in a Rust context, given that NULL does not exist in the Rust language or standard library (instead having [`ptr::null()`](https://doc.rust-lang.org/stable/std/ptr/fn.null.html)).

3 years ago[clippy] remove redundant field names
wcampbell [Mon, 3 May 2021 00:24:17 +0000 (20:24 -0400)]
[clippy] remove redundant field names

Signed-off-by: wcampbell <wcampbell1995@gmail.com>
3 years agoAuto merge of #84840 - Dylan-DPC:rollup-uzk7w0h, r=Dylan-DPC
bors [Mon, 3 May 2021 00:17:16 +0000 (00:17 +0000)]
Auto merge of #84840 - Dylan-DPC:rollup-uzk7w0h, r=Dylan-DPC

Rollup of 6 pull requests

Successful merges:

 - #84072 (Allow setting `target_family` to multiple values, and implement `target_family="wasm"`)
 - #84744 (Add ErrorKind::OutOfMemory)
 - #84784 (Add help message to suggest const for unused type param)
 - #84811 (RustDoc: Fix bounds linking trait.Foo instead of traitalias.Foo)
 - #84818 (suggestion for unit enum variant when matched with a patern)
 - #84832 (Do not print visibility in external traits)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoChange 'NULL' to 'null'
Brent Kerby [Sun, 2 May 2021 21:55:22 +0000 (15:55 -0600)]
Change 'NULL' to 'null'

3 years agoAdd link to Issue #34202 in udp docs
wcampbell [Sun, 2 May 2021 20:15:27 +0000 (16:15 -0400)]
Add link to Issue #34202 in udp docs

Signed-off-by: wcampbell <wcampbell1995@gmail.com>
3 years agoRollup merge of #84832 - Stupremee:dont-print-vis-in-external-traits, r=jyn514
Dylan DPC [Sun, 2 May 2021 22:32:45 +0000 (00:32 +0200)]
Rollup merge of #84832 - Stupremee:dont-print-vis-in-external-traits, r=jyn514

Do not print visibility in external traits

This PR fixes the bug that caused traits, which were re-exported, having visibility modifiers in front of methods, which is invalid.

It would be nice to add a test for this, but I don't even know if tests with multiple crates are possible.

Resolves #81274

3 years agoRollup merge of #84818 - ABouttefeux:enum-suggest, r=jackh726
Dylan DPC [Sun, 2 May 2021 22:32:44 +0000 (00:32 +0200)]
Rollup merge of #84818 - ABouttefeux:enum-suggest, r=jackh726

suggestion for unit enum variant when matched with a patern

resolve #84700

add suggestion for code like
```rust
enum FarmAnimal {
    Worm,
    Cow,
    Bull,
    Chicken { num_eggs: usize },
    Dog (String),
}

fn what_does_the_animal_say(animal: &FarmAnimal) {

    let noise = match animal {
        FarmAnimal::Cow(_) => "moo".to_string(),
        _ => todo!()
    };

    println!("{:?} says: {:?}", animal, noise);
}
```

```
error[E0532]: expected tuple struct or tuple variant, found unit variant `FarmAnimal::Cow`
  --> $DIR/issue-84700.rs:15:9
   |
LL |     Cow,
   |     --- `FarmAnimal::Cow` defined here
...
LL |         FarmAnimal::Cow(_) => "moo".to_string(),
   |         ^^^^^^^^^^^^^^^^^^ help: use this syntax instead: `FarmAnimal::Cow`
   ```

3 years agoRollup merge of #84811 - scottmcm:rustdoc-trait-alias-fix, r=jyn514
Dylan DPC [Sun, 2 May 2021 22:32:43 +0000 (00:32 +0200)]
Rollup merge of #84811 - scottmcm:rustdoc-trait-alias-fix, r=jyn514

RustDoc: Fix bounds linking trait.Foo instead of traitalias.Foo

Fixes #84782

The code was assuming `Trait` when adding bounds to the cache, so add a check on the DefId to see what its kind really is.

r? `@jyn514`

Before:
![image](https://user-images.githubusercontent.com/18526288/116775611-6a751e80-aa53-11eb-84d0-ed6b7782be3c.png)

After:
![image](https://user-images.githubusercontent.com/18526288/116802227-d19cdc80-ab00-11eb-8133-7b34dd750da2.png)

3 years agoRollup merge of #84784 - JulianKnodt:suggest_const, r=lcnr
Dylan DPC [Sun, 2 May 2021 22:32:42 +0000 (00:32 +0200)]
Rollup merge of #84784 - JulianKnodt:suggest_const, r=lcnr

Add help message to suggest const for unused type param

r? `@lcnr`

3 years agoRollup merge of #84744 - kornelski:enomem, r=joshtriplett
Dylan DPC [Sun, 2 May 2021 22:32:41 +0000 (00:32 +0200)]
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

3 years agoRollup merge of #84072 - nagisa:target-family-two-the-movie, r=petrochenkov
Dylan DPC [Sun, 2 May 2021 22:32:40 +0000 (00:32 +0200)]
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

3 years agoAuto merge of #82576 - gilescope:to_string, r=Amanieu
bors [Sun, 2 May 2021 22:01:57 +0000 (22:01 +0000)]
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 )

3 years agoSet target_family="wasm" for wasm targets
Simonas Kazlauskas [Sat, 10 Apr 2021 20:28:58 +0000 (23:28 +0300)]
Set target_family="wasm" for wasm targets

3 years agoAuto merge of #84754 - GuillaumeGomez:toggle-migration, r=jsha
bors [Sun, 2 May 2021 19:46:10 +0000 (19:46 +0000)]
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`

3 years agoPR feedback
Scott McMurray [Sun, 2 May 2021 19:11:13 +0000 (12:11 -0700)]
PR feedback

3 years agoDo not print visibility in external traits
Justus K [Sun, 2 May 2021 17:39:33 +0000 (19:39 +0200)]
Do not print visibility in external traits

3 years agoUse new thread-local const-init
Mark Rousskov [Sun, 2 May 2021 18:04:25 +0000 (14:04 -0400)]
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!

3 years agoImprove code readability
Guillaume Gomez [Sat, 1 May 2021 18:41:00 +0000 (20:41 +0200)]
Improve code readability

3 years agoAuto merge of #84822 - Dylan-DPC:rollup-wego8d6, r=Dylan-DPC
bors [Sun, 2 May 2021 15:01:52 +0000 (15:01 +0000)]
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

3 years agoRollup merge of #84821 - jyn514:fix-nit, r=Mark-Simulacrum
Dylan DPC [Sun, 2 May 2021 15:00:25 +0000 (17:00 +0200)]
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`

3 years agoRollup merge of #84763 - tdelabro:shrink-doctree-module, r=jyn514
Dylan DPC [Sun, 2 May 2021 15:00:24 +0000 (17:00 +0200)]
Rollup merge of #84763 - tdelabro:shrink-doctree-module, r=jyn514

shrink doctree::Module

helps https://github.com/rust-lang/rust/issues/76382

3 years agoRollup merge of #84752 - lrh2000:generator-debuginfo, r=tmandry
Dylan DPC [Sun, 2 May 2021 15:00:23 +0000 (17:00 +0200)]
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.

3 years agoRollup merge of #84392 - dario23:fmt-assert-args-pub, r=varkor,RalfJung
Dylan DPC [Sun, 2 May 2021 15:00:22 +0000 (17:00 +0200)]
Rollup merge of #84392 - dario23:fmt-assert-args-pub, r=varkor,RalfJung

Make AssertKind::fmt_assert_args public

3 years agoRollup merge of #84358 - sexxi-goose:print_captures_borrowck_rebased, r=nikomatsakis
Dylan DPC [Sun, 2 May 2021 15:00:21 +0000 (17:00 +0200)]
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

3 years agoFix nit in rustc_session::options
Joshua Nelson [Sun, 2 May 2021 14:08:08 +0000 (10:08 -0400)]
Fix nit in rustc_session::options

3 years agoUpdate tests
Guillaume Gomez [Fri, 30 Apr 2021 13:29:24 +0000 (15:29 +0200)]
Update tests

3 years agoAdd missing CSS rules for associated types
Guillaume Gomez [Fri, 30 Apr 2021 14:50:03 +0000 (16:50 +0200)]
Add missing CSS rules for associated types

3 years agoMigrate trait and impl blocks' toggles into
Guillaume Gomez [Wed, 28 Apr 2021 19:19:52 +0000 (21:19 +0200)]
Migrate trait and impl blocks' toggles into

3 years agoadd suggestion for unit enum variant when matched with a patern
Aliénore Bouttefeux [Sun, 2 May 2021 09:46:29 +0000 (11:46 +0200)]
add suggestion for unit enum variant when matched with a patern

3 years agoAuto merge of #84802 - jyn514:option-dead-code, r=Mark-Simulacrum
bors [Sun, 2 May 2021 11:43:39 +0000 (11:43 +0000)]
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)`.

3 years agoUse ErrorKind::OutOfMemory in unix, windows, and wasi
Kornel [Fri, 30 Apr 2021 11:34:32 +0000 (12:34 +0100)]
Use ErrorKind::OutOfMemory in unix, windows, and wasi

3 years agoAdd ErrorKind::OutOfMemory
Kornel [Fri, 30 Apr 2021 11:15:38 +0000 (12:15 +0100)]
Add ErrorKind::OutOfMemory

3 years agoAuto merge of #84805 - Mark-Simulacrum:no-dup-extend, r=cjgillot
bors [Sun, 2 May 2021 09:22:13 +0000 (09:22 +0000)]
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.

3 years agofix nll test stderr
Chris Pardy [Sun, 2 May 2021 08:01:45 +0000 (04:01 -0400)]
fix nll test stderr

3 years agoAuto merge of #84750 - jyn514:nix-cargo, r=Mark-Simulacrum
bors [Sun, 2 May 2021 07:09:38 +0000 (07:09 +0000)]
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

3 years agoRustDoc: Fix bounds linking trait.Foo instead of traitalias.Foo
Scott McMurray [Sun, 2 May 2021 04:39:59 +0000 (21:39 -0700)]
RustDoc: Fix bounds linking trait.Foo instead of traitalias.Foo

3 years agoAuto merge of #84725 - sebpop:arm64-isb, r=joshtriplett
bors [Sun, 2 May 2021 04:54:31 +0000 (04:54 +0000)]
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`.

3 years agoAuto merge of #84638 - mark-i-m:unignore-tests, r=Mark-Simulacrum
bors [Sun, 2 May 2021 02:04:29 +0000 (02:04 +0000)]
Auto merge of #84638 - mark-i-m:unignore-tests, r=Mark-Simulacrum

Unignore a couple of tests

3 years agoAvoid generating QueryMap::extend for each key type
Mark Rousskov [Sat, 1 May 2021 21:53:34 +0000 (17:53 -0400)]
Avoid generating QueryMap::extend for each key type

3 years agoAuto merge of #84471 - jyn514:linkcheck-llvm, r=Mark-Simulacrum
bors [Sat, 1 May 2021 23:16:12 +0000 (23:16 +0000)]
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.

3 years agoRemove unused macro parameters
Joshua Nelson [Sat, 1 May 2021 22:54:35 +0000 (18:54 -0400)]
Remove unused macro parameters

3 years agoRemove unused `parse_pathbuf_push` function
Joshua Nelson [Sat, 1 May 2021 22:49:23 +0000 (18:49 -0400)]
Remove unused `parse_pathbuf_push` function

This also remove the `allow(dead_code)`.

3 years agoDon't recompile the same functions for each debugging option
Joshua Nelson [Sat, 1 May 2021 22:48:25 +0000 (18:48 -0400)]
Don't recompile the same functions for each debugging option

This reduces the amount of items in the crate by quite a lot.

3 years agoadd docstrings and add issue to FIXMEs
Chris Pardy [Thu, 29 Apr 2021 01:53:59 +0000 (21:53 -0400)]
add docstrings and add issue to FIXMEs

3 years agoUpdate compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs
ChrisPardy [Thu, 29 Apr 2021 01:32:28 +0000 (21:32 -0400)]
Update compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs

Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
3 years agoUpdate compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs
ChrisPardy [Thu, 29 Apr 2021 01:32:01 +0000 (21:32 -0400)]
Update compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs

Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
3 years agoUpdate compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs
ChrisPardy [Thu, 29 Apr 2021 01:31:49 +0000 (21:31 -0400)]
Update compiler/rustc_mir/src/borrow_check/diagnostics/explain_borrow.rs

Co-authored-by: Niko Matsakis <niko@alum.mit.edu>
3 years agoClosure capture borrow diagnostics for disjoint captures
Chris Pardy [Wed, 17 Mar 2021 06:51:27 +0000 (02:51 -0400)]
Closure capture borrow diagnostics for disjoint captures

3 years agoRemove unused parse_opt_list function
Joshua Nelson [Sat, 1 May 2021 22:36:50 +0000 (18:36 -0400)]
Remove unused parse_opt_list function

3 years agoAdd help message for unused type param
kadmin [Sat, 1 May 2021 04:39:50 +0000 (04:39 +0000)]
Add help message for unused type param

3 years agoAdd regression test
Aaron Hill [Sat, 1 May 2021 21:55:19 +0000 (17:55 -0400)]
Add regression test

3 years agoAuto merge of #84410 - BoxyUwU:blue, r=varkor
bors [Sat, 1 May 2021 21:07:10 +0000 (21:07 +0000)]
Auto merge of #84410 - BoxyUwU:blue, r=varkor

Fix generic arg mismatch errors being ignored with explicit late bound lifetimes

Fixes #83466

r? `@varkor`

3 years agoMake `TypeFoldable::is_global()` false when fresh tys/consts are present
Aaron Hill [Sat, 1 May 2021 20:52:54 +0000 (16:52 -0400)]
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`)

3 years agoAuto merge of #83114 - cjgillot:hop, r=eddyb
bors [Sat, 1 May 2021 18:03:25 +0000 (18:03 +0000)]
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.

3 years agotest: *sneezes*
Ellen [Sat, 1 May 2021 17:35:56 +0000 (18:35 +0100)]
test: *sneezes*

3 years agoAuto merge of #83857 - ABouttefeux:master, r=jyn514
bors [Sat, 1 May 2021 15:36:23 +0000 (15:36 +0000)]
Auto merge of #83857 - ABouttefeux:master, r=jyn514

added --no-run option for rustdoc

resolve #59053

add `--no-run` option for `rustdoc` for compiling doc test but not running them.
Intended for use with `--persist-doctests`.

3 years agocompute where_outer on demand, remove it from Module
Timothée Delabrouille [Sat, 1 May 2021 13:33:49 +0000 (15:33 +0200)]
compute where_outer on demand, remove it from Module

3 years agoAuto merge of #84658 - Amanieu:reserved_regs, r=petrochenkov
bors [Sat, 1 May 2021 13:01:24 +0000 (13:01 +0000)]
Auto merge of #84658 - Amanieu:reserved_regs, r=petrochenkov

Be stricter about rejecting LLVM reserved registers in asm!

LLVM will silently produce incorrect code if these registers are used as operands.

cc `@rust-lang/wg-inline-asm`

3 years agoReserve x18 on AArch64 and un-reserve x16
Amanieu d'Antras [Fri, 30 Apr 2021 17:30:30 +0000 (18:30 +0100)]
Reserve x18 on AArch64 and un-reserve x16

3 years agoAuto merge of #84786 - JohnTitor:rollup-j5omx6f, r=JohnTitor
bors [Sat, 1 May 2021 09:59:54 +0000 (09:59 +0000)]
Auto merge of #84786 - JohnTitor:rollup-j5omx6f, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #84601 (rustdoc: Only store locations in Cache::extern_locations and calculate the other info on-demand)
 - #84704 (platform-support.md: Update for consistency with Target Tier Policy)
 - #84724 (Replace llvm::sys::fs::F_None with llvm::sys::fs::OF_None)
 - #84740 (Reset the docs' copy path button after 1 second)
 - #84749 (Sync `rustc_codegen_cranelift`)
 - #84756 (Add a ToC to the Target Tier Policy documentation)
 - #84765 (Update cargo)
 - #84774 (Fix misspelling)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

3 years agoApply suggestions from code review
Aliénore Bouttefeux [Sat, 1 May 2021 09:46:00 +0000 (11:46 +0200)]
Apply suggestions from code review

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoRollup merge of #84774 - kraai:fix-misspelling, r=jyn514
Yuki Okushi [Sat, 1 May 2021 09:32:40 +0000 (18:32 +0900)]
Rollup merge of #84774 - kraai:fix-misspelling, r=jyn514

Fix misspelling

Fix a misspelling of "or" in the source_code_based_coverage section of
*The Rust Unstable Book*.

3 years agoRollup merge of #84765 - ehuss:update-cargo, r=ehuss
Yuki Okushi [Sat, 1 May 2021 09:32:38 +0000 (18:32 +0900)]
Rollup merge of #84765 - ehuss:update-cargo, r=ehuss

Update cargo

7 commits in 4369396ce7d270972955d876eaa4954bea56bcd9..f3e13226d6d17a2bc5f325303494b43a45f53b7f
2021-04-27 14:35:53 +0000 to 2021-04-30 21:50:27 +0000
- Fix problem with metrics test. (rust-lang/cargo#9440)
- Show transfer rate when fetching/updating registry index (rust-lang/cargo#9395)
- Fix collision doc tests randomly failing. (rust-lang/cargo#9434)
- Add missing tracking issues and unstable docs. (rust-lang/cargo#9429)
- Fix dep-info files emitting paths relative to deps' roots (rust-lang/cargo#9421)
- Upgrade to GitHub-native Dependabot (rust-lang/cargo#9428)
- Only deny the `unused_mut` lint (rust-lang/cargo#9425)

3 years agoRollup merge of #84756 - badboy:toc-for-tier-policy, r=GuillaumeGomez
Yuki Okushi [Sat, 1 May 2021 09:32:37 +0000 (18:32 +0900)]
Rollup merge of #84756 - badboy:toc-for-tier-policy, r=GuillaumeGomez

Add a ToC to the Target Tier Policy documentation

The policy document is quite lengthy, I figured it might be good to have a quick way to jump to the specific tier policies.

3 years agoRollup merge of #84749 - XAMPPRocky:cranelift-rebase, r=bjorn3
Yuki Okushi [Sat, 1 May 2021 09:32:35 +0000 (18:32 +0900)]
Rollup merge of #84749 - XAMPPRocky:cranelift-rebase, r=bjorn3

Sync `rustc_codegen_cranelift`

Retrying #84746

r? ``@bjorn3``

---

Edit(bjorn3): Since the last sync there have been some refactorings around the driver code in preparation for a planned new feature. In addition ``@mominul`` implemented `-Ctarget-cpu` support and ``@XAMPPRocky`` fixed compilation of cg_clif itself for Windows with the MSVC toolchain.

3 years agoRollup merge of #84740 - r00ster91:patch-6, r=GuillaumeGomez
Yuki Okushi [Sat, 1 May 2021 09:32:35 +0000 (18:32 +0900)]
Rollup merge of #84740 - r00ster91:patch-6, r=GuillaumeGomez

Reset the docs' copy path button after 1 second

I like that this copy path button on the top next to the type/module's name changes to a check mark when you successfully clicked and copied the path but I find it really weird how the icon stays that check mark forever after the first time of clicking it. Imagine you leave that documentation tab open and come back after 2 hours and you still see that check mark in that box because you copied the path 2 hours ago. You will probably be confused and you might've forgotten what that button even does (even more so currently where this is a new feature, or when you simply don't use it often), so I really think at some point it should go back to the ⎘ icon which, at least to me, pretty clearly indicates copying, whereas the check mark (if it stays there for so long) could falsely look like a verification mark indicating "this module is verified" or something like that.
I believe after a longer period of time it's not logical to still tell the user "yes you've copied this successful".

In addition to this timeout, maybe it could be made so that you can't copy again until this cooldown of 1 second is over, but I'm not sure how useful or user-friendly that feature would be so maybe it's fine the way it is now.
Also the timeout is cleared every time you click again so if you constantly click it, it won't reset during that.

3 years agoRollup merge of #84724 - MaskRay:sys-fs, r=petrochenkov
Yuki Okushi [Sat, 1 May 2021 09:32:34 +0000 (18:32 +0900)]
Rollup merge of #84724 - MaskRay:sys-fs, r=petrochenkov

Replace llvm::sys::fs::F_None with llvm::sys::fs::OF_None

The former is deprecated.
OF_None has been available in LLVM since 2018-06.

-----

OF_None (https://reviews.llvm.org/rG1f67a3cba9b09636c56e2109d8a35ae96dc15782) exists in LLVM 9.
https://reviews.llvm.org/D101506 may drop `F_None` support.

3 years agoRollup merge of #84704 - joshtriplett:platform-support-target-tier-policy, r=pietroalbini
Yuki Okushi [Sat, 1 May 2021 09:32:33 +0000 (18:32 +0900)]
Rollup merge of #84704 - joshtriplett:platform-support-target-tier-policy, r=pietroalbini

platform-support.md: Update for consistency with Target Tier Policy

Split into five sections to match the tiers: "Tier 1 with Host Tools",
"Tier 1", "Tier 2 with Host Tools", "Tier 2", and "Tier 3". Explain each
tier briefly in prose, and link to the corresponding section of the
policy for full requirements.

Drop the `host` columns from the first four, since the different
sections distinguish that. (Keep the `host` column for "Tier 3", since
it's a single list and the `host` column just indicates if host tools
are expected to work.)

Targets with host tools always have full support for std, so drop the
`std` column from those.

Move the explanations of the `std` column next to the appropriate
tables, and drop the unknown/WIP case for tier 2 targets.

Use "target" terminology consistently throughout.

Sort each table by target name.

3 years agoRollup merge of #84601 - tdelabro:rustdoc-get-rid-of-cache-extern_locations, r=jyn514
Yuki Okushi [Sat, 1 May 2021 09:32:31 +0000 (18:32 +0900)]
Rollup merge of #84601 - tdelabro:rustdoc-get-rid-of-cache-extern_locations, r=jyn514

rustdoc: Only store locations in Cache::extern_locations and calculate the other info on-demand

 help #84588

3 years agoAuto merge of #84582 - richkadel:issue-84561, r=tmandry
bors [Sat, 1 May 2021 07:48:24 +0000 (07:48 +0000)]
Auto merge of #84582 - richkadel:issue-84561, r=tmandry

Vastly improves coverage spans for macros

Fixes: #84561
This resolves problems where macros like `trace!(...)` would show zero coverage if tracing was disabled, and `assert_eq!(...)` would show zero coverage if the assertion did not fail, because only one coverage span was generated, for the branch.

This PR started with an idea that I could just drop branching blocks with same span as expanded macro. (See the fixed issue for more details.)

That did help, but it didn't resolve everything.

I also needed to add a span specifically for the macro name (plus `!`) to ensure the macro gets coverage even if it's internal expansion adds conditional branching blocks that are retained, and would otherwise drop the outer span. Now that outer span is _only_ the `(argument, list)`, which can safely be dropped now), because the macro name has its own span.

While testing, I also noticed the spanview debug output can cause an ICE on a function with no body. The
workaround for this is included in this PR (separate commit).

r? `@tmandry`
cc? `@wesleywiser`

3 years agoFix misspelling
Matthew James Kraai [Sat, 1 May 2021 03:14:53 +0000 (20:14 -0700)]
Fix misspelling

3 years agoAuto merge of #84463 - jyn514:refactor-impl, r=CraftSpider
bors [Sat, 1 May 2021 02:53:55 +0000 (02:53 +0000)]
Auto merge of #84463 - jyn514:refactor-impl, r=CraftSpider

rustdoc: Remove unnecessary `provided_trait_methods` field from Impl

It can be calculated on-demand.

Helps with https://github.com/rust-lang/rust/issues/76382.

3 years agoRemove unnecessary `provided_trait_methods` field from Impl
Joshua Nelson [Fri, 23 Apr 2021 01:02:21 +0000 (21:02 -0400)]
Remove unnecessary `provided_trait_methods` field from Impl

It can be calculated on-demand.

3 years agoAuto merge of #84747 - pietroalbini:bump-version, r=pietroalbini
bors [Sat, 1 May 2021 00:31:56 +0000 (00:31 +0000)]
Auto merge of #84747 - pietroalbini:bump-version, r=pietroalbini

Bump version to 1.54.0

cc `@Mark-Simulacrum`
r? `@ghost`

3 years agoUpdate cargo
Eric Huss [Fri, 30 Apr 2021 22:57:47 +0000 (15:57 -0700)]
Update cargo

3 years agoAuto merge of #84719 - Mark-Simulacrum:reduce-query-impl, r=davidtwco
bors [Fri, 30 Apr 2021 22:21:07 +0000 (22:21 +0000)]
Auto merge of #84719 - Mark-Simulacrum:reduce-query-impl, r=davidtwco

Move iter_results to dyn FnMut rather than a generic

This means that we're no longer generating the iteration/locking code for each invocation site of iter_results, rather just once per query (roughly), which seems much better: this is a 15% win in instruction counts when compiling the rustc_query_impl crate. The code where this is used also is pretty cold, I suspect; the old solution didn't fully monomorphize either.

3 years agoAuto merge of #84753 - hyd-dev:update-miri, r=RalfJung
bors [Fri, 30 Apr 2021 19:55:47 +0000 (19:55 +0000)]
Auto merge of #84753 - hyd-dev:update-miri, r=RalfJung

Update Miri

To include rust-lang/miri#1783, hence fixes #84741.

r? `@RalfJung`

3 years agoAvoid using rbx in SGX inline assembly since it is reserved
Amanieu d'Antras [Fri, 30 Apr 2021 17:27:12 +0000 (18:27 +0100)]
Avoid using rbx in SGX inline assembly since it is reserved

3 years agoMerge commit '15c8d31392b9fbab3b3368b67acc4bbe5983115a' into cranelift-rebase
Erin Power [Fri, 30 Apr 2021 16:46:59 +0000 (18:46 +0200)]
Merge commit '15c8d31392b9fbab3b3368b67acc4bbe5983115a' into cranelift-rebase

3 years agoNo-op register_jit on Windows (#1170)
XAMPPRocky [Fri, 30 Apr 2021 16:44:20 +0000 (18:44 +0200)]
No-op register_jit on Windows (#1170)

* No-op register_jit on Windows

Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
3 years agoAdd a ToC to the Target Tier Policy documentation
Jan-Erik Rediger [Fri, 30 Apr 2021 15:18:58 +0000 (17:18 +0200)]
Add a ToC to the Target Tier Policy documentation

3 years agoAuto merge of #84654 - alexcrichton:update-llvm-, r=cuviper
bors [Fri, 30 Apr 2021 14:39:27 +0000 (14:39 +0000)]
Auto merge of #84654 - alexcrichton:update-llvm-, r=cuviper

Update LLVM for more wasm simd updates

This fixes the temporary regression introduced in #84339 where the wasm
target uses `fpto{s,u}i` intrinsics but the codegen for those intrinsics
with the `+nontrapping-fptoint` LLVM feature wasn't very good (aka it
didn't use the wasm instruction). The fixes brought in here fix that and
also implement the second-to-last simd instruction in LLVM.