]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agox.py fmt
Dan Gohman [Tue, 1 Feb 2022 23:10:59 +0000 (15:10 -0800)]
x.py fmt

2 years agoUse `From`/`Into` rather than the traits they replaced.
Dan Gohman [Tue, 1 Feb 2022 22:57:31 +0000 (14:57 -0800)]
Use `From`/`Into` rather than the traits they replaced.

2 years agoFix errors.
Dan Gohman [Tue, 1 Feb 2022 22:38:23 +0000 (14:38 -0800)]
Fix errors.

2 years agoFix unresolved doc links.
Dan Gohman [Tue, 1 Feb 2022 22:37:15 +0000 (14:37 -0800)]
Fix unresolved doc links.

2 years agoFix two copy+pastos.
Dan Gohman [Tue, 1 Feb 2022 22:27:54 +0000 (14:27 -0800)]
Fix two copy+pastos.

2 years agoAdd missing `pub` keywords.
Dan Gohman [Tue, 1 Feb 2022 22:23:03 +0000 (14:23 -0800)]
Add missing `pub` keywords.

2 years agoUpdate the documentation for `{As,Into,From}Raw{Fd,Handle,Socket}`.
Dan Gohman [Tue, 1 Feb 2022 21:46:05 +0000 (13:46 -0800)]
Update the documentation for `{As,Into,From}Raw{Fd,Handle,Socket}`.

This change weakens the descriptions of the
`{as,into,from}_raw_{fd,handle,socket}` descriptions from saying that
they *do* express ownership relations to say that they are *typically used*
in ways that express ownership relations. This needed needed since, for
example, std's own [`RawFd`] implements `{As,From,Into}Fd` without any of
the ownership relationships.

This adds proper `# Safety` comments to `from_raw_{fd,handle,socket}`,
adds the requirement that raw handles be not opened with the
`FILE_FLAG_OVERLAPPED` flag, and merges the `OwnedHandle::from_raw_handle`
comment into the main `FromRawHandle::from_raw_handle` comment.

And, this changes `HandleOrNull` and `HandleOrInvalid` to not implement
`FromRawHandle`, since they are intended for limited use in FFI situations,
and not for generic use, and they have constraints that are stronger than
the those of `FromRawHandle`.

[`RawFd`]: https://doc.rust-lang.org/stable/std/os/unix/io/type.RawFd.html

2 years agoAuto merge of #93548 - matthiaskrgr:rollup-f7dkn3p, r=matthiaskrgr
bors [Tue, 1 Feb 2022 16:55:43 +0000 (16:55 +0000)]
Auto merge of #93548 - matthiaskrgr:rollup-f7dkn3p, r=matthiaskrgr

Rollup of 7 pull requests

Successful merges:

 - #86374 (Enable combining `+crt-static` and `relocation-model=pic` on `x86_64-unknown-linux-gnu`)
 - #91828 (Implement `RawWaker` and `Waker` getters for underlying pointers)
 - #92021 (Eliminate duplicate codes of is_single_fp_element)
 - #92584 (add rustc lint, warning when iterating over hashmaps 2)
 - #93267 (implement a lint for suspicious auto trait impls)
 - #93290 (remove `TyS::same_type`)
 - #93436 (Update compiler_builtins to fix duplicate symbols in `armv7-linux-androideabi` rlib)

Failed merges:

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

2 years agoRollup merge of #93436 - dcsommer:master, r=Mark-Simulacrum
Matthias Krüger [Tue, 1 Feb 2022 15:08:06 +0000 (16:08 +0100)]
Rollup merge of #93436 - dcsommer:master, r=Mark-Simulacrum

Update compiler_builtins to fix duplicate symbols in `armv7-linux-androideabi` rlib

I ran `./x.py dist --host= --target=armv7-linux-androideabi` before this diff:
```
$ nm build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/armv7-linux-androideabi/lib/libcompiler_builtins-3d9661a82c59c66a.rlib 2> /dev/null | grep __sync_fetch_and_add_4 | wc -l
2
```
And after:
```
$ nm build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/armv7-linux-androideabi/lib/libcompiler_builtins-ffd2745070943321.rlib 2> /dev/null | grep __sync_fetch_and_add_4 | wc -l
1
```
Fixes #93310

See also https://github.com/rust-lang/compiler-builtins/issues/449 and https://github.com/rust-lang/compiler-builtins/pull/450

2 years agoRollup merge of #93290 - lcnr:same_type, r=jackh726
Matthias Krüger [Tue, 1 Feb 2022 15:08:05 +0000 (16:08 +0100)]
Rollup merge of #93290 - lcnr:same_type, r=jackh726

remove `TyS::same_type`

This function ignored regions and constants in adts, but didn't do so for references or any other types. cc https://github.com/rust-lang/rust/pull/93148#discussion_r791408057

2 years agoRollup merge of #93267 - lcnr:auto-trait-lint, r=nikomatsakis
Matthias Krüger [Tue, 1 Feb 2022 15:08:04 +0000 (16:08 +0100)]
Rollup merge of #93267 - lcnr:auto-trait-lint, r=nikomatsakis

implement a lint for suspicious auto trait impls

cc https://github.com/rust-lang/rust/pull/85048#issuecomment-1019805102

r? ``@nikomatsakis``

2 years agoRollup merge of #92584 - lcnr:query-stable-lint, r=estebank
Matthias Krüger [Tue, 1 Feb 2022 15:08:03 +0000 (16:08 +0100)]
Rollup merge of #92584 - lcnr:query-stable-lint, r=estebank

add rustc lint, warning when iterating over hashmaps 2

first introduced in #89558 and reverted in #90380 due to its perf impact

r? ``@estebank``

2 years agoRollup merge of #92021 - woodenarrow:br_single_fp_element, r=Mark-Simulacrum
Matthias Krüger [Tue, 1 Feb 2022 15:08:03 +0000 (16:08 +0100)]
Rollup merge of #92021 - woodenarrow:br_single_fp_element, r=Mark-Simulacrum

Eliminate duplicate codes of is_single_fp_element

There are duplicate codes of is_single_fp_element function. Merge these codes to TyAndLayout impl block.
![image](https://user-images.githubusercontent.com/95843988/146707753-ba9ffc41-5888-4a53-80cf-f4fe3bcbac54.png)

2 years agoRollup merge of #91828 - oxalica:feat/waker-getters, r=dtolnay
Matthias Krüger [Tue, 1 Feb 2022 15:08:02 +0000 (16:08 +0100)]
Rollup merge of #91828 - oxalica:feat/waker-getters, r=dtolnay

Implement `RawWaker` and `Waker` getters for underlying pointers

implement #87021

New APIs:
- `RawWaker::data(&self) -> *const ()`
- `RawWaker::vtable(&self) -> &'static RawWakerVTable`
- ~`Waker::as_raw_waker(&self) -> &RawWaker`~ `Waker::as_raw(&self) -> &RawWaker`

This third one is an auxiliary function to make the two APIs above more useful. Since we can only get `&Waker` in `Future::poll`, without this, we need to `transmute` it into `&RawWaker` (relying on `repr(transparent)`) in order to access its data/vtable pointers.

~Not sure if it should be named `as_raw` or `as_raw_waker`. Seems we always use `as_<something-raw>` instead of just `as_raw`. But `as_raw_waker` seems not quite consistent with `Waker::from_raw`.~ As suggested in https://github.com/rust-lang/rust/pull/91828#discussion_r770729837, use `as_raw`.

2 years agoRollup merge of #86374 - bossmc:enable-static-pie-for-gnu, r=nagisa
Matthias Krüger [Tue, 1 Feb 2022 15:08:01 +0000 (16:08 +0100)]
Rollup merge of #86374 - bossmc:enable-static-pie-for-gnu, r=nagisa

Enable combining `+crt-static` and `relocation-model=pic` on `x86_64-unknown-linux-gnu`

Modern `gcc` versions support `-static-pie`, and `rustc` will already fall-back to `-static` if the local `gcc` is too old (and hence this change is optimistic rather than absolute).  This brings the `-musl` and `-gnu` targets to feature compatibility (albeit with different default settings).

Of note a `-static` or `-static-pie` binary based on glibc that uses NSS-backed functions (`gethostbyname` or `getpwuid` etc.) need to have access to the `libnss_X.so.2` libraries and any of their dynamic dependencies.

I wasn't sure about the `# only`/`# ignore` changes (I've not got a `gnux32` toolchain to test with hence not also enabling `-static-pie` there).

2 years agoAuto merge of #93284 - eholk:disable-drop-range-analysis, r=pnkfelix
bors [Tue, 1 Feb 2022 13:45:38 +0000 (13:45 +0000)]
Auto merge of #93284 - eholk:disable-drop-range-analysis, r=pnkfelix

Disable drop range analysis

The previous PR, #93165, still performed the drop range analysis despite ignoring the results. Unfortunately, there were ICEs in the analysis as well, so some packages failed to build (see the issue #93197 for an example). This change further disables the analysis and just provides dummy results in that case.

2 years agoremove `TyS::same_type`
lcnr [Tue, 25 Jan 2022 07:42:52 +0000 (08:42 +0100)]
remove `TyS::same_type`

it ignored regions and constants in adts,
but didn't do so for references or any other types.
This seemed quite weird

2 years agoAuto merge of #86988 - thomcc:chunky-splitz-says-no-checking, r=the8472
bors [Tue, 1 Feb 2022 10:11:59 +0000 (10:11 +0000)]
Auto merge of #86988 - thomcc:chunky-splitz-says-no-checking, r=the8472

Carefully remove bounds checks from some chunk iterator functions

So, I was writing code that requires the equivalent of `rchunks(N).rev()` (which isn't the same as forward `chunks(N)` — in particular, if the buffer length is not a multiple of `N`, I must handle the "remainder" first).

I happened to look at the codegen output of the function (I was actually interested in whether or not a nested loop was being unrolled — it was), and noticed that in the outer `rchunks(n).rev()` loop, LLVM seemed to be unable to remove the bounds checks from the iteration: https://rust.godbolt.org/z/Tnz4MYY8f (this panic was from the split_at in `RChunks::next_back`).

After doing some experimentation, it seems all of the `next_back` in the non-exact chunk iterators have the issue: (`Chunks::next_back`, `RChunks::next_back`, `ChunksMut::next_back`, and `RChunksMut::next_back`)...

Even worse, the forward `rchunks` iterators sometimes have the issue as well (... but only sometimes). For example https://rust.godbolt.org/z/oGhbqv53r has bounds checks, but if I uncomment the loop body, it manages to remove the check (which is bizarre, since I'd expect the opposite...). I suspect it's highly dependent on the surrounding code, so I decided to remove the bounds checks from them anyway. Overall, this change includes:
- All `next_back` functions on the non-`Exact` iterators (e.g. `R?Chunks(Mut)?`).
- All `next` functions on the non-exact rchunks iterators (e.g. `RChunks(Mut)?`).

I wasn't able to catch any of the other chunk iterators failing to remove the bounds checks (I checked iterations over `r?chunks(_exact)?(_mut)?` with constant chunk sizes under `-O3`, `-Os`, and `-Oz`), which makes sense, since these were the cases where it was harder to prove the bounds check correct to remove...

In fact, it took quite a bit of thinking to convince myself that using unchecked_ here was valid — so I'm not really surprised that LLVM had trouble (although compilers are slightly better at this sort of reasoning than humans). A consequence of that is the fact that the `// SAFETY` comment for these are... kinda long...

---

I didn't do this for, or even think about it for, any of the other iteration methods; just `next` and `next_back` (where it mattered). If this PR is accepted, I'll file a follow up for someone (possibly me) to look at the others later (in particular, `nth`/`nth_back` looked like they had similar logic), but I wanted to do this now, as IMO `next`/`next_back` are the most important here, since they're what gets used by the iteration protocol.

---

Note: While I don't expect this to impact performance directly, the panic is a side effect, which would otherwise not exist in these loops. That is, this could prevent the compiler from being able to move/remove/otherwise rework a loop over these iterators (as an example, it could not delete the code for a loop whose body computes a value which doesn't get used).

Also, some like to be able to have confidence this code has no panicking branches in the optimized code, and "no bounds checks" is kinda part of the selling point of Rust's iterators anyway.

2 years agoreview + rebase
lcnr [Tue, 1 Feb 2022 09:29:36 +0000 (10:29 +0100)]
review + rebase

2 years agorustfmt is broken, manually reduce line length
lcnr [Wed, 19 Jan 2022 10:22:40 +0000 (11:22 +0100)]
rustfmt is broken, manually reduce line length

2 years agoadd a rustc::query_stability lint
lcnr [Wed, 5 Jan 2022 12:02:16 +0000 (13:02 +0100)]
add a rustc::query_stability lint

2 years agosilence lint in clippy
lcnr [Tue, 1 Feb 2022 09:13:32 +0000 (10:13 +0100)]
silence lint in clippy

2 years agoimplement lint for suspicious auto trait impls
lcnr [Thu, 27 Jan 2022 09:49:52 +0000 (10:49 +0100)]
implement lint for suspicious auto trait impls

2 years agoupdate `FutureIncompatibilityReason`
lcnr [Thu, 27 Jan 2022 09:49:32 +0000 (10:49 +0100)]
update `FutureIncompatibilityReason`

2 years agoAuto merge of #93534 - ehuss:rollup-9ecozo9, r=ehuss
bors [Tue, 1 Feb 2022 07:04:17 +0000 (07:04 +0000)]
Auto merge of #93534 - ehuss:rollup-9ecozo9, r=ehuss

Rollup of 9 pull requests

Successful merges:

 - #91343 (Fix suggestion to slice if scrutinee is a `Result` or `Option`)
 - #93019 (If an integer is entered with an upper-case base prefix (0Xbeef, 0O755, 0B1010), suggest to make it lowercase)
 - #93090 (`impl Display for io::ErrorKind`)
 - #93456 (Remove an unnecessary transmute from opaque::Encoder)
 - #93492 (Hide failed command unless in verbose mode)
 - #93504 (kmc-solid: Increase the default stack size)
 - #93513 (Allow any pretty printed line to have at least 60 chars)
 - #93532 (Update books)
 - #93533 (Update cargo)

Failed merges:

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

2 years agoRollup merge of #93533 - ehuss:update-cargo, r=ehuss
Eric Huss [Tue, 1 Feb 2022 04:13:02 +0000 (20:13 -0800)]
Rollup merge of #93533 - ehuss:update-cargo, r=ehuss

Update cargo

10 commits in 1c034752de0df744fcd7788fcbca158830b8bf85..25fcb135d02ea897ce894b67ae021f48107d522b
2022-01-25 22:36:53 +0000 to 2022-02-01 01:32:48 +0000
- fix(install): Keep v1 file formatting the same (rust-lang/cargo#10349)
- fix(vendor): Use tables for sample config (rust-lang/cargo#10348)
- Add bash completion for `cargo clippy` (rust-lang/cargo#10347)
- Do not ignore `--features` when `--all-features` is present (rust-lang/cargo#10337)
- test: Fix compatibilty with new toml_edit (rust-lang/cargo#10350)
- extra-link-arg-etc: support all link types (credit `@davidhewitt)` (rust-lang/cargo#10274)
- Make clippy happy (rust-lang/cargo#10340)
- Update publishing link for semver rules. (rust-lang/cargo#10338)
- Normalize --path when install bin outside current workspace (rust-lang/cargo#10335)
- Bump clap to v3.0.13 (rust-lang/cargo#10336)

2 years agoUpdate cargo
Eric Huss [Tue, 1 Feb 2022 11:26:30 +0000 (03:26 -0800)]
Update cargo

2 years agoRollup merge of #93532 - ehuss:update-books, r=ehuss
Eric Huss [Tue, 1 Feb 2022 04:13:01 +0000 (20:13 -0800)]
Rollup merge of #93532 - ehuss:update-books, r=ehuss

Update books

## nomicon

4 commits in 66d097d3d80e8f88c288c6879c7c2b909ecf8ad4..9493715a6280a1f74be759c7e1ef9999b5d13e6f
2022-01-05 05:45:21 +0900 to 2022-01-27 19:00:32 -0800
- send-and-sync: it's -&gt; its (rust-lang/nomicon#332)
- Clarify the HRTB chapter (rust-lang/nomicon#330)
- Clarify repr(transparent) in other-reprs (rust-lang/nomicon#329)
- Make C code more recognizably C (rust-lang/nomicon#331)

## reference

10 commits in 4dee6eb63d728ffb9e7a2ed443e9ada9275c69d2..411c2f0d5cebf48453ae2d136ad0c5e611d39aec
2022-01-18 09:26:33 -0800 to 2022-01-30 12:46:37 -0800
- paths.md: update comments of `Canoical paths` section (rust-lang/reference#1146)
- Add undocumented outer attributes above StructExpr fields (rust-lang/reference#1150)
-  (rust-lang/reference#1148)
- Fix micro typo in async/unsafe function docs (rust-lang/reference#1145)
- Note difference in CTFE timing between associated and free constants (rust-lang/reference#1120)
- Update the Preludes chapter for the 2021 edition changes to the standard library prelude (rust-lang/reference#1136)
- Link to associated constants section rather than glossary (rust-lang/reference#1141)
- functions.md: replace `argument` with `parameter` (rust-lang/reference#1142)
- Improve rendering (rust-lang/reference#1143)
- (minor) link references and replace wording by syntax definition (rust-lang/reference#1139)

## book

24 commits in f17df27fc14696912c48b8b7a7a8fa49e648088d..98904efaa4fc968db8ff59cf2744d9f7ed158166
2022-01-18 17:46:28 -0500 to 2022-01-29 21:22:31 -0500
- Snapshot of chapter 17 for nostarch
- Remove the section on object safety.
- Don't put a hyphen in 'object safe'. Fixes rust-lang/book#2960.
- Clarify that add_text on Post will work in any state. Fixes rust-lang/book#2159.
- Fix incorrect descriptions of what the code is doing. Fixes rust-lang/book#2745.
- Fix link style and inclusion in print
- Snapshot of ch16 for nostarch
- Cut discussion of threading models Rust *doesn't* support.
- Update a quote of compiler output
- Move transfers between threads, not shares. Fixes rust-lang/book#2843.
- Ch20-02 Remove reference to a long-gone "trick"
- Clarify translations a bit
- Added a mention to the translations appendix
- Fix listing number from `8-5` to `9-5` in `ch09-02`
- Moving example into blockquote means it can't be extracted to a listing project
- Move a link to the end with all the other links
- Propagate edits back to ch 9
- Responding to edits in chapter 9
- Update to 1.58
- Snapshot of chapter 15 for nostarch
- Change 'only difference' to 'main difference'. Fixes rust-lang/book#1581.
- Add a back reference to tuple struct syntax. Fixes rust-lang/book#1916
- Add a link to a section reference
- Remove an outdated example that says it won't compile but it does

## rustc-dev-guide

2 commits in 78dd6a4684cf8d6b72275fab6d0429ea40b66338..8763adb62c712df69b1d39ea3e692b6d696cc4d9
2022-01-18 14:44:26 -0300 to 2022-01-26 14:01:40 -0800
- git.md: Expanded a note to try to stress what you need to do if you're playing
- Clarify that r? works in comments.

## embedded-book

1 commits in 8c395bdd8073deb20ca67e1ed4b14a3a7e315a37..d5fc1bce3f8eb398f9c25f1b15e0257d7537cd41
2021-11-14 11:38:31 +0000 to 2022-01-24 07:13:31 +0000
- Add link to Japanese translation  (rust-embedded/book#311)

2 years agoUpdate books
Eric Huss [Tue, 1 Feb 2022 10:55:55 +0000 (02:55 -0800)]
Update books

2 years agoRollup merge of #93513 - dtolnay:linewidth, r=nagisa
Eric Huss [Tue, 1 Feb 2022 04:13:00 +0000 (20:13 -0800)]
Rollup merge of #93513 - dtolnay:linewidth, r=nagisa

Allow any pretty printed line to have at least 60 chars

Follow-up to #93155. The rustc AST pretty printer has a tendency to get stuck in "vertical smear mode" when formatting highly nested code, where it puts a linebreak at *every possible* linebreak opportunity once the indentation goes beyond the pretty printer's target line width:

```rust
...
                                                              ((&([("test"
                                                                       as
                                                                       &str)]
                                                                     as
                                                                     [&str; 1])
                                                                   as
                                                                   &[&str; 1]),
                                                               (&([]
                                                                     as
                                                                     [ArgumentV1; 0])
                                                                   as
                                                                   &[ArgumentV1; 0]))
...
```

```rust
...
                                                                          [(1
                                                                               as
                                                                               i32),
                                                                           (2
                                                                               as
                                                                               i32),
                                                                           (3
                                                                               as
                                                                               i32)]
                                                                             as
                                                                             [i32; 3]
...
```

This is less common after #93155 because that PR greatly reduced the total amount of indentation, but the "vertical smear mode" failure mode is still just as present when you have deeply nested modules, functions, or trait impls, such as in the case of macro-expanded code from `-Zunpretty=expanded`.

Vertical smear mode is never the best way to format highly indented code though. It does not prevent the target line width from being exceeded, and it produces output that is less readable than just a longer line.

This PR makes the pretty printing algorithm allow a minimum of 60 chars on every line independent of indentation. So as code gets more indented, the right margin eventually recedes to make room for formatting without vertical smear.

```console
├─────────────────────────────────────┤
├─────────────────────────────────────┤
├─────────────────────────────────────┤
  ├───────────────────────────────────┤
    ├─────────────────────────────────┤
      ├───────────────────────────────┤
        ├─────────────────────────────┤
          ├───────────────────────────┤
            ├───────────────────────────┤
              ├───────────────────────────┤
            ├───────────────────────────┤
          ├───────────────────────────┤
        ├─────────────────────────────┤
      ├───────────────────────────────┤
    ├─────────────────────────────────┤
  ├───────────────────────────────────┤
├─────────────────────────────────────┤
```

2 years agoRollup merge of #93504 - solid-rs:fix-kmc-solid-stack-size, r=nagisa
Eric Huss [Tue, 1 Feb 2022 04:12:59 +0000 (20:12 -0800)]
Rollup merge of #93504 - solid-rs:fix-kmc-solid-stack-size, r=nagisa

kmc-solid: Increase the default stack size

This PR increases the default minimum stack size on the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets to 64KiB (Arm) and 128KiB (AArch64).

This value was chosen as a middle ground between supporting a relatively complex program (e.g., an application using a full-fledged off-the-shelf web server framework) with no additional configuration and minimizing resource consumption for the embedded platform that doesn't support lazily-allocated pages nor over-commitment (i.e., wasted stack spaces are wasted physical memory). If the need arises, the users can always set the `RUST_MIN_STACK` environmental variable to override the default stack size or use the platform API directly.

2 years agoRollup merge of #93492 - Mark-Simulacrum:shorter-failure-output, r=ehuss
Eric Huss [Tue, 1 Feb 2022 04:12:58 +0000 (20:12 -0800)]
Rollup merge of #93492 - Mark-Simulacrum:shorter-failure-output, r=ehuss

Hide failed command unless in verbose mode

This is particularly intended for invoking compiletest; the command line there
is long (3,350 characters on my system) and takes up a lot of screen real estate
for little benefit to the majority of those running bootstrap. This moves
printing it to verbose mode (-v must be passed) which means that it's still
possible to access when needed for debugging.

The main downside is that CI logs will by-default become less usable for
debugging (particularly) spurious failures, but it is pretty rare for us to
really need the information there -- it's usually fairly obvious what is being
run with a little investigation.

r? `@ehuss` as you've done some of the spurious failure investigations, so can
(hopefully) confirm my intuition that this won't seriously hinder them.

2 years agoRollup merge of #93456 - bjorn3:remove_unnecessary_unsafe, r=michaelwoerister
Eric Huss [Tue, 1 Feb 2022 04:12:57 +0000 (20:12 -0800)]
Rollup merge of #93456 - bjorn3:remove_unnecessary_unsafe, r=michaelwoerister

Remove an unnecessary transmute from opaque::Encoder

2 years agoRollup merge of #93090 - jyn514:errorkind-asstr, r=dtolnay
Eric Huss [Tue, 1 Feb 2022 04:12:56 +0000 (20:12 -0800)]
Rollup merge of #93090 - jyn514:errorkind-asstr, r=dtolnay

`impl Display for io::ErrorKind`

This avoids having to convert from `ErrorKind` to `Error` just to print the error message.

2 years agoRollup merge of #93019 - 5225225:uppercase-suffix, r=wesleywiser
Eric Huss [Tue, 1 Feb 2022 04:12:55 +0000 (20:12 -0800)]
Rollup merge of #93019 - 5225225:uppercase-suffix, r=wesleywiser

If an integer is entered with an upper-case base prefix (0Xbeef, 0O755, 0B1010), suggest to make it lowercase

The current error for this case isn't really great, it just complains about the whole thing past the `0` being an invalid suffix.

2 years agoRollup merge of #91343 - FabianWolff:issue-91328-as-deref, r=jackh726
Eric Huss [Tue, 1 Feb 2022 04:12:55 +0000 (20:12 -0800)]
Rollup merge of #91343 - FabianWolff:issue-91328-as-deref, r=jackh726

Fix suggestion to slice if scrutinee is a `Result` or `Option`

Fixes #91328.

2 years agoAuto merge of #93259 - eddyb:diagbld-scalar-pair, r=jackh726
bors [Tue, 1 Feb 2022 03:58:32 +0000 (03:58 +0000)]
Auto merge of #93259 - eddyb:diagbld-scalar-pair, r=jackh726

rustc_errors: only box the `diagnostic` field in `DiagnosticBuilder`.

I happened to need to do the first change (replacing `allow_suggestions` with equivalent functionality on `Diagnostic` itself) as part of a larger change, and noticed that there's only two fields left in `DiagnosticBuilderInner`.

So with this PR, instead of a single pointer, `DiagnosticBuilder` is two pointers, which should work just as well for passing *it* by value (and may even work better wrt some operations, though probably not by much).

But anything that was already taking advantage of `DiagnosticBuilder` being a single pointer, and wrapping it further (e.g. `Result<T, DiagnosticBuilder>` w/ non-ZST `T`), ~~will probably see a slowdown~~, so I want to do a perf run before even trying to propose this.

2 years agoImprove test coverage of {Chunks,RChunks,RChunksMut}::{next,next_back}
Thom Chiovoloni [Tue, 1 Feb 2022 01:35:19 +0000 (17:35 -0800)]
Improve test coverage of {Chunks,RChunks,RChunksMut}::{next,next_back}

2 years agoAuto merge of #93386 - WaffleLapkin:rustc_must_implement_one_of_check_target, r=nagisa
bors [Tue, 1 Feb 2022 00:50:28 +0000 (00:50 +0000)]
Auto merge of #93386 - WaffleLapkin:rustc_must_implement_one_of_check_target, r=nagisa

Check that `#[rustc_must_implement_one_of]` is applied to a trait

`#[rustc_must_implement_one_of]` only makes sense when applied to a trait, so it's sensible to emit an error otherwise.

2 years agoAuto merge of #93381 - tmiasko:is-self-recursive, r=ecstatic-morse
bors [Mon, 31 Jan 2022 21:16:17 +0000 (21:16 +0000)]
Auto merge of #93381 - tmiasko:is-self-recursive, r=ecstatic-morse

Check the number of arguments first in `is_recursive_call`

2 years agoAdd FIXME comment
Fabian Wolff [Mon, 31 Jan 2022 19:34:26 +0000 (20:34 +0100)]
Add FIXME comment

2 years agoBless all pretty printer tests and ui tests
David Tolnay [Fri, 21 Jan 2022 10:28:11 +0000 (02:28 -0800)]
Bless all pretty printer tests and ui tests

2 years agoAllow any line to have at least 60 chars
David Tolnay [Mon, 31 Jan 2022 18:56:57 +0000 (10:56 -0800)]
Allow any line to have at least 60 chars

2 years agoExtract constant MARGIN out of Printer struct
David Tolnay [Mon, 31 Jan 2022 18:56:40 +0000 (10:56 -0800)]
Extract constant MARGIN out of Printer struct

2 years agoAdd match on `Vec<_>` to `ui/typeck/issue-91328.rs` test
Fabian Wolff [Sat, 15 Jan 2022 20:33:11 +0000 (21:33 +0100)]
Add match on `Vec<_>` to `ui/typeck/issue-91328.rs` test

2 years agoFix suggestion to slice if scrutinee is a `Result` or `Option`
Fabian Wolff [Mon, 29 Nov 2021 00:50:12 +0000 (01:50 +0100)]
Fix suggestion to slice if scrutinee is a `Result` or `Option`

2 years agoAuto merge of #93348 - spastorino:fix-perf-overlap-mode2, r=nikomatsakis
bors [Mon, 31 Jan 2022 17:36:11 +0000 (17:36 +0000)]
Auto merge of #93348 - spastorino:fix-perf-overlap-mode2, r=nikomatsakis

 Move overlap_mode into trait level attribute

r? `@nikomatsakis`

Should fix some performance regressions noted on https://github.com/rust-lang/rust/pull/93175

2 years agoWrite UI tests, tweak message
5225225 [Thu, 27 Jan 2022 22:22:33 +0000 (22:22 +0000)]
Write UI tests, tweak message

2 years agoRemove two unnecessary transmutes from opaque Encoder and Decoder
bjorn3 [Sat, 29 Jan 2022 13:36:35 +0000 (14:36 +0100)]
Remove two unnecessary transmutes from opaque Encoder and Decoder

2 years agoDo not store overlap_mode, just pass it down on insert
Santiago Pastorino [Mon, 31 Jan 2022 14:51:34 +0000 (11:51 -0300)]
Do not store overlap_mode, just pass it down on insert

2 years agoMove overlap_mode into trait level attribute + feature flag
Santiago Pastorino [Sun, 30 Jan 2022 21:55:22 +0000 (18:55 -0300)]
Move overlap_mode into trait level attribute + feature flag

2 years agoAuto merge of #93373 - spastorino:def_id_to_hir_id_refactor, r=oli-obk
bors [Mon, 31 Jan 2022 14:23:44 +0000 (14:23 +0000)]
Auto merge of #93373 - spastorino:def_id_to_hir_id_refactor, r=oli-obk

Store def_id_to_hir_id as variant in hir_owner.

If hir_owner is Owner(_), the LocalDefId is pointing to an owner, so the ItemLocalId is 0.
If the HIR node does not exist, we store Phantom.
Otherwise, we store the HirId associated to the LocalDefId.

Related to #89278

r? `@oli-obk`

2 years agoAuto merge of #93498 - matthiaskrgr:rollup-k5shwrc, r=matthiaskrgr
bors [Mon, 31 Jan 2022 11:24:03 +0000 (11:24 +0000)]
Auto merge of #93498 - matthiaskrgr:rollup-k5shwrc, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #90277 (Improve terminology around "after typeck")
 - #92918 (Allow eliding GATs in expression position)
 - #93039 (Don't suggest inaccessible fields)
 - #93155 (Switch pretty printer to block-based indentation)
 - #93214 (Respect doc(hidden) when suggesting available fields)
 - #93347 (Make `char::DecodeUtf16::size_hist` more precise)
 - #93392 (Clarify documentation on char::MAX)
 - #93444 (Fix some CSS warnings and errors from VS Code)

Failed merges:

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

2 years agokmc-solid: Increase the default stack size
Tomoaki Kawada [Mon, 31 Jan 2022 08:39:38 +0000 (17:39 +0900)]
kmc-solid: Increase the default stack size

2 years agoAuto merge of #93499 - matthiaskrgr:rollup-icdex11, r=matthiaskrgr
bors [Mon, 31 Jan 2022 08:12:10 +0000 (08:12 +0000)]
Auto merge of #93499 - matthiaskrgr:rollup-icdex11, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #93395 (Improve suggestion for escaping reserved keywords)
 - #93403 (review the total_cmp documentation)
 - #93461 (Accommodate yield points in the format_args expansion)
 - #93462 (Document `SystemTime` platform precision)
 - #93471 (unix: Use metadata for `DirEntry::file_type` fallback)
 - #93480 (Remove deprecated and unstable slice_partition_at_index functions)
 - #93485 (core: Remove some redundant {}s from the sorting code)
 - #93494 (kmc-solid: Inherit the calling task's base priority in `Thread::new`)

Failed merges:

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

2 years agoRollup merge of #93494 - solid-rs:fix-kmc-solid-spawned-task-priority, r=Mark-Simulacrum
Matthias Krüger [Mon, 31 Jan 2022 06:00:47 +0000 (07:00 +0100)]
Rollup merge of #93494 - solid-rs:fix-kmc-solid-spawned-task-priority, r=Mark-Simulacrum

kmc-solid: Inherit the calling task's base priority in `Thread::new`

This PR fixes the initial priority calculation of spawned threads on the [`*-kmc-solid_*`](https://doc.rust-lang.org/nightly/rustc/platform-support/kmc-solid.html) Tier 3 targets.

Fixes a spawned task (an RTOS object on top of which threads are implemented for this target; unrelated to async tasks) getting an unexpectedly higher priority if it's spawned by a task whose priority is temporarily boosted by a priority-protection mutex.

2 years agoRollup merge of #93485 - est31:remove_curly, r=joshtriplett
Matthias Krüger [Mon, 31 Jan 2022 06:00:46 +0000 (07:00 +0100)]
Rollup merge of #93485 - est31:remove_curly, r=joshtriplett

core: Remove some redundant {}s from the sorting code

2 years agoRollup merge of #93480 - est31:remove_unstable_deprecated, r=Mark-Simulacrum
Matthias Krüger [Mon, 31 Jan 2022 06:00:45 +0000 (07:00 +0100)]
Rollup merge of #93480 - est31:remove_unstable_deprecated, r=Mark-Simulacrum

Remove deprecated and unstable slice_partition_at_index functions

They have been deprecated since commit 01ac5a97c90c26ac35ca9d65f685dd6701edfa3b
which was part of the 1.49.0 release, so from the point of nightly,
11 releases ago.

2 years agoRollup merge of #93471 - cuviper:direntry-file_type-stat, r=the8472
Matthias Krüger [Mon, 31 Jan 2022 06:00:44 +0000 (07:00 +0100)]
Rollup merge of #93471 - cuviper:direntry-file_type-stat, r=the8472

unix: Use metadata for `DirEntry::file_type` fallback

When `DirEntry::file_type` fails to match a known `d_type`, we should
fall back to `DirEntry::metadata` instead of a bare `lstat`, because
this is faster and more reliable on targets with `fstatat`.

2 years agoRollup merge of #93462 - ChrisDenton:systime-doc, r=joshtriplett
Matthias Krüger [Mon, 31 Jan 2022 06:00:43 +0000 (07:00 +0100)]
Rollup merge of #93462 - ChrisDenton:systime-doc, r=joshtriplett

Document `SystemTime` platform precision

Fixes #88822

2 years agoRollup merge of #93461 - dtolnay:fmtyield, r=davidtwco
Matthias Krüger [Mon, 31 Jan 2022 06:00:42 +0000 (07:00 +0100)]
Rollup merge of #93461 - dtolnay:fmtyield, r=davidtwco

Accommodate yield points in the format_args expansion

Fixes #93274.

For the case `println!("{} {:?}", "", async {}.await)` in the issue, the expansion before:

```rust
::std::io::_print(
    ::core::fmt::Arguments::new_v1(
        &["", " ", "\n"],
        &[
            ::core::fmt::ArgumentV1::new(&"", ::core::fmt::Display::fmt),
            ::core::fmt::ArgumentV1::new(&async {}.await, ::core::fmt::Debug::fmt),
        ],
    ),
);
```

After:

```rust
::std::io::_print(
    ::core::fmt::Arguments::new_v1(
        &["", " ", "\n"],
        &match (&"", &async {}.await) {
            _args => [
                ::core::fmt::ArgumentV1::new(_args.0, ::core::fmt::Display::fmt),
                ::core::fmt::ArgumentV1::new(_args.1, ::core::fmt::Debug::fmt),
            ],
        },
    ),
);
```

2 years agoRollup merge of #93403 - nagisa:total-cmp-review, r=joshtriplett
Matthias Krüger [Mon, 31 Jan 2022 06:00:41 +0000 (07:00 +0100)]
Rollup merge of #93403 - nagisa:total-cmp-review, r=joshtriplett

review the total_cmp documentation

The documentation has been restructured to split out a brief summary
paragraph out from the following elaborating paragraphs.

I also attempted my hand at wording improvements and adding articles
where I felt them missing, but being non-native english speaker these
may need more thorough review.

cc https://github.com/rust-lang/rust/issues/72599

2 years agoRollup merge of #93395 - camelid:reserved-sugg, r=davidtwco
Matthias Krüger [Mon, 31 Jan 2022 06:00:40 +0000 (07:00 +0100)]
Rollup merge of #93395 - camelid:reserved-sugg, r=davidtwco

Improve suggestion for escaping reserved keywords

r? `@davidtwco`

2 years agoRollup merge of #93444 - camelid:rustdoc-css-cleanup, r=GuillaumeGomez,jsha
Matthias Krüger [Mon, 31 Jan 2022 05:58:33 +0000 (06:58 +0100)]
Rollup merge of #93444 - camelid:rustdoc-css-cleanup, r=GuillaumeGomez,jsha

Fix some CSS warnings and errors from VS Code

There's no such CSS rule as `box-shadow-color`, so I instead copied the
whole `box-shadow` property to each rule to make it actually apply.

r? `@jsha`

2 years agoRollup merge of #93392 - GKFX:char-docs, r=scottmcm
Matthias Krüger [Mon, 31 Jan 2022 05:58:32 +0000 (06:58 +0100)]
Rollup merge of #93392 - GKFX:char-docs, r=scottmcm

Clarify documentation on char::MAX

As mentioned in https://github.com/rust-lang/rust/issues/91836#issuecomment-994106874, the documentation on `char::MAX` is not quite correct – USVs are not "only ones within a certain range", they are code points _outside_ a certain range. I have corrected this and given the actual numbers as there is no reason to hide them.

2 years agoRollup merge of #93347 - WaffleLapkin:better_char_decode_utf16_size_hint, r=dtolnay
Matthias Krüger [Mon, 31 Jan 2022 05:58:31 +0000 (06:58 +0100)]
Rollup merge of #93347 - WaffleLapkin:better_char_decode_utf16_size_hint, r=dtolnay

Make `char::DecodeUtf16::size_hist` more precise

New implementation takes into account contents of `self.buf` and rounds lower bound up instead of down.

Fixes #88762
Revival of #88763

2 years agoRollup merge of #93214 - ibraheemdev:issue-93210, r=davidtwco
Matthias Krüger [Mon, 31 Jan 2022 05:58:30 +0000 (06:58 +0100)]
Rollup merge of #93214 - ibraheemdev:issue-93210, r=davidtwco

Respect doc(hidden) when suggesting available fields

Resolves #93210

2 years agoRollup merge of #93155 - dtolnay:blockindent, r=nagisa
Matthias Krüger [Mon, 31 Jan 2022 05:58:29 +0000 (06:58 +0100)]
Rollup merge of #93155 - dtolnay:blockindent, r=nagisa

Switch pretty printer to block-based indentation

This PR backports https://github.com/dtolnay/prettyplease/commit/401d60c04213e6c66565e0e69a95b4588db5fdba from the `prettyplease` crate into `rustc_ast_pretty`.

A before and after:

```diff
- let res =
-     ((::alloc::fmt::format as
-          for<'r> fn(Arguments<'r>) -> String {format})(((::core::fmt::Arguments::new_v1
-                                                             as
-                                                             fn(&[&'static str], &[ArgumentV1]) -> Arguments {Arguments::new_v1})((&([("test"
-                                                                                                                                          as
-                                                                                                                                          &str)]
-                                                                                                                                        as
-                                                                                                                                        [&str; 1])
-                                                                                                                                      as
-                                                                                                                                      &[&str; 1]),
-                                                                                                                                  (&([]
-                                                                                                                                        as
-                                                                                                                                        [ArgumentV1; 0])
-                                                                                                                                      as
-                                                                                                                                      &[ArgumentV1; 0]))
-                                                            as
-                                                            Arguments))
-         as String);
+ let res =
+     ((::alloc::fmt::format as
+             for<'r> fn(Arguments<'r>) -> String {format})(((::core::fmt::Arguments::new_v1
+                 as
+                 fn(&[&'static str], &[ArgumentV1]) -> Arguments {Arguments::new_v1})((&([("test"
+                             as &str)] as [&str; 1]) as
+                 &[&str; 1]),
+             (&([] as [ArgumentV1; 0]) as &[ArgumentV1; 0])) as
+             Arguments)) as String);
```

Previously the pretty printer would compute indentation always relative to whatever column a block begins at, like this:

```rust
fn demo(arg1: usize,
        arg2: usize);
```

This is never the thing to do in the dominant contemporary Rust style. Rustfmt's default and the style used by the vast majority of Rust codebases is block indentation:

```rust
fn demo(
    arg1: usize,
    arg2: usize,
);
```

where every indentation level is a multiple of 4 spaces and each level is indented relative to the indentation of the previous line, not the position that the block starts in.

By itself this PR doesn't get perfect formatting in all cases, but it is the smallest possible step in clearly the right direction. More backports from `prettyplease` to tune the ibox/cbox indent levels around various AST node types are upcoming.

2 years agoRollup merge of #93039 - terrarier2111:fix-field-help, r=nagisa
Matthias Krüger [Mon, 31 Jan 2022 05:58:28 +0000 (06:58 +0100)]
Rollup merge of #93039 - terrarier2111:fix-field-help, r=nagisa

Don't suggest inaccessible fields

Fixes: https://github.com/rust-lang/rust/issues/92999
2 years agoRollup merge of #92918 - compiler-errors:gat-expr-lifetime-elision, r=jackh726
Matthias Krüger [Mon, 31 Jan 2022 05:58:27 +0000 (06:58 +0100)]
Rollup merge of #92918 - compiler-errors:gat-expr-lifetime-elision, r=jackh726

Allow eliding GATs in expression position

Thoughts on whether this is worthwhile?

Fixes #92836

r? ``@jackh726``

2 years agoRollup merge of #90277 - pierwill:fix-70258-inference-terms, r=jackh726
Matthias Krüger [Mon, 31 Jan 2022 05:58:26 +0000 (06:58 +0100)]
Rollup merge of #90277 - pierwill:fix-70258-inference-terms, r=jackh726

Improve terminology around "after typeck"

Closes #70258.

2 years agoAuto merge of #93270 - klensy:sec-up, r=Mark-Simulacrum
bors [Mon, 31 Jan 2022 04:23:21 +0000 (04:23 +0000)]
Auto merge of #93270 - klensy:sec-up, r=Mark-Simulacrum

update vulnerable/yanked deps

tokio v1.8.2 -> v1.8.4: https://rustsec.org/advisories/RUSTSEC-2021-0124
ammonia v3.1.0 -> v3.1.3: https://rustsec.org/advisories/RUSTSEC-2022-0003
thread_local v1.0.1 -> v1.1.4: https://rustsec.org/advisories/RUSTSEC-2022-0006

pin-project-lite v0.2.4 -> v0.2.8: yanked: https://github.com/taiki-e/pin-project-lite/blob/main/CHANGELOG.md#024---2021-01-11

2 years agoRestore a visual alignment mode for block comments
David Tolnay [Fri, 21 Jan 2022 09:26:00 +0000 (01:26 -0800)]
Restore a visual alignment mode for block comments

2 years agoBless all pretty printer tests and ui tests
David Tolnay [Fri, 21 Jan 2022 09:34:06 +0000 (01:34 -0800)]
Bless all pretty printer tests and ui tests

2 years agoFix some double indents on exprs containing blocks
David Tolnay [Fri, 21 Jan 2022 05:22:40 +0000 (21:22 -0800)]
Fix some double indents on exprs containing blocks

The `print_expr` method already places an `ibox(INDENT_UNIT)` around
every expr that gets printed. Some exprs were then using `self.head`
inside of that, which does its own `cbox(INDENT_UNIT)`, resulting in two
levels of indentation:

    while true {
            stuff;
        }

This commit fixes those cases to produce the expected single level of
indentation within every expression containing a block.

    while true {
        stuff;
    }

2 years agoCompute indent never relative to current column
David Tolnay [Fri, 21 Jan 2022 09:34:19 +0000 (01:34 -0800)]
Compute indent never relative to current column

Previously the pretty printer would compute indentation always relative
to whatever column a block begins at, like this:

    fn demo(arg1: usize,
            arg2: usize);

This is never the thing to do in the dominant contemporary Rust style.
Rustfmt's default and the style used by the vast majority of Rust
codebases is block indentation:

    fn demo(
        arg1: usize,
        arg2: usize,
    );

where every indentation level is a multiple of 4 spaces and each level
is indented relative to the indentation of the previous line, not the
position that the block starts in.

2 years agokmc-solid: Inherit the calling task's base priority in `Thread::new`
Tomoaki Kawada [Fri, 28 Jan 2022 08:41:13 +0000 (17:41 +0900)]
kmc-solid: Inherit the calling task's base priority in `Thread::new`

Fixes a spawned task getting an unexpectedly higher priority if it's
spawned by a task whose priority is temporarily boosted by a priority-
protection mutex.

2 years agoAuto merge of #90891 - nbdd0121:format, r=Mark-Simulacrum
bors [Mon, 31 Jan 2022 00:04:46 +0000 (00:04 +0000)]
Auto merge of #90891 - nbdd0121:format, r=Mark-Simulacrum

Create `core::fmt::ArgumentV1` with generics instead of fn pointer

Split from (and prerequisite of) #90488, as this seems to have perf implication.

`@rustbot` label: +T-libs

2 years ago(#93392) Update char::MAX docs and core::char::MAX
George Bateman [Sun, 30 Jan 2022 19:41:52 +0000 (19:41 +0000)]
(#93392) Update char::MAX docs and core::char::MAX

2 years agoHide failed command unless in verbose mode
Mark Rousskov [Sun, 30 Jan 2022 22:37:11 +0000 (17:37 -0500)]
Hide failed command unless in verbose mode

This is particularly intended for invoking compiletest; the command line there
is long (3,350 characters on my system) and takes up a lot of screen real estate
for little benefit to the majority of those running bootstrap. This moves
printing it to verbose mode (-v must be passed) which means that it's still
possible to access when needed for debugging.

The main downside is that CI logs will by-default become less usable for
debugging (particularly) spurious failures, but it is pretty rare for us to
really need the information there -- it's usually fairly obvious what is being
run with a little investigation.

2 years agoreview the total_cmp documentation
Simonas Kazlauskas [Fri, 28 Jan 2022 01:21:30 +0000 (03:21 +0200)]
review the total_cmp documentation

The documentation has been restructured to split out a brief summary
paragraph out from the following elaborating paragraphs.

I also attempted my hand at wording improvements and adding articles
where I felt them missing, but being non-native english speaker these
may need more thorough review.

2 years agoAuto merge of #92711 - zredb:issue-90187-fix, r=notriddle
bors [Sun, 30 Jan 2022 20:57:34 +0000 (20:57 +0000)]
Auto merge of #92711 - zredb:issue-90187-fix, r=notriddle

rustdoc: Remove `def_id_no_primitives`

Fixes #90187.

2 years agoMac calls
David Tolnay [Sun, 30 Jan 2022 06:16:35 +0000 (22:16 -0800)]
Mac calls

2 years agoAccommodate yield points in the format_args expansion
David Tolnay [Sat, 29 Jan 2022 20:05:19 +0000 (12:05 -0800)]
Accommodate yield points in the format_args expansion

2 years agoAdd regression test for issue 93274
David Tolnay [Sat, 29 Jan 2022 19:44:30 +0000 (11:44 -0800)]
Add regression test for issue 93274

Currently fails with:

    error: future cannot be sent between threads safely
      --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:21:17
       |
    LL |     assert_send(with_await());
       |                 ^^^^^^^^^^^^ future returned by `with_await` is not `Send`
       |
       = help: the trait `Sync` is not implemented for `core::fmt::Opaque`
    note: future is not `Send` as this value is used across an await
      --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:11:37
       |
    LL |     println!("{} {:?}", "", async {}.await);
       |     --------------------------------^^^^^^-
       |     |                               |
       |     |                               await occurs here, with `$crate::format_args_nl!($($arg)*)` maybe used later
       |     has type `ArgumentV1<'_>` which is not `Send`
       |     `$crate::format_args_nl!($($arg)*)` is later dropped here
    note: required by a bound in `assert_send`
      --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:18:24
       |
    LL | fn assert_send(_: impl Send) {}
       |                        ^^^^ required by this bound in `assert_send`

    error: future cannot be sent between threads safely
      --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:22:17
       |
    LL |     assert_send(with_macro_call());
       |                 ^^^^^^^^^^^^^^^^^ future returned by `with_macro_call` is not `Send`
       |
       = help: the trait `Sync` is not implemented for `core::fmt::Opaque`
    note: future is not `Send` as this value is used across an await
      --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:6:17
       |
    LL |         async {}.await
       |                 ^^^^^^ await occurs here, with `$crate::format_args_nl!($($arg)*)` maybe used later
    ...
    LL |     println!("{} {:?}", "", m!());
       |     -----------------------------
       |     |                       |
       |     |                       in this macro invocation
       |     has type `ArgumentV1<'_>` which is not `Send`
       |     `$crate::format_args_nl!($($arg)*)` is later dropped here
    note: required by a bound in `assert_send`
      --> $DIR/src/test/ui/fmt/format-with-yield-point.rs:18:24
       |
    LL | fn assert_send(_: impl Send) {}
       |                        ^^^^ required by this bound in `assert_send`
       = note: this error originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: aborting due to 2 previous errors

2 years agoAuto merge of #93482 - ehuss:rollup-qjyppci, r=ehuss
bors [Sun, 30 Jan 2022 18:12:08 +0000 (18:12 +0000)]
Auto merge of #93482 - ehuss:rollup-qjyppci, r=ehuss

Rollup of 5 pull requests

Successful merges:

 - #92887 (Bootstrap compiler update)
 - #92908 (Render more readable macro matcher tokens in rustdoc)
 - #93183 (rustdoc: mobile nav fixes)
 - #93192 (Add VS 2022 into error message)
 - #93475 (Add test to ensure that theme is applied correctly when going back in history)

Failed merges:

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

2 years agocore: Remove some redundant {}s from the sorting code
est31 [Sun, 30 Jan 2022 17:32:24 +0000 (18:32 +0100)]
core: Remove some redundant {}s from the sorting code

2 years agoRollup merge of #93475 - GuillaumeGomez:theme-in-history, r=jsha
Eric Huss [Sun, 30 Jan 2022 16:37:51 +0000 (08:37 -0800)]
Rollup merge of #93475 - GuillaumeGomez:theme-in-history, r=jsha

Add test to ensure that theme is applied correctly when going back in history

Fixes #93258.

r? `@jsha`

2 years agoRollup merge of #93192 - theidexisted:patch-1, r=wesleywiser
Eric Huss [Sun, 30 Jan 2022 16:37:50 +0000 (08:37 -0800)]
Rollup merge of #93192 - theidexisted:patch-1, r=wesleywiser

Add VS 2022 into error message

2 years agoRollup merge of #93183 - jsha:mobile-nav-fixes, r=GuillaumeGomez
Eric Huss [Sun, 30 Jan 2022 16:37:49 +0000 (08:37 -0800)]
Rollup merge of #93183 - jsha:mobile-nav-fixes, r=GuillaumeGomez

rustdoc: mobile nav fixes

- Make sure the mobile-topbar doesn't overflow its height if the user sets a bigger font.

- Make sure the sidebar can be scrolled all the way to the bottom by shortening it to accommodate the mobile-topbar.

- Make the item name in the mobile-topbar clickable to go to the top of the page.

- Remove excess padding sidebar in mobile mode.

Demo https://rustdoc.crud.net/jsha/mobile-nav-fixes/std/string/struct.String.html

r? `@GuillaumeGomez`

2 years agoRollup merge of #92908 - dtolnay:rustdoc, r=GuillaumeGomez
Eric Huss [Sun, 30 Jan 2022 16:37:47 +0000 (08:37 -0800)]
Rollup merge of #92908 - dtolnay:rustdoc, r=GuillaumeGomez

Render more readable macro matcher tokens in rustdoc

Follow-up to #92334.

This PR lifts some of the token rendering logic from https://github.com/dtolnay/prettyplease into rustdoc so that even the matchers for which a source code snippet is not available (because they are macro-generated, or any other reason) follow some baseline good assumptions about where the tokens in the macro matcher are appropriate to space.

The below screenshots show an example of the difference using one of the gnarliest macros I could find. Some things to notice:

- In the **before**, notice how a couple places break in between `$(....)`↵`*`, which is just about the worst possible place that it could break.

- In the **before**, the lines that wrapped are weirdly indented by 1 space of indentation relative to column 0. In the **after**, we use the typical way of block indenting in Rust syntax which is put the open/close delimiters on their own line and indent their contents by 4 spaces relative to the previous line (so 8 spaces relative to column 0, because the matcher itself is indented by 4 relative to the `macro_rules` header).

- In the **after**, macro_rules metavariables like `$tokens:tt` are kept together, which is how just about everybody writing Rust today writes them.

## Before

![Screenshot from 2022-01-14 13-05-53](https://user-images.githubusercontent.com/1940490/149585105-1f182b78-751f-421f-a234-9dbc04fa3bbd.png)

## After

![Screenshot from 2022-01-14 13-06-04](https://user-images.githubusercontent.com/1940490/149585118-d4b52ea7-3e67-4b6e-a12b-31dfb8172f86.png)

r? `@camelid`

2 years agoRollup merge of #92887 - pietroalbini:pa-bootstrap-update, r=Mark-Simulacrum
Eric Huss [Sun, 30 Jan 2022 16:37:46 +0000 (08:37 -0800)]
Rollup merge of #92887 - pietroalbini:pa-bootstrap-update, r=Mark-Simulacrum

Bootstrap compiler update

r? ``@Mark-Simulacrum``

2 years agoRemove deprecated and unstable slice_partition_at_index functions
est31 [Sun, 30 Jan 2022 15:19:03 +0000 (16:19 +0100)]
Remove deprecated and unstable slice_partition_at_index functions

They have been deprecated since commit 01ac5a97c90c26ac35ca9d65f685dd6701edfa3b
which was part of the 1.49.0 release, so from the point of nightly,
11 releases ago.

2 years agoFix an edge case in `chat::DecodeUtf16::size_hint`
Maybe Waffle [Sun, 30 Jan 2022 12:32:21 +0000 (15:32 +0300)]
Fix an edge case in `chat::DecodeUtf16::size_hint`

There are cases, when data in the buf might or might not be an error.

2 years agoAdd test to ensure that theme is applied correctly when going back in history
Guillaume Gomez [Sun, 30 Jan 2022 10:39:10 +0000 (11:39 +0100)]
Add test to ensure that theme is applied correctly when going back in history

2 years agoAuto merge of #93468 - matthiaskrgr:rollup-vxullvd, r=matthiaskrgr
bors [Sun, 30 Jan 2022 10:30:42 +0000 (10:30 +0000)]
Auto merge of #93468 - matthiaskrgr:rollup-vxullvd, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #93256 (Make `join!` description more accurate)
 - #93358 (Add note suggesting that predicate may be satisfied, but is not `const`)
 - #93362 (Do not register infer var for GAT projection in RPIT)
 - #93391 (rustdoc: remove tooltip from source link)
 - #93414 (Move unstable is_{arch}_feature_detected! macros to std::arch)
 - #93441 (rustdoc: load the set of in-scope traits for modules with no docstring)
 - #93459 (fs: Don't copy d_name from struct dirent)
 - #93463 (Rename _args -> args in format_args expansion)

Failed merges:

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

2 years agorustdoc: small fixes to mobile navigation
Jacob Hoffman-Andrews [Sat, 22 Jan 2022 01:44:54 +0000 (17:44 -0800)]
rustdoc: small fixes to mobile navigation

- Make sure the mobile-topbar doesn't overflow its height if the user
  sets a bigger font.

- Make sure the sidebar can be scrolled all the way to the bottom by
  shortening it to accommodate the mobile-topbar.

- Make the item name in the mobile-topbar clickable to go to the top of
  the page.

- Remove excess padding sidebar in mobile mode.

2 years agounix: Use metadata for `DirEntry::file_type` fallback
Josh Stone [Sun, 30 Jan 2022 00:58:18 +0000 (16:58 -0800)]
unix: Use metadata for `DirEntry::file_type` fallback

When `DirEntry::file_type` fails to match a known `d_type`, we should
fall back to `DirEntry::metadata` instead of a bare `lstat`, because
this is faster and more reliable on targets with `fstatat`.

2 years agoRollup merge of #93463 - dtolnay:_args, r=cjgillot
Matthias Krüger [Sat, 29 Jan 2022 23:04:17 +0000 (00:04 +0100)]
Rollup merge of #93463 - dtolnay:_args, r=cjgillot

Rename _args -> args in format_args expansion

As observed in https://github.com/rust-lang/rust/pull/91359#discussion_r786058960, prior to that PR this variable was sometimes never used, such as in the case of:

```rust
println!("");

// used to expand to:
::std::io::_print(
    ::core::fmt::Arguments::new_v1(
        &["\n"],
        &match () {
            _args => [],
        },
    ),
);
```

so the leading underscore in `_args` was used to suppress an unused variable lint. However after #91359 the variable is always used when present, as the unused case would instead expand to:

```rust
::std::io::_print(::core::fmt::Arguments::new_v1(&["\n"], &[]));
```

2 years agoRollup merge of #93459 - tavianator:dirent-copy-only-reclen, r=cuviper
Matthias Krüger [Sat, 29 Jan 2022 23:04:16 +0000 (00:04 +0100)]
Rollup merge of #93459 - tavianator:dirent-copy-only-reclen, r=cuviper

fs: Don't copy d_name from struct dirent

The dirent returned from readdir() is only guaranteed to be valid for
d_reclen bytes on common platforms.  Since we copy the name separately
anyway, we can copy everything except d_name into DirEntry::entry.

Fixes #93384.