]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #89619 - michaelwoerister:incr-vtables, r=nagisa
bors [Fri, 8 Oct 2021 09:04:06 +0000 (09:04 +0000)]
Auto merge of #89619 - michaelwoerister:incr-vtables, r=nagisa

Turn vtable_allocation() into a query

This PR removes the untracked vtable-const-allocation cache from the `tcx` and turns the `vtable_allocation()` method into a query.

The change is pretty straightforward and should be backportable without too much effort.

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

2 years agoAuto merge of #89659 - workingjubilee:rollup-0vggc69, r=workingjubilee
bors [Fri, 8 Oct 2021 06:16:31 +0000 (06:16 +0000)]
Auto merge of #89659 - workingjubilee:rollup-0vggc69, r=workingjubilee

Rollup of 8 pull requests

Successful merges:

 - #87918 (Enable AutoFDO.)
 - #88137 (On macOS, make strip="symbols" not pass any options to strip)
 - #88772 (Fixed confusing wording on Result::map_or_else.)
 - #89025 (Implement `#[link_ordinal(n)]`)
 - #89082 (Implement #85440 (Random test ordering))
 - #89288 (Wrapper for `-Z gcc-ld=lld` to invoke rust-lld with the correct flavor)
 - #89476 (Correct decoding of foreign expansions during incr. comp.)
 - #89622 (Use correct edition for panic in [debug_]assert!().)

Failed merges:

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

2 years agoRollup merge of #89622 - m-ou-se:debug-assert-2021, r=estebank
Jubilee [Fri, 8 Oct 2021 03:26:15 +0000 (20:26 -0700)]
Rollup merge of #89622 - m-ou-se:debug-assert-2021, r=estebank

Use correct edition for panic in [debug_]assert!().

See https://github.com/rust-lang/rust/issues/88638#issuecomment-915472783

2 years agoRollup merge of #89476 - cjgillot:expn-id, r=petrochenkov
Jubilee [Fri, 8 Oct 2021 03:26:14 +0000 (20:26 -0700)]
Rollup merge of #89476 - cjgillot:expn-id, r=petrochenkov

Correct decoding of foreign expansions during incr. comp.

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

The original issue was due to a wrong assertion in `expn_hash_to_expn_id`.

The secondary issue was due to a mismatch between the encoding and decoding paths for expansions that are created after the TyCtxt is created.

2 years agoRollup merge of #89288 - rusticstuff:lld_wrapper, r=Mark-Simulacrum
Jubilee [Fri, 8 Oct 2021 03:26:13 +0000 (20:26 -0700)]
Rollup merge of #89288 - rusticstuff:lld_wrapper, r=Mark-Simulacrum

Wrapper for `-Z gcc-ld=lld` to invoke rust-lld with the correct flavor

This PR adds an `lld-wrapper` tool which is installed as `ld` and `ld64` in `lib\rustlib\<host_target>\bin\gcc-ld` directory and whose sole purpose is to invoke `rust-lld` in the parent directory with the correct flavor. Lld decides which flavor to use from either the first two commandline arguments or from the name of the executable (`ld` for GNU/ld flavor, `ld64` for Darwin/Macos/ld64 flavor and so on). Symbolic links could not be used as they are not supported by rustup and on Windows.

The wrapper replaces full copies of rust-lld which added some significant bloat. On UNIXish operating systems it exec rust-lld, on Windows it spawns it as a child process.

Fixes #88869.

r? ```@Mark-Simulacrum```
cc ```@nagisa``` ```@petrochenkov``` ```@1000teslas```

2 years agoRollup merge of #89082 - smoelius:master, r=kennytm
Jubilee [Fri, 8 Oct 2021 03:26:12 +0000 (20:26 -0700)]
Rollup merge of #89082 - smoelius:master, r=kennytm

Implement #85440 (Random test ordering)

This PR adds `--shuffle` and `--shuffle-seed` options to `libtest`. The options are similar to the [`-shuffle` option](https://github.com/golang/go/blob/c894b442d1e5e150ad33fa3ce13dbfab1c037b3a/src/testing/testing.go#L1482-L1499) that was recently added to Go.

Here are the relevant parts of the help message:
```
        --shuffle       Run tests in random order
        --shuffle-seed SEED
                        Run tests in random order; seed the random number
                        generator with SEED
...
By default, the tests are run in alphabetical order. Use --shuffle or set
RUST_TEST_SHUFFLE to run the tests in random order. Pass the generated
"shuffle seed" to --shuffle-seed (or set RUST_TEST_SHUFFLE_SEED) to run the
tests in the same order again. Note that --shuffle and --shuffle-seed do not
affect whether the tests are run in parallel.
```
Is an RFC needed for this?

2 years agoRollup merge of #89025 - ricobbe:raw-dylib-link-ordinal, r=michaelwoerister
Jubilee [Fri, 8 Oct 2021 03:26:11 +0000 (20:26 -0700)]
Rollup merge of #89025 - ricobbe:raw-dylib-link-ordinal, r=michaelwoerister

Implement `#[link_ordinal(n)]`

Allows the use of `#[link_ordinal(n)]` with `#[link(kind = "raw-dylib")]`, allowing Rust to link against DLLs that export symbols by ordinal rather than by name.  As long as the ordinal matches, the name of the function in Rust is not required to match the name of the corresponding function in the exporting DLL.

Part of #58713.

2 years agoRollup merge of #88772 - orlp:result-map-or-else-docfix, r=yaahc
Jubilee [Fri, 8 Oct 2021 03:26:11 +0000 (20:26 -0700)]
Rollup merge of #88772 - orlp:result-map-or-else-docfix, r=yaahc

Fixed confusing wording on Result::map_or_else.

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

2 years agoRollup merge of #88137 - joshtriplett:osx-strip-symbols-no-option, r=michaelwoerister
Jubilee [Fri, 8 Oct 2021 03:26:10 +0000 (20:26 -0700)]
Rollup merge of #88137 - joshtriplett:osx-strip-symbols-no-option, r=michaelwoerister

On macOS, make strip="symbols" not pass any options to strip

This makes the output with `strip="symbols"` match the result of just
calling `strip` on the output binary, minimizing the size of the binary.

2 years agoRollup merge of #87918 - mikebenfield:pr-afdo, r=nikic
Jubilee [Fri, 8 Oct 2021 03:26:09 +0000 (20:26 -0700)]
Rollup merge of #87918 - mikebenfield:pr-afdo, r=nikic

Enable AutoFDO.

This largely involves implementing the options debug-info-for-profiling
and profile-sample-use and forwarding them on to LLVM.

AutoFDO can be used on x86-64 Linux like this:
rustc -O -Clink-arg='Wl,--no-rosegment' -Cdebug-info-for-profiling main.rs -o main
perf record -b ./main
create_llvm_prof --binary=main --out=code.prof
rustc -O -Cprofile-sample-use=code.prof main.rs -o main2

Now `main2` will have feedback directed optimization applied to it.

The create_llvm_prof tool can be obtained from this github repository:
https://github.com/google/autofdo

The option -Clink-arg='Wl,--no-rosegment' is necessary to avoid lld
putting an extra RO segment before the executable code, which would make
the binary silently incompatible with create_llvm_prof.

2 years agoAuto merge of #89646 - camelid:miri-up, r=RalfJung
bors [Fri, 8 Oct 2021 03:14:19 +0000 (03:14 +0000)]
Auto merge of #89646 - camelid:miri-up, r=RalfJung

Update Miri

Fixes #89612.

r? `@RalfJung`

2 years agoAuto merge of #89638 - rust-lang:revert-88548-intersperse, r=Mark-Simulacrum
bors [Thu, 7 Oct 2021 23:50:54 +0000 (23:50 +0000)]
Auto merge of #89638 - rust-lang:revert-88548-intersperse, r=Mark-Simulacrum

Revert "Stabilize `Iterator::intersperse()`"

Reverts rust-lang/rust#88548

First step in resolving https://github.com/rust-lang/rust/issues/88967

2 years agoUpdate Miri
Noah Lev [Thu, 7 Oct 2021 20:47:00 +0000 (13:47 -0700)]
Update Miri

2 years agoAuto merge of #89617 - flip1995:clippyup, r=Manishearth
bors [Thu, 7 Oct 2021 20:26:27 +0000 (20:26 +0000)]
Auto merge of #89617 - flip1995:clippyup, r=Manishearth

Update Clippy

r? `@Manishearth`

2 years agoTurn tcx.vtable_allocation() into a query.
Michael Woerister [Thu, 7 Oct 2021 09:29:01 +0000 (11:29 +0200)]
Turn tcx.vtable_allocation() into a query.

2 years agoRevert "Stabilize `Iterator::intersperse()`"
Jane Lusby [Thu, 7 Oct 2021 17:39:36 +0000 (10:39 -0700)]
Revert "Stabilize `Iterator::intersperse()`"

2 years agoAuto merge of #89629 - GuillaumeGomez:rollup-s4r8me6, r=GuillaumeGomez
bors [Thu, 7 Oct 2021 17:17:25 +0000 (17:17 +0000)]
Auto merge of #89629 - GuillaumeGomez:rollup-s4r8me6, r=GuillaumeGomez

Rollup of 7 pull requests

Successful merges:

 - #89298 (Issue 89193 - Fix ICE when using `usize` and `isize` with SIMD gathers )
 - #89461 (Add `deref_into_dyn_supertrait` lint.)
 - #89477 (Move items related to computing diffs to a separate file)
 - #89559 (RustWrapper: adapt for LLVM API change)
 - #89585 (Emit item no type error even if type inference fails)
 - #89596 (Make cfg imply doc(cfg))
 - #89615 (Add InferCtxt::with_opaque_type_inference to get_body_with_borrowck_facts)

Failed merges:

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

2 years agoAdd wrapper for -Z gcc-ld=lld to invoke rust-lld with the correct flavor
Hans Kratz [Sat, 25 Sep 2021 13:25:08 +0000 (15:25 +0200)]
Add wrapper for -Z gcc-ld=lld to invoke rust-lld with the correct flavor

The wrapper is installed as `ld` and `ld64` in the `lib\rustlib\<host_target>\bin\gcc-ld`
directory and its sole purpose is to invoke `rust-lld` in the parent directory with
the correct flavor.

2 years agoRollup merge of #89615 - willcrichton:fix-get-body-with-borrowck-facts, r=oli-obk
Guillaume Gomez [Thu, 7 Oct 2021 14:24:54 +0000 (16:24 +0200)]
Rollup merge of #89615 - willcrichton:fix-get-body-with-borrowck-facts, r=oli-obk

Add InferCtxt::with_opaque_type_inference to get_body_with_borrowck_facts

`mir_borrowck` uses `with_opaque_type_inference` before calling `do_mir_borrowck`: https://github.com/rust-lang/rust/blob/0eabf25b90396dead0b2a1aaa275af18a1ae6008/compiler/rustc_borrowck/src/lib.rs#L132

However `get_body_with_borrowck_facts` does not. Therefore I get an ICE eg when calling this function on the bodies of an async function as described here: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/.E2.9C.94.20ICE.20when.20using.20get_body_with_borrowck_facts.20with.20async

This change fixes that bug.

r? `@nikomatsakis`

2 years agoRollup merge of #89596 - GuillaumeGomez:implicit-doc-cfg, r=jyn514
Guillaume Gomez [Thu, 7 Oct 2021 14:24:53 +0000 (16:24 +0200)]
Rollup merge of #89596 - GuillaumeGomez:implicit-doc-cfg, r=jyn514

Make cfg imply doc(cfg)

This is a reopening of #79341, rebased and modified a bit (we made a lot of refactoring in rustdoc's types so they needed to be reflected in this PR as well):

 * `hidden_cfg` is now in the `Cache` instead of `DocContext` because `cfg` information isn't stored anymore on `clean::Attributes` type but instead computed on-demand, so we need this information in later parts of rustdoc.
 * I removed the `bool_to_options` feature (which makes the code a bit simpler to read for `SingleExt` trait implementation.
 * I updated the version for the feature.

There is only one thing I couldn't figure out: [this comment](https://github.com/rust-lang/rust/pull/79341#discussion_r561855624)

> I think I'll likely scrap the whole `SingleExt` extension trait as the diagnostics for 0 and >1 items should be different.

How/why should they differ?

EDIT: this part has been solved, the current code was fine, just needed a little simplification.

cc `@Nemo157`
r? `@jyn514`

Original PR description:

This is only active when the `doc_cfg` feature is active.

The implicit cfg can be overridden via `#[doc(cfg(...))]`, so e.g. to hide a `#[cfg]` you can use something like:

```rust
#[cfg(unix)]
#[doc(cfg(all()))]
pub struct Unix;
```

By adding `#![doc(cfg_hide(foobar))]` to the crate attributes the cfg `#[cfg(foobar)]` (and _only_ that _exact_ cfg) will not be implicitly treated as a `doc(cfg)` to render a message in the documentation.

2 years agoRollup merge of #89585 - nbdd0121:issue-89574, r=estebank
Guillaume Gomez [Thu, 7 Oct 2021 14:24:52 +0000 (16:24 +0200)]
Rollup merge of #89585 - nbdd0121:issue-89574, r=estebank

Emit item no type error even if type inference fails

Fix #89574

The stashed error should be emitted regardless whether ty references error or not.

2 years agoRollup merge of #89559 - krasimirgg:llvm-14-fatal_error_handler_t, r=nagisa
Guillaume Gomez [Thu, 7 Oct 2021 14:24:51 +0000 (16:24 +0200)]
Rollup merge of #89559 - krasimirgg:llvm-14-fatal_error_handler_t, r=nagisa

RustWrapper: adapt for LLVM API change

No functional changes intended.

The LLVM commit
https://github.com/llvm/llvm-project/commit/e463b69736da8b0a950ecd937cf990401bdfcdeb
changed an argument of fatal_error_handler_t from std::string to char*.
This adapts RustWrapper accordingly.

2 years agoRollup merge of #89477 - Nicholas-Baron:compute_diff_rs, r=Mark-Simulacrum
Guillaume Gomez [Thu, 7 Oct 2021 14:24:50 +0000 (16:24 +0200)]
Rollup merge of #89477 - Nicholas-Baron:compute_diff_rs, r=Mark-Simulacrum

Move items related to computing diffs to a separate file

Work towards #89475.

2 years agoRollup merge of #89461 - crlf0710:dyn_upcasting_lint, r=nikomatsakis
Guillaume Gomez [Thu, 7 Oct 2021 14:24:49 +0000 (16:24 +0200)]
Rollup merge of #89461 - crlf0710:dyn_upcasting_lint, r=nikomatsakis

Add `deref_into_dyn_supertrait` lint.

Initial implementation of #89460. Resolves #89190.
Maybe also worth a beta backport if necessary.

r? `@nikomatsakis`

2 years agoRollup merge of #89298 - gcohara:issue89193, r=workingjubilee
Guillaume Gomez [Thu, 7 Oct 2021 14:24:48 +0000 (16:24 +0200)]
Rollup merge of #89298 - gcohara:issue89193, r=workingjubilee

Issue 89193 - Fix ICE when using `usize` and `isize` with SIMD gathers

closes #89193
r? `@workingjubilee`

2 years agoAuto merge of #89534 - camsteffen:diag-name, r=oli-obk
bors [Thu, 7 Oct 2021 14:22:16 +0000 (14:22 +0000)]
Auto merge of #89534 - camsteffen:diag-name, r=oli-obk

Introduce `tcx.get_diagnostic_name`

Introduces a "reverse lookup" for diagnostic items. This is mainly intended for `@rust-lang/clippy` which often does a long series of `is_diagnostic_item` calls for the same `DefId`.

r? `@oli-obk`

2 years agoAdd tests for panic and [debug_]assert in Rust 2021.
Mara Bos [Thu, 7 Oct 2021 10:45:01 +0000 (12:45 +0200)]
Add tests for panic and [debug_]assert in Rust 2021.

2 years agoUse correct edition for panic in [debug_]assert!() etc.
Mara Bos [Thu, 7 Oct 2021 10:44:46 +0000 (12:44 +0200)]
Use correct edition for panic in [debug_]assert!() etc.

2 years agoAuto merge of #86525 - shamatar:array_len_opt, r=oli-obk
bors [Thu, 7 Oct 2021 11:34:40 +0000 (11:34 +0000)]
Auto merge of #86525 - shamatar:array_len_opt, r=oli-obk

Array `.len()` MIR optimization pass

This pass kind-of works back the `[T; N].len()` call that at the moment is first coerced as `&[T; N]` -> `&[T]` and then uses `&[T].len()`. Depends on #86383

2 years agoRemove untracked vtable-const-allocation cache from tcx
Michael Woerister [Wed, 6 Oct 2021 15:43:13 +0000 (17:43 +0200)]
Remove untracked vtable-const-allocation cache from tcx

2 years agoMerge commit 'b7f3f7f6082679da2da9a0b3faf1b5adef3afd3b' into clippyup
flip1995 [Thu, 7 Oct 2021 09:21:30 +0000 (11:21 +0200)]
Merge commit 'b7f3f7f6082679da2da9a0b3faf1b5adef3afd3b' into clippyup

2 years agoAuto merge of #7783 - flip1995:rustup, r=flip1995
bors [Thu, 7 Oct 2021 09:18:25 +0000 (09:18 +0000)]
Auto merge of #7783 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

Finally an easy, conflict free rustup again :tada:

changelog: none

2 years agoBump nightly version -> 2021-10-07
flip1995 [Thu, 7 Oct 2021 09:12:27 +0000 (11:12 +0200)]
Bump nightly version -> 2021-10-07

2 years agoAllow invalid-paths for regex paths
flip1995 [Thu, 7 Oct 2021 09:12:02 +0000 (11:12 +0200)]
Allow invalid-paths for regex paths

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Thu, 7 Oct 2021 09:11:23 +0000 (11:11 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoAuto merge of #89495 - Mark-Simulacrum:add-inlines, r=michaelwoerister
bors [Thu, 7 Oct 2021 06:23:23 +0000 (06:23 +0000)]
Auto merge of #89495 - Mark-Simulacrum:add-inlines, r=michaelwoerister

Add two inline annotations for hot functions

These two functions are essentially no-ops (and compile to just a load and
return), but show up in process_obligations profiles with a high call count --
so worthwhile to try and inline them. This is not normally possible as they're
non-generic, so they don't get offered for inlining by our current algorithm.

2 years agoAuto merge of #7780 - mikerite:update_lints_mod_revert, r=llogiq
bors [Thu, 7 Oct 2021 05:00:53 +0000 (05:00 +0000)]
Auto merge of #7780 - mikerite:update_lints_mod_revert, r=llogiq

Revert `update_lints` module list generating code

This commit reverts the module list generation code to what it was
before the change to `include!` it and generates better output.

changelog: none

2 years agoRevert `update_lints` module list generating code
Michael Wright [Thu, 7 Oct 2021 04:37:56 +0000 (06:37 +0200)]
Revert `update_lints` module list generating code

This commit reverts the module list generation code to what it was
before the change to `include!` it and generates better output.

2 years agoAuto merge of #89454 - erikdesjardins:perfattrcheck, r=nikomatsakis
bors [Thu, 7 Oct 2021 03:42:05 +0000 (03:42 +0000)]
Auto merge of #89454 - erikdesjardins:perfattrcheck, r=nikomatsakis

perf: only check for `rustc_trivial_field_reads` attribute on traits, not items, impls, etc.

The checks that are removed in this PR (originally added in #85200) caused a small perf regression: https://github.com/rust-lang/rust/pull/88824#issuecomment-932664761

Since the attribute is currently only applied to traits, I don't think it's worth keeping the additional checks for now.
If/when we decide to apply the attribute somewhere else, we can (partially) revert this and reevaluate the perf impact.

r? `@nikomatsakis` cc `@FabianWolff`

2 years agoAdd InferCtxt::with_opaque_type_inference to get_body_with_borrowck_facts
Will Crichton [Thu, 7 Oct 2021 02:07:56 +0000 (19:07 -0700)]
Add InferCtxt::with_opaque_type_inference to get_body_with_borrowck_facts

2 years agoAuto merge of #89608 - Manishearth:rollup-m7kd76f, r=Manishearth
bors [Wed, 6 Oct 2021 20:17:28 +0000 (20:17 +0000)]
Auto merge of #89608 - Manishearth:rollup-m7kd76f, r=Manishearth

Rollup of 12 pull requests

Successful merges:

 - #87601 (Add functions to add unsigned and signed integers)
 - #88523 (Expand documentation for `FpCategory`.)
 - #89050 (refactor: VecDeques Drain fields to private)
 - #89245 (refactor: make VecDeque's IterMut fields module-private, not just crate-private)
 - #89324 (Rename `std::thread::available_conccurrency` to `std::thread::available_parallelism`)
 - #89329 (print-type-sizes: skip field printing for primitives)
 - #89501 (Note specific regions involved in 'borrowed data escapes' error)
 - #89506 (librustdoc: Use correct heading levels.)
 - #89528 (Fix suggestion to borrow when casting from pointer to reference)
 - #89531 (library std, libc dependency update)
 - #89588 (Add a test for generic_const_exprs)
 - #89591 (fix: alloc-optimisation is only for rust llvm)

Failed merges:

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

2 years agoEnable AutoFDO.
Michael Benfield [Fri, 7 May 2021 07:41:37 +0000 (07:41 +0000)]
Enable AutoFDO.

This largely involves implementing the options debug-info-for-profiling
and profile-sample-use and forwarding them on to LLVM.

AutoFDO can be used on x86-64 Linux like this:
rustc -O -Cdebug-info-for-profiling main.rs -o main
perf record -b ./main
create_llvm_prof --binary=main --out=code.prof
rustc -O -Cprofile-sample-use=code.prof main.rs -o main2

Now `main2` will have feedback directed optimization applied to it.

The create_llvm_prof tool can be obtained from this github repository:
https://github.com/google/autofdo

Fixes #64892.

2 years agoRollup merge of #89591 - infinity0:master, r=Amanieu
Manish Goregaokar [Wed, 6 Oct 2021 19:33:24 +0000 (12:33 -0700)]
Rollup merge of #89591 - infinity0:master, r=Amanieu

fix: alloc-optimisation is only for rust llvm

As discussed at the bottom of #83485.

On a separate note I'll take this chance ask, is it worth pulling in that patch (to recognise `__rust_dealloc`) into Debian's system LLVM? The main factors for us to consider would be (1) is the optimisation significant and (2) is there not any significant negative impact to non-rust packages that use LLVM.

2 years agoRollup merge of #89588 - BoxyUwU:add_a_test_uwu, r=lcnr
Manish Goregaokar [Wed, 6 Oct 2021 19:33:23 +0000 (12:33 -0700)]
Rollup merge of #89588 - BoxyUwU:add_a_test_uwu, r=lcnr

Add a test for generic_const_exprs

Test that const_eval_resolve evaluates consts with unused inference vars in substs

r? ``@lcnr``

2 years agoRollup merge of #89531 - devnexen:stack_overflow_bsd_libc_upd, r=dtolnay
Manish Goregaokar [Wed, 6 Oct 2021 19:33:22 +0000 (12:33 -0700)]
Rollup merge of #89531 - devnexen:stack_overflow_bsd_libc_upd, r=dtolnay

library std, libc dependency update

to solve #87528 build.

2 years agoRollup merge of #89528 - FabianWolff:issue-89497, r=jackh726
Manish Goregaokar [Wed, 6 Oct 2021 19:33:21 +0000 (12:33 -0700)]
Rollup merge of #89528 - FabianWolff:issue-89497, r=jackh726

Fix suggestion to borrow when casting from pointer to reference

Fixes #89497.

2 years agoRollup merge of #89506 - yaymukund:docblock-headings, r=GuillaumeGomez
Manish Goregaokar [Wed, 6 Oct 2021 19:33:20 +0000 (12:33 -0700)]
Rollup merge of #89506 - yaymukund:docblock-headings, r=GuillaumeGomez

librustdoc: Use correct heading levels.

Closes #89309

This fixes the `<h#>` header tags throughout the docs to reflect a semantic hierarchy.

- I ran a script to manually check that we don't have any files with multiple `<h1>` tags.
- Also checked that we never incorrectly nest e.g. a `<h2>` under an `<h3>`.
- I also spot-checked a bunch of pages (`trait.Read`, `enum.Ordering`, `primitive.isize`, `trait.Iterator`).

2 years agoRollup merge of #89501 - Aaron1011:escaping-name-regions, r=davidtwco
Manish Goregaokar [Wed, 6 Oct 2021 19:33:19 +0000 (12:33 -0700)]
Rollup merge of #89501 - Aaron1011:escaping-name-regions, r=davidtwco

Note specific regions involved in 'borrowed data escapes' error

Fixes #67007

Currently, a 'borrowed data escapes' error does not mention
the specific lifetime involved (except indirectly through a suggestion
about adding a lifetime bound). We now explain the specific lifetime
relationship that failed to hold, which improves otherwise vague
error messages.

2 years agoRollup merge of #89329 - tmiasko:print-type-sizes-no-fields, r=jackh726
Manish Goregaokar [Wed, 6 Oct 2021 19:33:18 +0000 (12:33 -0700)]
Rollup merge of #89329 - tmiasko:print-type-sizes-no-fields, r=jackh726

print-type-sizes: skip field printing for primitives

Fixes #86528.

2 years agoRollup merge of #89324 - yoshuawuyts:hardware-parallelism, r=m-ou-se
Manish Goregaokar [Wed, 6 Oct 2021 19:33:17 +0000 (12:33 -0700)]
Rollup merge of #89324 - yoshuawuyts:hardware-parallelism, r=m-ou-se

Rename `std::thread::available_conccurrency` to `std::thread::available_parallelism`

_Tracking issue: https://github.com/rust-lang/rust/issues/74479_

This PR renames  `std::thread::available_conccurrency` to `std::thread::available_parallelism`.

## Rationale

The API was initially named `std::thread::hardware_concurrency`, mirroring the [C++ API of the same name](https://en.cppreference.com/w/cpp/thread/thread/hardware_concurrency). We eventually decided to omit any reference to the word "hardware" after [this comment](https://github.com/rust-lang/rust/pull/74480#issuecomment-662045841). And so we ended up with `available_concurrency` instead.

---

For a talk I was preparing this week I was reading through ["Understanding and expressing scalable concurrency" (A. Turon, 2013)](http://aturon.github.io/academic/turon-thesis.pdf), and the following passage stood out to me (emphasis mine):

> __Concurrency is a system-structuring mechanism.__ An interactive system that deals with disparate asynchronous events is naturally structured by division into concurrent threads with disparate responsibilities. Doing so creates a better fit between problem and solution, and can also decrease the average latency of the system by preventing long-running computations from obstructing quicker ones.

> __Parallelism is a resource.__ A given machine provides a certain capacity for parallelism, i.e., a bound on the number of computations it can perform simultaneously. The goal is to maximize throughput by intelligently using this resource. For interactive systems, parallelism can decrease latency as well.

_Chapter 2.1: Concurrency is not Parallelism. Page 30._

---

_"Concurrency is a system-structuring mechanism. Parallelism is a resource."_ â€” It feels like this accurately captures the way we should be thinking about these APIs. What this API returns is not "the amount of concurrency available to the program" which is a property of the program, and thus even with just a single thread is effectively unbounded. But instead it returns "the amount of _parallelism_ available to the program", which is a resource hard-constrained by the machine's capacity (and can be further restricted by e.g. operating systems).

That's why I'd like to propose we rename this API from `available_concurrency` to `available_parallelism`. This still meets the criteria we previously established of not attempting to define what exactly we mean by "hardware", "threads", and other such words. Instead we only talk about "concurrency" as an abstract resource available to our program.

r? `@joshtriplett`

2 years agoRollup merge of #89245 - DeveloperC286:iter_mut_fields_to_private, r=joshtriplett
Manish Goregaokar [Wed, 6 Oct 2021 19:33:16 +0000 (12:33 -0700)]
Rollup merge of #89245 - DeveloperC286:iter_mut_fields_to_private, r=joshtriplett

refactor: make VecDeque's IterMut fields module-private, not just crate-private

Made the fields of VecDeque's IterMut private by creating a IterMut::new(...) function to create a new instance of IterMut and migrating usage to use IterMut::new(...).

2 years agoRollup merge of #89050 - DeveloperC286:drain_fields_to_private, r=joshtriplett
Manish Goregaokar [Wed, 6 Oct 2021 19:33:15 +0000 (12:33 -0700)]
Rollup merge of #89050 - DeveloperC286:drain_fields_to_private, r=joshtriplett

refactor: VecDeques Drain fields to private

Made the fields of VecDeque's Drain private by creating a Drain::new(...) function to create a new instance of Drain and migrating usage to use Drain::new(...).

2 years agoRollup merge of #88523 - kpreid:category, r=yaahc
Manish Goregaokar [Wed, 6 Oct 2021 19:33:14 +0000 (12:33 -0700)]
Rollup merge of #88523 - kpreid:category, r=yaahc

Expand documentation for `FpCategory`.

I intend these changes to be helpful to readers who are not yet familiar with the quirks of floating-point numbers. Additionally, I felt it was misleading to describe `Nan` as being the result of division by zero, since most divisions by zero (except for 0/0) produce `Infinite` floats, so I moved that remark to the `Infinite` variant with adjustment.

The first sentence of the `Nan` documentation is copied from `f32`; I followed the example of the `f64` documentation by referring to `f32` for general concepts, rather than duplicating the text.

----

I considered making similar changes to the documentation of the `is_*` methods of floats, but decided that that was a much larger and trickier problem; here, each of the variants' descriptions can be expected to be read in context of being mutually exclusive with the others.

2 years agoRollup merge of #87601 - a1phyr:feature_uint_add_signed, r=kennytm
Manish Goregaokar [Wed, 6 Oct 2021 19:33:13 +0000 (12:33 -0700)]
Rollup merge of #87601 - a1phyr:feature_uint_add_signed, r=kennytm

Add functions to add unsigned and signed integers

This PR adds methods to unsigned integers to add signed integers with good overflow semantics under `#![feature(mixed_integer_ops)]`.

The added API is:

```rust
// `uX` is `u8`, `u16`, `u32`, `u64`,`u128`, `usize`
impl uX {
    pub const fn checked_add_signed(self, iX) -> Option<Self>;
    pub const fn overflowing_add_signed(self, iX) -> (Self, bool);
    pub const fn saturating_add_signed(self, iX) -> Self;
    pub const fn wrapping_add_signed(self, iX) -> Self;
}

impl iX {
    pub const fn checked_add_unsigned(self, uX) -> Option<Self>;
    pub const fn overflowing_add_unsigned(self, uX) -> (Self, bool);
    pub const fn saturating_add_unsigned(self, uX) -> Self;
    pub const fn wrapping_add_unsigned(self, uX) -> Self;

    pub const fn checked_sub_unsigned(self, uX) -> Option<Self>;
    pub const fn overflowing_sub_unsigned(self, uX) -> (Self, bool);
    pub const fn saturating_sub_unsigned(self, uX) -> Self;
    pub const fn wrapping_sub_unsigned(self, uX) -> Self;
}
```

Maybe it would be interesting to also have `add_signed` that panics in debug and wraps in release ?

2 years agoSimplify AttributesExt::cfg function and remove error emissions since they are not...
Guillaume Gomez [Wed, 6 Oct 2021 18:06:33 +0000 (20:06 +0200)]
Simplify AttributesExt::cfg function and remove error emissions since they are not useful

2 years agoAuto merge of #7772 - Manishearth:doc-markdown-intra, r=camsteffen
bors [Wed, 6 Oct 2021 19:16:22 +0000 (19:16 +0000)]
Auto merge of #7772 - Manishearth:doc-markdown-intra, r=camsteffen

Handle intra-doc links in doc_markdown

Fixes #7758

changelog: Handle intra-doc links in [`doc_markdown`]

2 years agoBless tests
Cameron Steffen [Wed, 6 Oct 2021 19:00:40 +0000 (14:00 -0500)]
Bless tests

2 years agoopt-level >= 4
Alexander [Wed, 6 Oct 2021 18:37:24 +0000 (20:37 +0200)]
opt-level >= 4

2 years agoClean up code a bit:
Guillaume Gomez [Wed, 6 Oct 2021 13:34:59 +0000 (15:34 +0200)]
Clean up code a bit:

 * Remove "bool_to_options" feature
 * Update version for compiler feature
 * rustfmt

2 years agoUse get_diagnostic_name
Cameron Steffen [Mon, 4 Oct 2021 21:11:22 +0000 (16:11 -0500)]
Use get_diagnostic_name

2 years agoDo not ICE if some foreign expansions were not encoded.
Camille GILLOT [Sat, 2 Oct 2021 20:55:04 +0000 (22:55 +0200)]
Do not ICE if some foreign expansions were not encoded.

The metadata encoder does not necessarily encode all expansions, only
those which are referenced in other metadata fields.

2 years agoDo not re-hash foreign spans.
Camille GILLOT [Sat, 2 Oct 2021 19:14:52 +0000 (21:14 +0200)]
Do not re-hash foreign spans.

2 years agorun remaining tests
Alexander [Wed, 6 Oct 2021 17:08:21 +0000 (19:08 +0200)]
run remaining tests

2 years agoAuto merge of #89599 - rusticstuff:ci-fix, r=Mark-Simulacrum
bors [Wed, 6 Oct 2021 17:06:29 +0000 (17:06 +0000)]
Auto merge of #89599 - rusticstuff:ci-fix, r=Mark-Simulacrum

Switch to our own mirror of libisl plus `ct-ng oldconfig` fixes

Switching to mirror the ISL libs (#89594) unearthed a (possibly long-standing?) issue with `ct-ng oldconfig`. It always overwrites the mirror config values. This PR adds the ISL mirror, gets rid of `ct-ng oldconfig` and adds crosstools-ng config files which can be used directly. (Edited)

Fixes #89593.

r? `@pietroalbini`

2 years agoAccess Session while decoding expn_id.
Camille GILLOT [Sat, 2 Oct 2021 15:35:27 +0000 (17:35 +0200)]
Access Session while decoding expn_id.

2 years agotidy
Alexander [Wed, 6 Oct 2021 16:36:33 +0000 (18:36 +0200)]
tidy

2 years agoGet rid of broken `ct-ng oldconfig` everywhere and directly provide a suitable .confi...
Hans Kratz [Wed, 6 Oct 2021 14:57:25 +0000 (16:57 +0200)]
Get rid of broken `ct-ng oldconfig` everywhere and directly provide a suitable .config file.

2 years agoadd MIR artifacts
Alexander [Wed, 6 Oct 2021 15:53:11 +0000 (17:53 +0200)]
add MIR artifacts

2 years agofix import
Alexander [Wed, 6 Oct 2021 15:45:54 +0000 (17:45 +0200)]
fix import

2 years agoHandle intra-doc links in doc_markdown
Manish Goregaokar [Wed, 6 Oct 2021 07:01:40 +0000 (00:01 -0700)]
Handle intra-doc links in doc_markdown

2 years agoreset and cleanup
Alexander [Wed, 6 Oct 2021 15:31:35 +0000 (17:31 +0200)]
reset and cleanup

2 years agoAdd regression test for #7758
Manish Goregaokar [Wed, 6 Oct 2021 06:48:41 +0000 (23:48 -0700)]
Add regression test for #7758

2 years agoIntroduce get_diagnostic_name
Cameron Steffen [Mon, 4 Oct 2021 20:57:39 +0000 (15:57 -0500)]
Introduce get_diagnostic_name

2 years agoAuto merge of #7776 - tsoutsman:patch-1, r=flip1995
bors [Wed, 6 Oct 2021 13:23:13 +0000 (13:23 +0000)]
Auto merge of #7776 - tsoutsman:patch-1, r=flip1995

Fix typos

I'm not sure whether I should add links to `bool`, `char`, and `str`. `slice` could also be linked to.

changelog: none

2 years agoSwitch to our own mirror of libisl
Mark Rousskov [Wed, 6 Oct 2021 12:40:45 +0000 (08:40 -0400)]
Switch to our own mirror of libisl

2 years agoFix typos
Klim Tsoutsman [Wed, 6 Oct 2021 12:32:22 +0000 (23:32 +1100)]
Fix typos

I'm not sure whether I should add links to `bool`, `char`, and `str`. `slice` could also be linked to.

2 years agoRevert the rustc_error_codes changes.
Mukund Lakshman [Wed, 6 Oct 2021 11:58:41 +0000 (07:58 -0400)]
Revert the rustc_error_codes changes.

2 years agoRestore h1 styles, which got accidentally removed.
Mukund Lakshman [Wed, 6 Oct 2021 11:27:13 +0000 (07:27 -0400)]
Restore h1 styles, which got accidentally removed.

2 years agofix: alloc-optimisation is only for rust llvm
Ximin Luo [Wed, 6 Oct 2021 09:22:03 +0000 (10:22 +0100)]
fix: alloc-optimisation is only for rust llvm

2 years agoAuto merge of #7774 - dswij:useless-exponent, r=llogiq
bors [Wed, 6 Oct 2021 07:54:27 +0000 (07:54 +0000)]
Auto merge of #7774 - dswij:useless-exponent, r=llogiq

Useless exponent

Closes #7745

I'm open to some thoughts on dropping the exponents on suggestions when it's zero. I personally don't see any problem on this.

changelog: [`useless_exponent`] suggestion drops exponent when exponent value is zero

2 years agoAuto merge of #7773 - Manishearth:update-lints-mods, r=flip1995
bors [Wed, 6 Oct 2021 07:38:38 +0000 (07:38 +0000)]
Auto merge of #7773 - Manishearth:update-lints-mods, r=flip1995

Move module declarations back into lib.rs

With #7673 we moved a lot of things from lib.rs to lib.foo.rs. Unfortunately, rustfmt doesn't seem to work when module declarations are included via `include!` (and trying the `mod foo; use foo::*;` trick doesn't seem to work much either in our specific case).

With this PR we continue generating everything in subfiles except for module declarations, which are now generated within lib.rs.

changelog: none

2 years agoAdd tests for zero exponents in `excessive_precision`
dswij [Wed, 6 Oct 2021 07:33:05 +0000 (15:33 +0800)]
Add tests for zero exponents in `excessive_precision`

2 years agoRegen update_lints
Manish Goregaokar [Wed, 6 Oct 2021 07:12:58 +0000 (00:12 -0700)]
Regen update_lints

2 years agoReturn to generating mod declarations in lib.rs
Manish Goregaokar [Wed, 6 Oct 2021 07:12:38 +0000 (00:12 -0700)]
Return to generating mod declarations in lib.rs

2 years agoRebase Result::map_or_else doc wording on top of #89400.
Orson Peters [Thu, 9 Sep 2021 09:46:22 +0000 (11:46 +0200)]
Rebase Result::map_or_else doc wording on top of #89400.

2 years agoDrop exponent suggestion when 0
dswij [Wed, 6 Oct 2021 07:02:38 +0000 (15:02 +0800)]
Drop exponent suggestion when 0

This commit changes numeric literal formatting to drop exponent when
exponent is 0.

2 years agoAuto merge of #89323 - estebank:derive-binop, r=petrochenkov
bors [Wed, 6 Oct 2021 06:20:25 +0000 (06:20 +0000)]
Auto merge of #89323 - estebank:derive-binop, r=petrochenkov

Consider unfulfilled obligations in binop errors

When encountering a binop where the types would have been accepted, if
all the predicates had been fulfilled, include information about the
predicates and suggest appropriate `#[derive]`s if possible.

Fix #84515.

2 years agotest
Ellen [Wed, 6 Oct 2021 03:37:07 +0000 (04:37 +0100)]
test

2 years agoAdd regression test for ice 89574
Gary Guo [Wed, 6 Oct 2021 00:52:45 +0000 (01:52 +0100)]
Add regression test for ice 89574

2 years agoEmit item no type error even if type inference fails
Gary Guo [Wed, 6 Oct 2021 00:51:51 +0000 (01:51 +0100)]
Emit item no type error even if type inference fails

2 years agoAdd tracking issue
Samuel E. Moelius III [Wed, 6 Oct 2021 00:46:28 +0000 (20:46 -0400)]
Add tracking issue

2 years agoConsider unfulfilled obligations in binop errors
Esteban Kuber [Tue, 28 Sep 2021 14:48:54 +0000 (14:48 +0000)]
Consider unfulfilled obligations in binop errors

When encountering a binop where the types would have been accepted, if
all the predicates had been fulfilled, include information about the
predicates and suggest appropriate `#[derive]`s if possible.

Point at trait(s) that needs to be `impl`emented.

2 years agoAuto merge of #89572 - Manishearth:rollup-obz5ycp, r=Manishearth
bors [Tue, 5 Oct 2021 22:28:40 +0000 (22:28 +0000)]
Auto merge of #89572 - Manishearth:rollup-obz5ycp, r=Manishearth

Rollup of 10 pull requests

Successful merges:

 - #88706 (Normalize associated type projections when checking return type of main)
 - #88828 (Use `libc::sigaction()` instead of `sys::signal()` to prevent a deadlock)
 - #88871 (Fix suggestion for nested struct patterns)
 - #89317 (Move generic error message to separate branches)
 - #89351 (for signed wrapping remainder, do not compare lhs with MIN)
 - #89442 (Add check for duplicated doc aliases)
 - #89502 (Fix Lower/UpperExp formatting for integers and precision zero)
 - #89523 (Make `proc_macro_derive_resolution_fallback` a future-breakage lint)
 - #89532 (Document behavior of  `MaybeLiveLocals` regarding enums and field-senstivity)
 - #89546 (Make an initial guess for metadata size to reduce buffer resizes)

Failed merges:

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

2 years agoRollup merge of #89546 - joshtriplett:grow-metadata-faster, r=petrochenkov
Manish Goregaokar [Tue, 5 Oct 2021 19:52:49 +0000 (12:52 -0700)]
Rollup merge of #89546 - joshtriplett:grow-metadata-faster, r=petrochenkov

Make an initial guess for metadata size to reduce buffer resizes

When reading metadata, the compiler starts with a `Vec::new()`, which will need to grow repeatedly as the metadata gets decompressed into it. Reduce the number of resizes by starting out at the size of the compressed data.

2 years agoRollup merge of #89532 - ecstatic-morse:maybe-live-locals-enum, r=oli-obk,tmiasko
Manish Goregaokar [Tue, 5 Oct 2021 19:52:48 +0000 (12:52 -0700)]
Rollup merge of #89532 - ecstatic-morse:maybe-live-locals-enum, r=oli-obk,tmiasko

Document behavior of  `MaybeLiveLocals` regarding enums and field-senstivity

This arose from a [discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/189540-t-compiler.2Fwg-mir-opt/topic/MaybeLiveLocals.20and.20Discriminants) where a new contributor attempted to implement a dead-store elimination pass using this analysis. They ran into a nasty hack around `SetDiscriminant` the effect of which is to lets handle assignments of literals to enum-typed locals (e.g. `x = Some(4)`) correctly. This took me a while to figure out.

Document this oddity, so the next person will have an easier time, and add a test to enshrine the current behavior.

r? ``@tmiasko``

2 years agoRollup merge of #89523 - Aaron1011:derive-future-compat, r=wesleywiser
Manish Goregaokar [Tue, 5 Oct 2021 19:52:47 +0000 (12:52 -0700)]
Rollup merge of #89523 - Aaron1011:derive-future-compat, r=wesleywiser

Make `proc_macro_derive_resolution_fallback` a future-breakage lint

When `cargo report future-incompatibilities` is stabilized
(see #71249), this will cause dependencies that trigger
this lint to be included in the report.

2 years agoRollup merge of #89502 - FabianWolff:issue-89493, r=joshtriplett
Manish Goregaokar [Tue, 5 Oct 2021 19:52:46 +0000 (12:52 -0700)]
Rollup merge of #89502 - FabianWolff:issue-89493, r=joshtriplett

Fix Lower/UpperExp formatting for integers and precision zero

Fixes the integer part of #89493 (I daren't touch the floating-point formatting code). The issue is that the "subtracted" precision essentially behaves like extra trailing zeros, but this is not currently reflected in the code properly.

2 years agoRollup merge of #89442 - GuillaumeGomez:duplicated-doc-alias, r=estebank
Manish Goregaokar [Tue, 5 Oct 2021 19:52:45 +0000 (12:52 -0700)]
Rollup merge of #89442 - GuillaumeGomez:duplicated-doc-alias, r=estebank

Add check for duplicated doc aliases

r? ``@estebank``

2 years agoRollup merge of #89351 - tspiteri:wrapping_rem, r=dtolnay
Manish Goregaokar [Tue, 5 Oct 2021 19:52:45 +0000 (12:52 -0700)]
Rollup merge of #89351 - tspiteri:wrapping_rem, r=dtolnay

for signed wrapping remainder, do not compare lhs with MIN

Since the wrapped remainder is going to be 0 for all cases when the rhs is -1, there is no need to compare the lhs with MIN.

2 years agoRollup merge of #89317 - JulianKnodt:precise_errors, r=BoxyUwU
Manish Goregaokar [Tue, 5 Oct 2021 19:52:44 +0000 (12:52 -0700)]
Rollup merge of #89317 - JulianKnodt:precise_errors, r=BoxyUwU

Move generic error message to separate branches

This decomposes an error message in generic constants into more specific branches, for better
readability.

r? ``@lcnr``