]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoFix some typos
Yuki Okushi [Sat, 16 Oct 2021 05:04:21 +0000 (14:04 +0900)]
Fix some typos

2 years agorustdoc: use ttf based font for cjk glyphs
Shinwoo Park [Tue, 26 Oct 2021 01:58:13 +0000 (10:58 +0900)]
rustdoc: use ttf based font for cjk glyphs

2 years agoEdit error messages for rustc_resolve::AmbiguityKind variants
pierwill [Wed, 20 Oct 2021 13:56:10 +0000 (08:56 -0500)]
Edit error messages for rustc_resolve::AmbiguityKind variants

Emit description of the ambiguity as a note.

Co-authored-by: Noah Lev <camelidcamel@gmail.com>
Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2 years agoClean up debug statements in needs_drop
Jakob Degen [Tue, 26 Oct 2021 00:45:46 +0000 (20:45 -0400)]
Clean up debug statements in needs_drop

2 years agoAuto merge of #85830 - bjorn3:separate_provide_extern, r=cjgillot
bors [Tue, 26 Oct 2021 00:38:58 +0000 (00:38 +0000)]
Auto merge of #85830 - bjorn3:separate_provide_extern, r=cjgillot

 Avoid a branch on key being local for queries that use the same local and extern providers

Currently based on https://github.com/rust-lang/rust/pull/85810 as it slightly conflicts with it. Only the last two commits are new.

2 years agoFix documentation header sizes
Jacob Hoffman-Andrews [Fri, 22 Oct 2021 20:45:10 +0000 (13:45 -0700)]
Fix documentation header sizes

And add a rustdoc-gui test confirming various header sizes.

2 years agoAdd LLVM CFI support to the Rust compiler
Ramon de C Valle [Thu, 7 Oct 2021 22:33:13 +0000 (15:33 -0700)]
Add LLVM CFI support to the Rust compiler

This commit adds LLVM Control Flow Integrity (CFI) support to the Rust
compiler. It initially provides forward-edge control flow protection for
Rust-compiled code only by aggregating function pointers in groups
identified by their number of arguments.

Forward-edge control flow protection for C or C++ and Rust -compiled
code "mixed binaries" (i.e., for when C or C++ and Rust -compiled code
share the same virtual address space) will be provided in later work as
part of this project by defining and using compatible type identifiers
(see Type metadata in the design document in the tracking issue #89653).

LLVM CFI can be enabled with -Zsanitizer=cfi and requires LTO (i.e.,
-Clto).

2 years agomake thiscall on unsupported platforms an error
DrMeepster [Sun, 24 Oct 2021 18:57:45 +0000 (11:57 -0700)]
make thiscall on unsupported platforms an error

2 years agoAuto merge of #90282 - matthiaskrgr:rollup-c6trbff, r=matthiaskrgr
bors [Mon, 25 Oct 2021 21:33:13 +0000 (21:33 +0000)]
Auto merge of #90282 - matthiaskrgr:rollup-c6trbff, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #89581 (Add -Z no-unique-section-names to reduce ELF header bloat.)
 - #90196 (Fix and extent ControlFlow `traverse_inorder` example)
 - #90255 (:arrow_up: rust-analyzer)
 - #90266 (Prevent duplicate caller bounds candidates by exposing default substs in Unevaluated)

Failed merges:

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

2 years agoRollup merge of #90266 - b-naber:uneval_substs, r=lcnr
Matthias Krüger [Mon, 25 Oct 2021 20:59:49 +0000 (22:59 +0200)]
Rollup merge of #90266 - b-naber:uneval_substs, r=lcnr

Prevent duplicate caller bounds candidates by exposing default substs in Unevaluated

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

The changes introduced in https://github.com/rust-lang/rust/pull/87280 allowed for "duplicate" caller bounds candidates to be assembled that only differed in their default substs having been "exposed" or not and resulted in an ambiguity error during trait selection. To fix this we expose the defaults substs during the creation of the ParamEnv.

r? `@lcnr`

2 years agoRollup merge of #90255 - lnicola:rust-analyzer-2021-10-25, r=lnicola
Matthias Krüger [Mon, 25 Oct 2021 20:59:48 +0000 (22:59 +0200)]
Rollup merge of #90255 - lnicola:rust-analyzer-2021-10-25, r=lnicola

:arrow_up: rust-analyzer

r? ~~``@ghose~~`` sorry, ``@ghost``

2 years agoRollup merge of #90196 - yanok:master, r=scottmcm
Matthias Krüger [Mon, 25 Oct 2021 20:59:47 +0000 (22:59 +0200)]
Rollup merge of #90196 - yanok:master, r=scottmcm

Fix and extent ControlFlow `traverse_inorder` example

Fix and extent ControlFlow `traverse_inorder` example

1. The existing example compiles on its own, but any usage fails to be monomorphised and so doesn't compile. Fix that by using Fn trait instead of FnMut.
2. Added an example usage of `traverse_inorder` showing how we can terminate the traversal early.

Fixes #90063

2 years agoRollup merge of #89581 - jblazquez:master, r=Mark-Simulacrum
Matthias Krüger [Mon, 25 Oct 2021 20:59:46 +0000 (22:59 +0200)]
Rollup merge of #89581 - jblazquez:master, r=Mark-Simulacrum

Add -Z no-unique-section-names to reduce ELF header bloat.

This change adds a new compiler flag that can help reduce the size of ELF binaries that contain many functions.

By default, when enabling function sections (which is the default for most targets), the LLVM backend will generate different section names for each function. For example, a function `func` would generate a section called `.text.func`. Normally this is fine because the linker will merge all those sections into a single one in the binary. However, starting with [LLVM 12](https://github.com/llvm/llvm-project/commit/ee5d1a04), the backend will also generate unique section names for exception handling, resulting in thousands of `.gcc_except_table.*` sections ending up in the final binary because some linkers like LLD don't currently merge or strip these EH sections (see discussion [here](https://reviews.llvm.org/D83655)). This can bloat the ELF headers and string table significantly in binaries that contain many functions.

The new option is analogous to Clang's `-fno-unique-section-names`, and instructs LLVM to generate the same `.text` and `.gcc_except_table` section for each function, resulting in a smaller final binary.

The motivation to add this new option was because we have a binary that ended up with so many ELF sections (over 65,000) that it broke some existing ELF tools, which couldn't handle so many sections.

Here's our old binary:

```
$ readelf --sections old.elf | head -1
There are 71746 section headers, starting at offset 0x2a246508:

$ readelf --sections old.elf | grep shstrtab
  [71742] .shstrtab      STRTAB          0000000000000000 2977204c ad44bb 00      0   0  1
```

That's an 11MB+ string table. Here's the new binary using this option:

```
$ readelf --sections new.elf | head -1
There are 43 section headers, starting at offset 0x29143ca8:

$ readelf --sections new.elf | grep shstrtab
  [40] .shstrtab         STRTAB          0000000000000000 29143acc 0001db 00      0   0  1
```

The whole binary size went down by over 20MB, which is quite significant.

2 years agoAdd BorrowSet to public api
Xavier Denis [Mon, 25 Oct 2021 20:16:07 +0000 (22:16 +0200)]
Add BorrowSet to public api

2 years agofix(rustc_typeck): report function argument errors on matching type
Michael Howell [Fri, 22 Oct 2021 20:49:12 +0000 (13:49 -0700)]
fix(rustc_typeck): report function argument errors on matching type

Fixes #90101

2 years agoAuto merge of #89430 - GuillaumeGomez:rustdoc-clippy-lints, r=jyn514,camelid,notriddle
bors [Mon, 25 Oct 2021 18:24:33 +0000 (18:24 +0000)]
Auto merge of #89430 - GuillaumeGomez:rustdoc-clippy-lints, r=jyn514,camelid,notriddle

Fix clippy lints in librustdoc

I ran clippy on librustdoc and simply fixed the lints. :)

r? `@notriddle`

2 years agorustdoc: use better highlighting for *const, *mut, and &mut
Michael Howell [Mon, 25 Oct 2021 17:43:55 +0000 (10:43 -0700)]
rustdoc: use better highlighting for *const, *mut, and &mut

This generates more consistent HTML for these RefKeyWord combinations.

Before:

![image](https://user-images.githubusercontent.com/1593513/138742752-7e00a3f7-4621-4c62-82d1-3e4c2ef503d1.png)

After:

![image](https://user-images.githubusercontent.com/1593513/138743955-90abcdcd-fc88-4e2f-95bb-c1b1635c0001.png)

2 years agoClean up special function const checks
Gary Guo [Mon, 25 Oct 2021 16:07:16 +0000 (17:07 +0100)]
Clean up special function const checks

Mark them as const and `#[rustc_do_not_const_check]` instead of hard-coding
them in const-eval checks.

2 years agofix: inner attribute followed by outer attribute causing ICE
EliseZeroTwo [Mon, 25 Oct 2021 15:31:27 +0000 (17:31 +0200)]
fix: inner attribute followed by outer attribute causing ICE

2 years agoAuto merge of #90265 - GuillaumeGomez:rollup-gx3ficp, r=GuillaumeGomez
bors [Mon, 25 Oct 2021 14:40:45 +0000 (14:40 +0000)]
Auto merge of #90265 - GuillaumeGomez:rollup-gx3ficp, r=GuillaumeGomez

Rollup of 5 pull requests

Successful merges:

 - #90017 (Add a couple tests for normalize under binder issues)
 - #90079 (enable `i8mm` target feature on aarch64 and arm)
 - #90233 (Tooltip overflow)
 - #90257 (Changed slice.swap documentation for better readability)
 - #90261 (Move back to linux builder on try builds)

Failed merges:

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

2 years agoRollup merge of #90261 - Mark-Simulacrum:fix-try, r=pietroalbini
Guillaume Gomez [Mon, 25 Oct 2021 14:34:55 +0000 (16:34 +0200)]
Rollup merge of #90261 - Mark-Simulacrum:fix-try, r=pietroalbini

Move back to linux builder on try builds

Apparently deleted the wrong line when trying to revert changes to try in #90100 which I now see still contains the do not merge commit -- maybe I forgot to force push the local changes I had pending or something.

r? `@pietroalbini`

2 years agoRollup merge of #90257 - zommiommy:patch-1, r=m-ou-se
Guillaume Gomez [Mon, 25 Oct 2021 14:34:54 +0000 (16:34 +0200)]
Rollup merge of #90257 - zommiommy:patch-1, r=m-ou-se

Changed slice.swap documentation for better readability

The example exchanges the letters "b" and "d", these can be easily confused and are hard to read for people with dyslexia.
Therefore, I changed the example to a more easily readable one.

This is just a small fix and it's not urgent by any means, but I spent 5 minutes trying to understand why I couldn't see any change so I fixed it.

Anyway, thank you for all your works!

2 years agoRollup merge of #90233 - GuillaumeGomez:tooltip-overflow, r=camelid
Guillaume Gomez [Mon, 25 Oct 2021 14:34:53 +0000 (16:34 +0200)]
Rollup merge of #90233 - GuillaumeGomez:tooltip-overflow, r=camelid

Tooltip overflow

Fixes #89185.

r? ``@camelid``

2 years agoRollup merge of #90079 - SparrowLii:i8mm, r=Amanieu
Guillaume Gomez [Mon, 25 Oct 2021 14:34:52 +0000 (16:34 +0200)]
Rollup merge of #90079 - SparrowLii:i8mm, r=Amanieu

enable `i8mm` target feature on aarch64 and arm

As in https://github.com/rust-lang/stdarch/issues/1233, `i8mm` needs to be turned on to support the implementation of `vmmla` and `vusmmla`neon instructions in stdarch.
r? ``@Amanieu``

2 years agoRollup merge of #90017 - jackh726:issue-tests, r=nikomatsakis
Guillaume Gomez [Mon, 25 Oct 2021 14:34:52 +0000 (16:34 +0200)]
Rollup merge of #90017 - jackh726:issue-tests, r=nikomatsakis

Add a couple tests for normalize under binder issues

Closes #56556
Closes #76956

r? ``@nikomatsakis``

2 years agoadd tests
b-naber [Mon, 25 Oct 2021 14:04:23 +0000 (16:04 +0200)]
add tests

2 years agoexpose default substs in param_env
b-naber [Mon, 25 Oct 2021 13:34:59 +0000 (15:34 +0200)]
expose default substs in param_env

2 years agoMove back to linux builder on try builds
Mark Rousskov [Mon, 25 Oct 2021 13:38:04 +0000 (09:38 -0400)]
Move back to linux builder on try builds

2 years agoFix test
bjorn3 [Mon, 25 Oct 2021 13:15:05 +0000 (15:15 +0200)]
Fix test

2 years agoFixed missing double quote in the patch (slice.swap)
Tommaso Fontana [Mon, 25 Oct 2021 12:13:54 +0000 (14:13 +0200)]
Fixed missing double quote in the patch (slice.swap)

2 years agoChanged slice.swap documentation for better readability
Tommaso Fontana [Mon, 25 Oct 2021 11:51:34 +0000 (13:51 +0200)]
Changed slice.swap documentation for better readability

using "b" and "d" can be easily confused

2 years agoAvoid a branch on key being local for queries that use the same local and extern...
bjorn3 [Sun, 30 May 2021 15:24:54 +0000 (17:24 +0200)]
Avoid a branch on key being local for queries that use the same local and extern providers

2 years agoAuto merge of #90042 - pietroalbini:1.56-master, r=Mark-Simulacrum
bors [Mon, 25 Oct 2021 11:31:47 +0000 (11:31 +0000)]
Auto merge of #90042 - pietroalbini:1.56-master, r=Mark-Simulacrum

Bump bootstrap compiler to 1.57

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

r? `@Mark-Simulacrum`

2 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Mon, 25 Oct 2021 10:30:24 +0000 (13:30 +0300)]
:arrow_up: rust-analyzer

2 years agoFix scrollbars appearing on information tooltip on mac when they shouldn't
Guillaume Gomez [Sun, 24 Oct 2021 13:28:58 +0000 (15:28 +0200)]
Fix scrollbars appearing on information tooltip on mac when they shouldn't

2 years agoFix clippy lints in librustdoc
Guillaume Gomez [Fri, 1 Oct 2021 15:12:39 +0000 (17:12 +0200)]
Fix clippy lints in librustdoc

2 years agoAuto merge of #90249 - matthiaskrgr:rollup-xwtfhq3, r=matthiaskrgr
bors [Mon, 25 Oct 2021 08:22:07 +0000 (08:22 +0000)]
Auto merge of #90249 - matthiaskrgr:rollup-xwtfhq3, r=matthiaskrgr

Rollup of 4 pull requests

Successful merges:

 - #89889 (Use the "nice E0277 errors"[1] for `!Send` `impl Future` from foreign crate)
 - #90127 (Do not mention a reexported item if it's private)
 - #90143 (tidy: Remove submodules from edition exception list)
 - #90238 (Add alias for guillaume.gomez@huawei.com)

Failed merges:

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

2 years agoenable `i8mm` on arm
SparrowLii [Mon, 25 Oct 2021 07:10:14 +0000 (15:10 +0800)]
enable `i8mm` on arm

2 years agoenable `i8mm` target feature on aarch64
SparrowLii [Wed, 20 Oct 2021 02:19:23 +0000 (10:19 +0800)]
enable `i8mm` target feature on aarch64

2 years agoRollup merge of #90238 - GuillaumeGomez:mailmap-alias, r=Mark-Simulacrum
Matthias Krüger [Mon, 25 Oct 2021 05:54:16 +0000 (07:54 +0200)]
Rollup merge of #90238 - GuillaumeGomez:mailmap-alias, r=Mark-Simulacrum

Add alias for guillaume.gomez@huawei.com

Hopefully it'll stop making me appear twice in the thanks page. :)

2 years agoRollup merge of #90143 - camelid:tidy-2021-followup, r=Mark-Simulacrum
Matthias Krüger [Mon, 25 Oct 2021 05:54:15 +0000 (07:54 +0200)]
Rollup merge of #90143 - camelid:tidy-2021-followup, r=Mark-Simulacrum

tidy: Remove submodules from edition exception list

Both style-check and date-check are now on the 2021 edition, and this
PR also updates their repositories' submodules.

cc rust-lang/rustc-dev-guide#1238
cc rust-lang/reference#1099
cc https://github.com/rust-lang/rust/pull/89103#discussion_r711783714

2 years agoRollup merge of #90127 - JohnTitor:fix-90113, r=estebank
Matthias Krüger [Mon, 25 Oct 2021 05:54:13 +0000 (07:54 +0200)]
Rollup merge of #90127 - JohnTitor:fix-90113, r=estebank

Do not mention a reexported item if it's private

Fixes #90113
The _actual_ regression was introduced in #73652, then #88838 made it worse. This fixes the issue by not counting such an import as a candidate.

2 years agoRollup merge of #89889 - estebank:unmet-send-bound-on-foreign-future, r=tmandry
Matthias Krüger [Mon, 25 Oct 2021 05:54:12 +0000 (07:54 +0200)]
Rollup merge of #89889 - estebank:unmet-send-bound-on-foreign-future, r=tmandry

Use the "nice E0277 errors"[1] for `!Send` `impl Future` from foreign crate

Partly address #78543 by making the error quieter.

We don't have access to the `typeck` tables from foreign crates, so we
used to completely skip the new code when checking foreign crates. Now,
we carry on and don't provide as nice output (we don't clarify *what* is
making the `Future: !Send`), but at least we no longer emit a sea of
derived obligations in the output.

[1]: https://blog.rust-lang.org/inside-rust/2019/10/11/AsyncAwait-Not-Send-Error-Improvements.html

r? `@tmandry`

2 years agoAuto merge of #89808 - tmiasko:llvm-multithreaded, r=nagisa
bors [Mon, 25 Oct 2021 05:28:07 +0000 (05:28 +0000)]
Auto merge of #89808 - tmiasko:llvm-multithreaded, r=nagisa

Cleanup LLVM multi-threading checks

The support for runtime multi-threading was removed from LLVM. Calls to
`LLVMStartMultithreaded` became no-ops equivalent to checking if LLVM
was compiled with support for threads http://reviews.llvm.org/D4216.

2 years agoAuto merge of #90210 - cjgillot:qarray2, r=Mark-Simulacrum
bors [Mon, 25 Oct 2021 01:10:50 +0000 (01:10 +0000)]
Auto merge of #90210 - cjgillot:qarray2, r=Mark-Simulacrum

Build the query vtable directly.

Continuation of https://github.com/rust-lang/rust/pull/89978.

This shrinks the query interface and attempts to reduce the amount of function pointer calls.

2 years agoAuto merge of #89427 - estebank:collect-overlapping-impls, r=jackh726
bors [Sun, 24 Oct 2021 22:26:41 +0000 (22:26 +0000)]
Auto merge of #89427 - estebank:collect-overlapping-impls, r=jackh726

Point at overlapping impls when type annotations are needed

Address https://github.com/rust-lang/rust/issues/89254.

2 years agotidy: Remove submodules from edition exception list
Noah Lev [Sun, 24 Oct 2021 20:27:13 +0000 (13:27 -0700)]
tidy: Remove submodules from edition exception list

Both style-check and date-check are now on the 2021 edition, and this
commit also updates their repositories' submodules.

2 years agoUse the "nice E0277 errors"[1] for `!Send` `impl Future` from foreign crate
Esteban Kuber [Thu, 14 Oct 2021 17:57:39 +0000 (17:57 +0000)]
Use the "nice E0277 errors"[1] for `!Send` `impl Future` from foreign crate

Partly address #78543 by making the error quieter.

We don't have access to the `typeck` tables from foreign crates, so we
used to completely skip the new code when checking foreign crates. Now,
we carry on and don't provide as nice output (we don't clarify *what* is
making the `Future: !Send`), but at least we no longer emit a sea of
derived obligations in the output.

[1]: https://blog.rust-lang.org/inside-rust/2019/10/11/AsyncAwait-Not-Send-Error-Improvements.html

2 years agoAlways sort suggestions before emitting them
Esteban Kuber [Fri, 1 Oct 2021 18:09:31 +0000 (18:09 +0000)]
Always sort suggestions before emitting them

2 years agoPoint at overlapping impls when type annotations are needed
Esteban Kuber [Fri, 1 Oct 2021 13:05:17 +0000 (13:05 +0000)]
Point at overlapping impls when type annotations are needed

2 years agoFix and extend ControlFlow `traverse_inorder` example
Ilya Yanok [Sat, 23 Oct 2021 09:40:46 +0000 (11:40 +0200)]
Fix and extend ControlFlow `traverse_inorder` example

1. The existing example compiles on its own, but any usage fails
   to be monomorphised and so doesn't compile. Fix that by using
   a mutable reference as an input argument.
2. Added an example usage of `traverse_inorder` showing how we
   can terminate the traversal early.

Fixes #90063

2 years agoAdd alias for guillaume.gomez@huawei.com
Guillaume Gomez [Sun, 24 Oct 2021 17:55:04 +0000 (19:55 +0200)]
Add alias for guillaume.gomez@huawei.com

2 years agoAuto merge of #90235 - matthiaskrgr:rollup-7pqtevk, r=matthiaskrgr
bors [Sun, 24 Oct 2021 14:12:10 +0000 (14:12 +0000)]
Auto merge of #90235 - matthiaskrgr:rollup-7pqtevk, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #89558 (Add rustc lint, warning when iterating over hashmaps)
 - #90100 (Skip documentation for tier 2 targets on dist-x86_64-apple-darwin)
 - #90155 (Fix alignment of method headings for scannability)
 - #90162 (Mark `{array, slice}::{from_ref, from_mut}` as const fn)
 - #90221 (Fix ICE when forgetting to `Box` a parameter to a `Self::func` call)
 - #90234 (Temporarily turn overflow checks off for rustc-rayon-core)

Failed merges:

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

2 years agoRollup merge of #90234 - rusticstuff:rustc-rayon-core-no-overflow-checks, r=Mark...
Matthias Krüger [Sun, 24 Oct 2021 13:48:46 +0000 (15:48 +0200)]
Rollup merge of #90234 - rusticstuff:rustc-rayon-core-no-overflow-checks, r=Mark-Simulacrum

Temporarily turn overflow checks off for rustc-rayon-core

The rustc fork of Rayon has deadlock detection code which intermittently causes overflows in the CI (see https://github.com/rust-lang/rust/issues/90227). So, as a workaround, we unconditionally turn overflow checks off for this crate only.

This workaround should be removed once #90227 is fixed.

r? `@Mark-Simulacrum`

cc `@matthiaskrgr`

2 years agoRollup merge of #90221 - JakobDegen:issue-90213, r=cjgillot
Matthias Krüger [Sun, 24 Oct 2021 13:48:45 +0000 (15:48 +0200)]
Rollup merge of #90221 - JakobDegen:issue-90213, r=cjgillot

Fix ICE when forgetting to `Box` a parameter to a `Self::func` call

Closes #90213 .

Assuming we can get the `DefId` of the receiver causes an ICE if the receiver is `Self`. We can just avoid doing this though.

2 years agoRollup merge of #90162 - WaffleLapkin:const_array_slice_from_ref_mut, r=oli-obk
Matthias Krüger [Sun, 24 Oct 2021 13:48:44 +0000 (15:48 +0200)]
Rollup merge of #90162 - WaffleLapkin:const_array_slice_from_ref_mut, r=oli-obk

Mark `{array, slice}::{from_ref, from_mut}` as const fn

This PR marks the following APIs as `const`:
```rust
// core::array
pub const fn from_ref<T>(s: &T) -> &[T; 1];
pub const fn from_mut<T>(s: &mut T) -> &mut [T; 1];

// core::slice
pub const fn from_ref<T>(s: &T) -> &[T];
pub const fn from_mut<T>(s: &mut T) -> &mut [T];
```

Note that `from_ref` methods require `const_raw_ptr_deref` feature (which seems totally fine, since it's being stabilized, see #89551), `from_mut` methods require `const_mut_refs` (which seems fine too since this PR marks `from_mut` functions as const unstable).

r? ````@oli-obk````

2 years agoRollup merge of #90155 - jsha:outdent-methods, r=GuillaumeGomez,camelid
Matthias Krüger [Sun, 24 Oct 2021 13:48:44 +0000 (15:48 +0200)]
Rollup merge of #90155 - jsha:outdent-methods, r=GuillaumeGomez,camelid

Fix alignment of method headings for scannability

We sometimes use indentation to indicate something is a heading: The section that comes after is indented by 24px relative to the heading. However, the relationship between the "Implementations" section heading, the `impl` headings it contains, and the `pub fn` subheadings within each impl, is awkward. It goes **Implementations**, 15px indent, `impl`, 5px indent, `pub fn`, 4px indent, docblock.

I line up `impl` and `pub fn` with the `Implementations` heading, give `impl` a larger font size to indicate it is higher in the hierarchy, and indent the docblock a full 24px relative to their parent, matching the indents we use elsewhere to distinguish section headings. By letting the `pub fn` stick out to the left of the docblock, I think this makes methods significantly more scannable.

Related to #59829

r? `````@camelid`````

[Old](https://doc.rust-lang.org/nightly/std/string/struct.String.html#implementations):

[![image](https://user-images.githubusercontent.com/220205/138380233-9c63a0f2-0f80-40a3-ab3d-a1ee9fb7c5d8.png)](https://doc.rust-lang.org/nightly/std/string/struct.String.html#implementations)

[New](https://jacob.hoffman-andrews.com/rust/outdent-methods/std/string/struct.String.html#implementations):

[![image](https://user-images.githubusercontent.com/220205/138392479-b45fce3f-bf43-42e0-81ee-c4bb9ac35cda.png)](https://jacob.hoffman-andrews.com/rust/outdent-methods/std/string/struct.String.html#implementations)

2 years agoRollup merge of #90100 - Mark-Simulacrum:speed-macos-ci, r=pietroalbini
Matthias Krüger [Sun, 24 Oct 2021 13:48:43 +0000 (15:48 +0200)]
Rollup merge of #90100 - Mark-Simulacrum:speed-macos-ci, r=pietroalbini

Skip documentation for tier 2 targets on dist-x86_64-apple-darwin

I don't have an easy way to test this locally, but I believe it should work. Based on one log result should shave ~14 minutes off the dist-x86_64-apple builder (doesn't help with aarch64 dist or x86_64 test builder, so not actually decreasing total CI time most likely).

r? ```@pietroalbini```

2 years agoRollup merge of #89558 - lcnr:query-stable-lint, r=estebank
Matthias Krüger [Sun, 24 Oct 2021 13:48:42 +0000 (15:48 +0200)]
Rollup merge of #89558 - lcnr:query-stable-lint, r=estebank

Add rustc lint, warning when iterating over hashmaps

r? rust-lang/wg-incr-comp

2 years agoTemporarily turn overflow checks off for rustc-rayon-core
Hans Kratz [Sun, 24 Oct 2021 13:36:45 +0000 (15:36 +0200)]
Temporarily turn overflow checks off for rustc-rayon-core

2 years agoAuto merge of #85254 - cjgillot:reveal-mir, r=lcnr
bors [Sun, 24 Oct 2021 11:04:54 +0000 (11:04 +0000)]
Auto merge of #85254 - cjgillot:reveal-mir, r=lcnr

Normalize MIR with RevealAll before optimizations.

Fixes #78442

2 years agoAuto merge of #90208 - Mark-Simulacrum:hash-bytes-fast, r=oli-obk
bors [Sun, 24 Oct 2021 06:29:41 +0000 (06:29 +0000)]
Auto merge of #90208 - Mark-Simulacrum:hash-bytes-fast, r=oli-obk

Specialize HashStable for [u8] slices

Particularly for ctfe-stress-4, the hashing of byte slices as part of the
MIR Allocation is quite hot. Previously, we were falling back on byte-by-byte
copying of the slice into the SipHash buffer (64 bytes long) before hashing a 64
byte chunk, and then doing that again and again; now we use the dedicated byte-slice write.

2 years agoFix ICE when forgetting to `Box` a parameter to a `Self::func` call
Jakob Degen [Sun, 24 Oct 2021 04:33:29 +0000 (00:33 -0400)]
Fix ICE when forgetting to `Box` a parameter to a `Self::func` call

2 years agoAdd regresstion test for #90024.
Jakob Degen [Sun, 24 Oct 2021 02:36:50 +0000 (22:36 -0400)]
Add regresstion test for #90024.

Uses 2 MCVEs from the issue tracker that test opposite sides of the problem.

2 years agoIgnore errors re: unreachable blocks in dataflow cursor unit tests
Dylan MacKenzie [Fri, 22 Oct 2021 22:47:36 +0000 (15:47 -0700)]
Ignore errors re: unreachable blocks in dataflow cursor unit tests

2 years agoremove "field is never read" warning
Pietro Albini [Tue, 19 Oct 2021 07:29:19 +0000 (09:29 +0200)]
remove "field is never read" warning

2 years agoupdate cfg(bootstrap)
Pietro Albini [Tue, 19 Oct 2021 07:27:59 +0000 (09:27 +0200)]
update cfg(bootstrap)

2 years agobump boostrap compiler
Pietro Albini [Tue, 19 Oct 2021 07:27:49 +0000 (09:27 +0200)]
bump boostrap compiler

2 years agoAuto merge of #89776 - rusticstuff:ci-overflow-checks, r=Mark-Simulacrum
bors [Sun, 24 Oct 2021 01:21:48 +0000 (01:21 +0000)]
Auto merge of #89776 - rusticstuff:ci-overflow-checks, r=Mark-Simulacrum

CI: Enable overflow checks for test (non-dist) builds

They stay disabled for Apple builds though, which take the most time already due to running on slow hw.

2 years agoAuto merge of #90175 - cuviper:min-llvm-12, r=nagisa
bors [Sat, 23 Oct 2021 20:59:29 +0000 (20:59 +0000)]
Auto merge of #90175 - cuviper:min-llvm-12, r=nagisa

Update the minimum external LLVM to 12

With this change, we'll have stable support for LLVM 12 and 13.
For reference, the previous increase to LLVM 10 was #83387,
and this replaces the pending increase to LLVM 11 in #90062.

r? `@nagisa` `@nikic`

2 years agoAdd tests for `const_slice_from_ref` and `const_array_from_ref`
Maybe Waffle [Sat, 23 Oct 2021 19:51:22 +0000 (22:51 +0300)]
Add tests for `const_slice_from_ref` and `const_array_from_ref`

2 years agoFix typo
Chris Denton [Sat, 23 Oct 2021 19:04:45 +0000 (20:04 +0100)]
Fix typo

Co-authored-by: Ruslan Sayfutdinov <ruslan@sayfutdinov.com>
2 years agoOutdent method headings so they stand out
Jacob Hoffman-Andrews [Fri, 22 Oct 2021 01:46:47 +0000 (18:46 -0700)]
Outdent method headings so they stand out

The makes the heading / documentation distinction clearer.

2 years agoMake sure `CreateDirectoryW` works for path lengths > 247
Chris Denton [Sat, 23 Oct 2021 18:34:09 +0000 (19:34 +0100)]
Make sure `CreateDirectoryW` works for path lengths > 247

2 years agoFill tracking issue for `const_slice_from_ref` and `const_array_from_ref`
Maybe Waffle [Sat, 23 Oct 2021 17:59:15 +0000 (20:59 +0300)]
Fill tracking issue for `const_slice_from_ref` and `const_array_from_ref`

2 years agobless the line changes in ui/asm/aarch64/srcloc.rs
Josh Stone [Sat, 23 Oct 2021 17:16:09 +0000 (10:16 -0700)]
bless the line changes in ui/asm/aarch64/srcloc.rs

2 years agoDo not require QueryCtxt for cache_on_disk.
Camille GILLOT [Sat, 23 Oct 2021 16:12:43 +0000 (18:12 +0200)]
Do not require QueryCtxt for cache_on_disk.

2 years agoSpecialize HashStable for [u8] slices
Mark Rousskov [Sat, 23 Oct 2021 16:11:05 +0000 (12:11 -0400)]
Specialize HashStable for [u8] slices

Particularly for ctfe-stress-4, the hashing of byte slices as part of the
MIR Allocation is quite hot. Previously, we were falling back on byte-by-byte
copying of the slice into the SipHash buffer (64 bytes long) before hashing a 64
byte chunk, and then doing that again and again.

This should hopefully be an improvement for that code.

2 years agoAuto merge of #90203 - matthiaskrgr:rollup-v215wew, r=matthiaskrgr
bors [Sat, 23 Oct 2021 15:53:50 +0000 (15:53 +0000)]
Auto merge of #90203 - matthiaskrgr:rollup-v215wew, r=matthiaskrgr

Rollup of 5 pull requests

Successful merges:

 - #85833 (Scrape code examples from examples/ directory for Rustdoc)
 - #88041 (Make all proc-macro back-compat lints deny-by-default)
 - #89829 (Consider types appearing in const expressions to be invariant)
 - #90168 (Reset qualifs when a storage of a local ends)
 - #90198 (Add caveat about changing parallelism and function call overhead)

Failed merges:

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

2 years agoBuild the query vtable directly.
Camille GILLOT [Sun, 17 Oct 2021 15:37:20 +0000 (17:37 +0200)]
Build the query vtable directly.

2 years agoRollup merge of #90198 - the8472:available-parallelism-runtime, r=joshtriplett
Matthias Krüger [Sat, 23 Oct 2021 12:58:43 +0000 (14:58 +0200)]
Rollup merge of #90198 - the8472:available-parallelism-runtime, r=joshtriplett

Add caveat about changing parallelism and function call overhead

As discussed in https://github.com/rust-lang/rust/pull/89670#discussion_r728179584

r? ``@joshtriplett``

2 years agoRollup merge of #90168 - tmiasko:const-qualif-storage, r=matthewjasper
Matthias Krüger [Sat, 23 Oct 2021 12:58:42 +0000 (14:58 +0200)]
Rollup merge of #90168 - tmiasko:const-qualif-storage, r=matthewjasper

Reset qualifs when a storage of a local ends

Reset qualifs when a storage of a local ends to ensure that the local qualifs
are affected by the state from previous loop iterations only if the local is
kept alive.

The change should be forward compatible with a stricter handling of indirect
assignments, since storage dead invalidates all existing pointers to the local.

2 years agoRollup merge of #89829 - voidc:assoc-const-variance, r=lcnr
Matthias Krüger [Sat, 23 Oct 2021 12:58:41 +0000 (14:58 +0200)]
Rollup merge of #89829 - voidc:assoc-const-variance, r=lcnr

Consider types appearing in const expressions to be invariant

This is an approach to fix #80977.
Currently, a type parameter which is only used in a constant expression is considered bivariant and will trigger error E0392 *"parameter T is never used"*.
Here is a short example:

```rust
pub trait Foo {
    const N: usize;
}

struct Bar<T: Foo>([u8; T::N])
where [(); T::N]:;
```
([playgound](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2015&gist=b51a272853f75925e72efc1597478aa5))

While it is possible to silence this error by adding a `PhantomData<T>` field, I think the better solution would be to make `T` invariant.
This would be analogous to the invariance constraints added for associated types.
However, I'm quite new to the compiler and unsure whether this is the right approach.

r? ``@varkor`` (since you authored #60058)

2 years agoRollup merge of #88041 - Aaron1011:deny-proc-macro-hack, r=wesleywiser
Matthias Krüger [Sat, 23 Oct 2021 12:58:40 +0000 (14:58 +0200)]
Rollup merge of #88041 - Aaron1011:deny-proc-macro-hack, r=wesleywiser

Make all proc-macro back-compat lints deny-by-default

The affected crates have had plenty of time to update.
By keeping these as lints rather than making them hard errors,
we ensure that downstream crates will still be able to compile,
even if they transitive depend on broken versions of the affected
crates.

This should hopefully discourage anyone from writing any
new code which relies on the backwards-compatibility behavior.

2 years agoRollup merge of #85833 - willcrichton:example-analyzer, r=jyn514
Matthias Krüger [Sat, 23 Oct 2021 12:58:39 +0000 (14:58 +0200)]
Rollup merge of #85833 - willcrichton:example-analyzer, r=jyn514

Scrape code examples from examples/ directory for Rustdoc

Adds support for the functionality described in https://github.com/rust-lang/rfcs/pull/3123

Matching changes to Cargo are here: https://github.com/rust-lang/cargo/pull/9525

Live demo here: https://willcrichton.net/example-analyzer/warp/trait.Filter.html#method.and

2 years agoAuto merge of #90104 - spastorino:coherence-for-negative-trait, r=nikomatsakis
bors [Sat, 23 Oct 2021 12:51:15 +0000 (12:51 +0000)]
Auto merge of #90104 - spastorino:coherence-for-negative-trait, r=nikomatsakis

Implement coherence checks for negative trait impls

The main purpose of this PR is to be able to [move Error trait to core](https://github.com/rust-lang/project-error-handling/issues/3).

This feature is necessary to handle the following from impl on box.

```rust
impl From<&str> for Box<dyn Error> { ... }
```

Without having negative traits affect coherence moving the error trait into `core` and moving that `From` impl to `alloc` will cause the from impl to no longer compiler because of a potential future incompatibility. The compiler indicates that `&str` _could_ introduce an `Error` impl in the future, and thus prevents the `From` impl in `alloc` that would cause overlap with `From<E: Error> for Box<dyn Error>`. Adding `impl !Error for &str {}` with the negative trait coherence feature will disable this error by encoding a stability guarantee that `&str` will never implement `Error`, making the `From` impl compile.

We would have this in `alloc`:

```rust
impl From<&str> for Box<dyn Error> {} // A
impl<E> From<E> for Box<dyn Error> where E: Error {} // B
```

and this in `core`:

```rust
trait Error {}
impl !Error for &str {}
```

r? `@nikomatsakis`

This PR was built on top of `@yaahc` PR #85764.

Language team proposal: to https://github.com/rust-lang/lang-team/issues/96

2 years agoAvoid code duplication by extracting checks into fns
Santiago Pastorino [Sat, 23 Oct 2021 03:03:33 +0000 (00:03 -0300)]
Avoid code duplication by extracting checks into fns

2 years agoAdd caveat about changing parallelism and function call overhead
The8472 [Sat, 23 Oct 2021 11:01:07 +0000 (13:01 +0200)]
Add caveat about changing parallelism and function call overhead

2 years agoFixes incorrect handling of ADT's drop requirements
Jakob Degen [Sat, 23 Oct 2021 10:47:17 +0000 (06:47 -0400)]
Fixes incorrect handling of ADT's drop requirements

See https://github.com/rust-lang/rust/issues/90024#issuecomment-950105433

2 years agoUpdate control_flow.rs
Ilya Yanok [Sat, 23 Oct 2021 09:40:46 +0000 (11:40 +0200)]
Update control_flow.rs

Fix and extent ControlFlow `traverse_inorder` example

1. The existing example compiles on its own, but any usage fails to be monomorphised and so doesn't compile. Fix that by using Fn trait instead of FnMut.
2. Added an example usage of `traverse_inorder` showing how we can terminate the traversal early.

Fixes #90063

2 years agoAuto merge of #90065 - cjgillot:novalcache, r=Mark-Simulacrum
bors [Sat, 23 Oct 2021 09:21:45 +0000 (09:21 +0000)]
Auto merge of #90065 - cjgillot:novalcache, r=Mark-Simulacrum

Do not depend on the stored value when trying to cache on disk.

Having different criteria for loading and saving of query results can lead to saved results that may never be loaded.
Since the on-disk cache is discarded as soon as a compilation error is issued, there should not be any need for an exclusion mecanism based on errors.

As a result, the possibility to condition the storage on the value itself does not appear useful.

2 years agoReset qualifs when a storage of a local ends
Tomasz Miąsko [Fri, 22 Oct 2021 00:00:00 +0000 (00:00 +0000)]
Reset qualifs when a storage of a local ends

to ensure that the local qualifs are affected by the state from previous
loop iterations only if the local is kept alive.

The change should be forward compatible with a stricter handling of
indirect assignments, since storage dead invalidates all existing
pointers to the local.

2 years agoAuto merge of #90188 - matthiaskrgr:rollup-74cwv5c, r=matthiaskrgr
bors [Sat, 23 Oct 2021 06:13:18 +0000 (06:13 +0000)]
Auto merge of #90188 - matthiaskrgr:rollup-74cwv5c, r=matthiaskrgr

Rollup of 11 pull requests

Successful merges:

 - #83233 (Implement split_array and split_array_mut)
 - #88300 (Stabilise unix_process_wait_more, extra ExitStatusExt methods)
 - #89416 (nice_region_error: Include lifetime placeholders in error output)
 - #89468 (Report fatal lexer errors in `--cfg` command line arguments)
 - #89730 (add feature flag for `type_changing_struct_update`)
 - #89920 (Implement -Z location-detail flag)
 - #90070 (Add edition configuration to compiletest)
 - #90087 (Sync rustfmt subtree)
 - #90117 (Make RSplit<T, P>: Clone not require T: Clone)
 - #90122 (CI: make docker cache download and `docker load` time out after 10 minutes)
 - #90166 (Add comment documenting why we can't use a simpler solution)

Failed merges:

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

2 years agoRollup merge of #90166 - smmalis37:patch-1, r=joshtriplett
Matthias Krüger [Sat, 23 Oct 2021 03:28:28 +0000 (05:28 +0200)]
Rollup merge of #90166 - smmalis37:patch-1, r=joshtriplett

Add comment documenting why we can't use a simpler solution

See #90144 for context.

r? ```@joshtriplett```

2 years agoRollup merge of #90122 - rusticstuff:ci_curl_max_time, r=Mark-Simulacrum
Matthias Krüger [Sat, 23 Oct 2021 03:28:27 +0000 (05:28 +0200)]
Rollup merge of #90122 - rusticstuff:ci_curl_max_time, r=Mark-Simulacrum

CI: make docker cache download and `docker load` time out after 10 minutes

Might help to prevent timeouts we have been seeing:
* https://github.com/rust-lang-ci/rust/runs/3946294286?check_suite_focus=true#step:25:23
* https://github.com/rust-lang-ci/rust/runs/3956799200?check_suite_focus=true#step:25:22
* https://github.com/rust-lang-ci/rust/runs/3962928502?check_suite_focus=true#step:25:23
* https://github.com/rust-lang-ci/rust/runs/3967892291?check_suite_focus=true
* https://github.com/rust-lang-ci/rust/runs/3971202204?check_suite_focus=true

If the download or loading the images into docker times out the CI will still continue and rebuild the docker image from scratch.

2 years agoRollup merge of #90117 - calebsander:fix/rsplit-clone, r=yaahc
Matthias Krüger [Sat, 23 Oct 2021 03:28:26 +0000 (05:28 +0200)]
Rollup merge of #90117 - calebsander:fix/rsplit-clone, r=yaahc

Make RSplit<T, P>: Clone not require T: Clone

This addresses a TODO comment. The behavior of `#[derive(Clone)]` *does* result in a `T: Clone` requirement. Playground example:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=a8b1a9581ff8893baf401d624a53d35b

Add a manual `Clone` implementation, mirroring `Split` and `SplitInclusive`.
`(R)?SplitN(Mut)?` don't have any `Clone` implementations, but I'll leave that for its own pull request.

2 years agoRollup merge of #90087 - calebcartwright:rustfmt-subtree, r=calebcartwright
Matthias Krüger [Sat, 23 Oct 2021 03:28:25 +0000 (05:28 +0200)]
Rollup merge of #90087 - calebcartwright:rustfmt-subtree, r=calebcartwright

Sync rustfmt subtree

There's a large number of small fixes and new features, but nothing too big. Detailed changelog for those interested can be found in https://github.com/rust-lang/rustfmt/blob/master/CHANGELOG.md#1438-2021-10-20

2 years agoRollup merge of #90070 - llogiq:compiletest-config-edition, r=Mark-Simulacrum
Matthias Krüger [Sat, 23 Oct 2021 03:28:24 +0000 (05:28 +0200)]
Rollup merge of #90070 - llogiq:compiletest-config-edition, r=Mark-Simulacrum

Add edition configuration to compiletest

This allows the compiletest configuration to set a default edition that can still be overridden with header annotations. Doing this will make it far easier for clippy to get our tests to the newest edition.

r? ```@Manishearth```

2 years agoRollup merge of #89920 - hudson-ayers:location-detail-control, r=davidtwco
Matthias Krüger [Sat, 23 Oct 2021 03:28:23 +0000 (05:28 +0200)]
Rollup merge of #89920 - hudson-ayers:location-detail-control, r=davidtwco

Implement -Z location-detail flag

This PR implements the `-Z location-detail` flag as described in https://github.com/rust-lang/rfcs/pull/2091 .

`-Z location-detail=val` controls what location details are tracked when using `caller_location`. This allows users to control what location details are printed as part of panic messages, by allowing them to exclude any combination of filenames, line numbers, and column numbers. This option is intended to provide users with a way to mitigate the size impact of `#[track_caller]`.

Some measurements of the savings of this approach on an embedded binary can be found here: https://github.com/rust-lang/rust/issues/70579#issuecomment-942556822 .

Closes #70580 (unless people want to leave that open as a place for discussion of further improvements).

This is my first real PR to rust, so any help correcting mistakes / understanding side effects / improving my tests is appreciated :)

I have one question: RFC 2091 specified this as a debugging option (I think that is what -Z implies?). Does that mean this can never be stabilized without a separate MCP? If so, do I need to submit an MCP now, or is the initial RFC specifying this option sufficient for this to be merged as is, and then an MCP would be needed for eventual stabilization?

2 years agoRollup merge of #89730 - crlf0710:type_changing_feature, r=jackh726
Matthias Krüger [Sat, 23 Oct 2021 03:28:22 +0000 (05:28 +0200)]
Rollup merge of #89730 - crlf0710:type_changing_feature, r=jackh726

add feature flag for `type_changing_struct_update`

This implements the PR0 part of the mentoring notes within #86618.

overrides the previous inactive #86646 pr.

r? ```@nikomatsakis```