Commit graph

157146 commits

Author SHA1 Message Date
Matthias Krüger
d35ecb949e
Rollup merge of #90255 - lnicola:rust-analyzer-2021-10-25, r=lnicola
⬆️ rust-analyzer

r? ~~``@ghose~~`` sorry, ``@ghost``
2021-10-25 22:59:48 +02:00
Matthias Krüger
14931b94a2
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
2021-10-25 22:59:47 +02:00
Matthias Krüger
2f67647606
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.
2021-10-25 22:59:46 +02:00
Xavier Denis
9894a9a716 Add BorrowSet to public api 2021-10-25 22:16:07 +02:00
Michael Howell
8520105464 fix(rustc_typeck): report function argument errors on matching type
Fixes #90101
2021-10-25 12:23:52 -07:00
bors
29b1248025 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`
2021-10-25 18:24:33 +00:00
Michael Howell
3a79370367 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)
2021-10-25 11:13:43 -07:00
Gary Guo
cc4345a1c5 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.
2021-10-25 17:32:01 +01:00
EliseZeroTwo
7402eb001b
fix: inner attribute followed by outer attribute causing ICE 2021-10-25 17:31:27 +02:00
bors
84c2a8505d 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
2021-10-25 14:40:45 +00:00
Guillaume Gomez
21af58173f
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`
2021-10-25 16:34:55 +02:00
Guillaume Gomez
3697624e01
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!
2021-10-25 16:34:54 +02:00
Guillaume Gomez
6c0dcb41bd
Rollup merge of #90233 - GuillaumeGomez:tooltip-overflow, r=camelid
Tooltip overflow

Fixes #89185.

r? ``@camelid``
2021-10-25 16:34:53 +02:00
Guillaume Gomez
bd48b9975a
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``
2021-10-25 16:34:52 +02:00
Guillaume Gomez
2d85c7eea0
Rollup merge of #90017 - jackh726:issue-tests, r=nikomatsakis
Add a couple tests for normalize under binder issues

Closes #56556
Closes #76956

r? ``@nikomatsakis``
2021-10-25 16:34:52 +02:00
b-naber
0199a81304 add tests 2021-10-25 16:05:03 +02:00
b-naber
c6b69017e2 expose default substs in param_env 2021-10-25 16:04:57 +02:00
Mark Rousskov
00bca4e957 Move back to linux builder on try builds 2021-10-25 09:38:24 -04:00
bjorn3
13abc1ae30 Fix test 2021-10-25 15:15:05 +02:00
Tommaso Fontana
9b28ab40ac
Fixed missing double quote in the patch (slice.swap) 2021-10-25 14:13:54 +02:00
Tommaso Fontana
32a3edb153
Changed slice.swap documentation for better readability
using "b" and "d" can be easily confused
2021-10-25 13:51:34 +02:00
bjorn3
f5c3e83013 Avoid a branch on key being local for queries that use the same local and extern providers 2021-10-25 13:36:23 +02:00
bors
235d9853d8 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`
2021-10-25 11:31:47 +00:00
Laurențiu Nicola
25a82fdb32 ⬆️ rust-analyzer 2021-10-25 13:30:24 +03:00
Guillaume Gomez
345519baa7 Fix scrollbars appearing on information tooltip on mac when they shouldn't 2021-10-25 11:40:13 +02:00
Guillaume Gomez
4614ca4541 Fix clippy lints in librustdoc 2021-10-25 11:30:09 +02:00
bors
32f3887b9b 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
2021-10-25 08:22:07 +00:00
SparrowLii
b88fcc1ea3 enable i8mm on arm 2021-10-25 15:10:14 +08:00
SparrowLii
14007eca0a enable i8mm target feature on aarch64 2021-10-25 14:18:42 +08:00
Matthias Krüger
34dcfd357d
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. :)
2021-10-25 07:54:16 +02:00
Matthias Krüger
915822496d
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
2021-10-25 07:54:15 +02:00
Matthias Krüger
c734a9e076
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.
2021-10-25 07:54:13 +02:00
Matthias Krüger
b25172b504
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`
2021-10-25 07:54:12 +02:00
bors
56694b0453 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.
2021-10-25 05:28:07 +00:00
bors
28d0e75269 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.
2021-10-25 01:10:50 +00:00
bors
41d8c94d45 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.
2021-10-24 22:26:41 +00:00
Noah Lev
f410bc7dc1 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.
2021-10-24 14:07:46 -07:00
Esteban Kuber
6dcff4e9f6 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
2021-10-24 20:45:33 +00:00
Esteban Kuber
881a50c0b7 Always sort suggestions before emitting them 2021-10-24 20:28:44 +00:00
Esteban Kuber
ef212e7fb3 Point at overlapping impls when type annotations are needed 2021-10-24 18:33:04 +00:00
Ilya Yanok
f3795e27c1 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
2021-10-24 20:12:22 +02:00
Guillaume Gomez
859b4e305c Add alias for guillaume.gomez@huawei.com 2021-10-24 19:55:04 +02:00
bors
00d5e42e77 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
2021-10-24 14:12:10 +00:00
Matthias Krüger
eee29fd34c
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`
2021-10-24 15:48:46 +02:00
Matthias Krüger
d576393e34
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.
2021-10-24 15:48:45 +02:00
Matthias Krüger
c16ee19dd4
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````
2021-10-24 15:48:44 +02:00
Matthias Krüger
b837605012
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)
2021-10-24 15:48:44 +02:00
Matthias Krüger
d814af95ba
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```
2021-10-24 15:48:43 +02:00
Matthias Krüger
87822b27ee
Rollup merge of #89558 - lcnr:query-stable-lint, r=estebank
Add rustc lint, warning when iterating over hashmaps

r? rust-lang/wg-incr-comp
2021-10-24 15:48:42 +02:00
Hans Kratz
aacb497c36 Temporarily turn overflow checks off for rustc-rayon-core 2021-10-24 15:36:45 +02:00