]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #92555 - m-ou-se:scoped-threads, r=Amanieu
Matthias Krüger [Sun, 23 Jan 2022 19:13:02 +0000 (20:13 +0100)]
Rollup merge of #92555 - m-ou-se:scoped-threads, r=Amanieu

Implement RFC 3151: Scoped threads.

This implements https://github.com/rust-lang/rfcs/pull/3151

r? `@Amanieu`

2 years agoRollup merge of #91526 - petrochenkov:earlint, r=cjgillot
Matthias Krüger [Sun, 23 Jan 2022 19:13:00 +0000 (20:13 +0100)]
Rollup merge of #91526 - petrochenkov:earlint, r=cjgillot

rustc_lint: Some early linting refactorings

The first one removes and renames some fields and methods from `EarlyContext`.

The second one uses the set of registered tools (for tool attributes and tool lints) in a more centralized way.

The third one removes creation of a fake `ast::Crate` from `fn pre_expansion_lint`.
Pre-expansion linting is done with per-module granularity on freshly loaded modules, and it previously synthesized an `ast::Crate` to visit non-root modules, now they are visited as modules.
The node ID used for pre-expansion linting is also made more precise (the loaded module ID is used).

2 years agoAuto merge of #93066 - nnethercote:infallible-decoder, r=bjorn3
bors [Sun, 23 Jan 2022 15:37:43 +0000 (15:37 +0000)]
Auto merge of #93066 - nnethercote:infallible-decoder, r=bjorn3

Make `Decodable` and `Decoder` infallible.

`Decoder` has two impls:
- opaque: this impl is already partly infallible, i.e. in some places it
  currently panics on failure (e.g. if the input is too short, or on a
  bad `Result` discriminant), and in some places it returns an error
  (e.g. on a bad `Option` discriminant). The number of places where
  either happens is surprisingly small, just because the binary
  representation has very little redundancy and a lot of input reading
  can occur even on malformed data.
- json: this impl is fully fallible, but it's only used (a) for the
  `.rlink` file production, and there's a `FIXME` comment suggesting it
  should change to a binary format, and (b) in a few tests in
  non-fundamental ways. Indeed #85993 is open to remove it entirely.

And the top-level places in the compiler that call into decoding just
abort on error anyway. So the fallibility is providing little value, and
getting rid of it leads to some non-trivial performance improvements.

Much of this PR is pretty boring and mechanical. Some notes about
a few interesting parts:
- The commit removes `Decoder::{Error,error}`.
- `InternIteratorElement::intern_with`: the impl for `T` now has the same
  optimization for small counts that the impl for `Result<T, E>` has,
  because it's now much hotter.
- Decodable impls for SmallVec, LinkedList, VecDeque now all use
  `collect`, which is nice; the one for `Vec` uses unsafe code, because
  that gave better perf on some benchmarks.

r? `@bjorn3`

2 years agoAuto merge of #93047 - matthiaskrgr:defer__dist_PlainSourceTarball, r=Mark-Simulacrum
bors [Sun, 23 Jan 2022 12:29:08 +0000 (12:29 +0000)]
Auto merge of #93047 - matthiaskrgr:defer__dist_PlainSourceTarball, r=Mark-Simulacrum

build: dist: defer PlainSourceTarball

Apparently it changes some tool sources and invalidates their fingerprints, forcing us to build them several times (before and after vendoring sources).
I have not dug into why vendoring actually invalidates the figreprints, but moving the vendoring lower in the pipeline seems to avoid the issue.
I could imagine that we somehow write a .cargo/config somewhere which somehow makes subsequent builds use the vendored deps but I was not able to find anything.

I checked the sizes of generated archives pre and post patch and their are the same, so I hope there is no functional change.

Fixes #93033

2 years agoexpand: Pass everything by reference to pre-expansion lint callback
Vadim Petrochenkov [Sat, 11 Dec 2021 07:32:48 +0000 (15:32 +0800)]
expand: Pass everything by reference to pre-expansion lint callback

2 years agorustc_lint: Stop creating a fake `ast::Crate` for running early lints
Vadim Petrochenkov [Tue, 7 Dec 2021 10:28:12 +0000 (18:28 +0800)]
rustc_lint: Stop creating a fake `ast::Crate` for running early lints

Add a trait generalizing over the crate root and freshly loaded modules instead
This also makes node IDs used for pre-expansion linting more precise

2 years agoUpdate clippy
Vadim Petrochenkov [Sat, 4 Dec 2021 15:09:15 +0000 (23:09 +0800)]
Update clippy

2 years agorustc_lint: Reuse the set of registered tools from resolver
Vadim Petrochenkov [Tue, 28 Sep 2021 22:17:54 +0000 (01:17 +0300)]
rustc_lint: Reuse the set of registered tools from resolver

2 years agorustc_lint: Remove some redundant fields from `EarlyContext`
Vadim Petrochenkov [Mon, 27 Sep 2021 21:28:49 +0000 (00:28 +0300)]
rustc_lint: Remove some redundant fields from `EarlyContext`

Use consistent function parameter order for early context construction and early linting
Rename some functions to make it clear that they do not necessarily work on the whole crate

2 years agoAuto merge of #93220 - matthiaskrgr:rollup-9bkrlk0, r=matthiaskrgr
bors [Sun, 23 Jan 2022 09:16:32 +0000 (09:16 +0000)]
Auto merge of #93220 - matthiaskrgr:rollup-9bkrlk0, r=matthiaskrgr

Rollup of 8 pull requests

Successful merges:

 - #90666 (Stabilize arc_new_cyclic)
 - #91122 (impl Not for !)
 - #93068 (Fix spacing for `·` between stability and source)
 - #93103 (Tweak `expr.await` desugaring `Span`)
 - #93113 (Unify search input and buttons size)
 - #93168 (update uclibc instructions for new toolchain, add link from platforms doc)
 - #93185 (rustdoc: Make some `pub` items crate-private)
 - #93196 (Remove dead code from build_helper)

Failed merges:

 - #93188 (rustdoc: fix bump down typing search on Safari)

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

2 years agoAuto merge of #93165 - eholk:disable-generator-drop-tracking, r=nikomatsakis
bors [Sun, 23 Jan 2022 02:20:50 +0000 (02:20 +0000)]
Auto merge of #93165 - eholk:disable-generator-drop-tracking, r=nikomatsakis

Disable drop range tracking in generators

Generator drop tracking caused an ICE for generators involving the Never type (Issue #93161). Since this breaks a test case with miri, we temporarily disable drop tracking so miri is unblocked while we properly fix the issue.

2 years agoRollup merge of #93196 - mati865:remove-build_helper-dead-code, r=Mark-Simulacrum
Matthias Krüger [Sun, 23 Jan 2022 00:09:47 +0000 (01:09 +0100)]
Rollup merge of #93196 - mati865:remove-build_helper-dead-code, r=Mark-Simulacrum

Remove dead code from build_helper

Tested with `./x.py check` ran on x86_64 Linux.

2 years agoRollup merge of #93185 - camelid:crate-private, r=GuillaumeGomez
Matthias Krüger [Sun, 23 Jan 2022 00:09:46 +0000 (01:09 +0100)]
Rollup merge of #93185 - camelid:crate-private, r=GuillaumeGomez

rustdoc: Make some `pub` items crate-private

They don't need to be `pub`. Making them crate-private improves code
clarity and `dead_code` linting.

2 years agoRollup merge of #93168 - skrap:master, r=Amanieu
Matthias Krüger [Sun, 23 Jan 2022 00:09:45 +0000 (01:09 +0100)]
Rollup merge of #93168 - skrap:master, r=Amanieu

update uclibc instructions for new toolchain, add link from platforms doc

2 quick things:
1) `libc` was updated to make use of features in a uclibc version more recent than the recommended toolchain in the target document, so I updated the link.
2) As has been done with other platforms, link directly from the platform support doc to the target-specific document.

2 years agoRollup merge of #93113 - GuillaumeGomez:unify-sizes, r=jsha
Matthias Krüger [Sun, 23 Jan 2022 00:09:44 +0000 (01:09 +0100)]
Rollup merge of #93113 - GuillaumeGomez:unify-sizes, r=jsha

Unify search input and buttons size

Fixes #93060.

Here what it looks like:

![Screenshot from 2022-01-20 21-38-19](https://user-images.githubusercontent.com/3050060/150418571-fefd6538-b3ee-4dd2-b77b-77e96bcfa0ed.png)
![Screenshot from 2022-01-20 21-38-22](https://user-images.githubusercontent.com/3050060/150418570-53ba259b-9bd4-4084-8b43-d74a5752d712.png)

You can test it [here](https://rustdoc.crud.net/imperio/unify-sizes/std/index.html).

r? ``@jsha``

2 years agoRollup merge of #93103 - estebank:await-span, r=nagisa
Matthias Krüger [Sun, 23 Jan 2022 00:09:43 +0000 (01:09 +0100)]
Rollup merge of #93103 - estebank:await-span, r=nagisa

Tweak `expr.await` desugaring `Span`

Fix #93074

2 years agoRollup merge of #93068 - jsha:dot-spacing, r=GuillaumeGomez
Matthias Krüger [Sun, 23 Jan 2022 00:09:42 +0000 (01:09 +0100)]
Rollup merge of #93068 - jsha:dot-spacing, r=GuillaumeGomez

Fix spacing for `·` between stability and source

This puts in an actual space (by adjusting the space-eating operators in our templates), updates the test, and remove the now-unnecessary CSS rule.

r? ``@GuillaumeGomez``

2 years agoRollup merge of #91122 - dtolnay:not, r=m-ou-se
Matthias Krüger [Sun, 23 Jan 2022 00:09:41 +0000 (01:09 +0100)]
Rollup merge of #91122 - dtolnay:not, r=m-ou-se

impl Not for !

The lack of this impl caused trouble for me in some degenerate cases of macro-generated code of the form `if !$cond {...}`, even without `feature(never_type)` on a stable compiler. Namely if `$cond` contains a `return` or `break` or similar diverging expression, which would otherwise be perfectly legal in boolean position, the code previously failed to compile with:

```console
error[E0600]: cannot apply unary operator `!` to type `!`
   --> library/core/tests/ops.rs:239:8
    |
239 |     if !return () {}
    |        ^^^^^^^^^^ cannot apply unary operator `!`
```

2 years agoRollup merge of #90666 - bdbai:arc_new_cyclic, r=m-ou-se
Matthias Krüger [Sun, 23 Jan 2022 00:09:40 +0000 (01:09 +0100)]
Rollup merge of #90666 - bdbai:arc_new_cyclic, r=m-ou-se

Stabilize arc_new_cyclic

This stabilizes feature `arc_new_cyclic` as the implementation has been merged for one year and there is no unresolved questions. The FCP is not started yet.

Closes #75861 .

``@rustbot`` label +T-libs-api

2 years agoAuto merge of #92998 - Amanieu:hashbrown12, r=Mark-Simulacrum
bors [Sat, 22 Jan 2022 23:39:21 +0000 (23:39 +0000)]
Auto merge of #92998 - Amanieu:hashbrown12, r=Mark-Simulacrum

Update hashbrown to 0.12.0

[Changelog](https://github.com/rust-lang/hashbrown/blob/master/CHANGELOG.md#v0120---2022-01-17)

2 years agoAuto merge of #93202 - matthiaskrgr:rollup-rki39xg, r=matthiaskrgr
bors [Sat, 22 Jan 2022 19:26:42 +0000 (19:26 +0000)]
Auto merge of #93202 - matthiaskrgr:rollup-rki39xg, r=matthiaskrgr

Rollup of 9 pull requests

Successful merges:

 - #85967 (add support for the l4-bender linker on the x86_64-unknown-l4re-uclibc tier 3 target)
 - #92828 (Print a helpful message if unwinding aborts when it reaches a nounwind function)
 - #93012 (Update pulldown-cmark version to fix markdown list issue)
 - #93116 (Simplify use of `map_or`)
 - #93132 (Increase the format version of rustdoc-json-types)
 - #93147 (Interner cleanups)
 - #93153 (Reject unsupported naked functions)
 - #93170 (Add missing GUI test explanations)
 - #93172 (rustdoc: remove dashed underline under main heading)

Failed merges:

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

2 years agoupdate uclibc instructions for new toolchain, add link from platforms doc
Jonah Petri [Fri, 21 Jan 2022 18:08:14 +0000 (13:08 -0500)]
update uclibc instructions for new toolchain, add link from platforms doc

2 years agoAdd test for thread::Scope invariance.
Mara Bos [Sat, 22 Jan 2022 16:15:08 +0000 (17:15 +0100)]
Add test for thread::Scope invariance.

2 years agoUpdate stabilization version of arc_new_cyclic
Mara Bos [Sat, 22 Jan 2022 15:48:42 +0000 (15:48 +0000)]
Update stabilization version of arc_new_cyclic

2 years agoAdd tracking issue number for scoped_threads.
Mara Bos [Sat, 22 Jan 2022 15:03:23 +0000 (16:03 +0100)]
Add tracking issue number for scoped_threads.

2 years agoSimplify Send/Sync of std::thread::Packet.
Mara Bos [Sat, 22 Jan 2022 15:02:18 +0000 (16:02 +0100)]
Simplify Send/Sync of std::thread::Packet.

2 years agoRollup merge of #93172 - jsha:re-remove-line, r=camelid
Matthias Krüger [Sat, 22 Jan 2022 14:32:57 +0000 (15:32 +0100)]
Rollup merge of #93172 - jsha:re-remove-line, r=camelid

rustdoc: remove dashed underline under main heading

This was removed in #92797 but accidentally re-introduced by a bad merge in #92861.

r? ```@camelid```

2 years agoRollup merge of #93170 - GuillaumeGomez:gui-tests-explanations, r=jsha
Matthias Krüger [Sat, 22 Jan 2022 14:32:55 +0000 (15:32 +0100)]
Rollup merge of #93170 - GuillaumeGomez:gui-tests-explanations, r=jsha

Add missing GUI test explanations

Some GUI tests didn't have a global explanation about what they were testing. This fixes it.

r? ```@jsha```

2 years agoRollup merge of #93153 - tmiasko:reject-unsupported-naked-functions, r=Amanieu
Matthias Krüger [Sat, 22 Jan 2022 14:32:54 +0000 (15:32 +0100)]
Rollup merge of #93153 - tmiasko:reject-unsupported-naked-functions, r=Amanieu

Reject unsupported naked functions

Transition unsupported naked functions future incompatibility lint into an error:

* Naked functions must contain a single inline assembly block. Introduced as future incompatibility lint in 1.50 #79653. Change into an error fixes a soundness issue described in #32489.

* Naked functions must not use any forms of inline attribute. Introduced as future incompatibility lint in 1.56 #87652.

Closes #32490.
Closes #32489.

r? ```@Amanieu``` ```@npmccallum``` ```@joshtriplett```

2 years agoRollup merge of #93147 - nnethercote:interner-cleanups, r=lcnr
Matthias Krüger [Sat, 22 Jan 2022 14:32:53 +0000 (15:32 +0100)]
Rollup merge of #93147 - nnethercote:interner-cleanups, r=lcnr

Interner cleanups

Improve some code that I have found confusing.

r? ```@lcnr```

2 years agoRollup merge of #93132 - Urgau:fix-rustdoc-json-format-version, r=oli-obk
Matthias Krüger [Sat, 22 Jan 2022 14:32:52 +0000 (15:32 +0100)]
Rollup merge of #93132 - Urgau:fix-rustdoc-json-format-version, r=oli-obk

Increase the format version of rustdoc-json-types

PR https://github.com/rust-lang/rust/pull/87648 changed `rustdoc-json-types` without increasing the format version.
https://github.com/rust-lang/rust/commit/e7529d6a3867ed1692818702b40814ee992eba2d#diff-ede26372490522288745c5b3df2b6b2a1cc913dcd09b29af3a49935afe00c7e6

This PR increase the format version by +1 and move the `FORMAT_VERSION` constant to the start of the file to hopefully make it more clear that `rustdoc-json-types` is versioned.

2 years agoRollup merge of #93116 - rust-lang:oli-obk-patch-1, r=jackh726
Matthias Krüger [Sat, 22 Jan 2022 14:32:51 +0000 (15:32 +0100)]
Rollup merge of #93116 - rust-lang:oli-obk-patch-1, r=jackh726

Simplify use of `map_or`

2 years agoRollup merge of #93012 - GuillaumeGomez:pulldown-list, r=camelid
Matthias Krüger [Sat, 22 Jan 2022 14:32:50 +0000 (15:32 +0100)]
Rollup merge of #93012 - GuillaumeGomez:pulldown-list, r=camelid

Update pulldown-cmark version to fix markdown list issue

Fixes #92971.

r? ```@camelid```

2 years agoRollup merge of #92828 - Amanieu:unwind-abort, r=dtolnay
Matthias Krüger [Sat, 22 Jan 2022 14:32:49 +0000 (15:32 +0100)]
Rollup merge of #92828 - Amanieu:unwind-abort, r=dtolnay

Print a helpful message if unwinding aborts when it reaches a nounwind function

This is implemented by routing `TerminatorKind::Abort` back through the panic handler, but with a special flag in the `PanicInfo` which indicates that the panic handler should *not* attempt to unwind the stack and should instead abort immediately.

This is useful for the planned change in https://github.com/rust-lang/lang-team/issues/97 which would make `Drop` impls `nounwind` by default.

### Code

```rust
#![feature(c_unwind)]

fn panic() {
    panic!()
}

extern "C" fn nounwind() {
    panic();
}

fn main() {
    nounwind();
}
```

### Before

```
$ ./test
thread 'main' panicked at 'explicit panic', test.rs:4:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Illegal instruction (core dumped)
```

### After

```
$ ./test
thread 'main' panicked at 'explicit panic', test.rs:4:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at 'panic in a function that cannot unwind', test.rs:7:1
stack backtrace:
   0:     0x556f8f86ec9b - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hdccefe11a6ac4396
   1:     0x556f8f88ac6c - core::fmt::write::he152b28c41466ebb
   2:     0x556f8f85d6e2 - std::io::Write::write_fmt::h0c261480ab86f3d3
   3:     0x556f8f8654fa - std::panicking::default_hook::{{closure}}::h5d7346f3ff7f6c1b
   4:     0x556f8f86512b - std::panicking::default_hook::hd85803a1376cac7f
   5:     0x556f8f865a91 - std::panicking::rust_panic_with_hook::h4dc1c5a3036257ac
   6:     0x556f8f86f079 - std::panicking::begin_panic_handler::{{closure}}::hdda1d83c7a9d34d2
   7:     0x556f8f86edc4 - std::sys_common::backtrace::__rust_end_short_backtrace::h5b70ed0cce71e95f
   8:     0x556f8f865592 - rust_begin_unwind
   9:     0x556f8f85a764 - core::panicking::panic_no_unwind::h2606ab3d78c87899
  10:     0x556f8f85b910 - test::nounwind::hade6c7ee65050347
  11:     0x556f8f85b936 - test::main::hdc6e02cb36343525
  12:     0x556f8f85b7e3 - core::ops::function::FnOnce::call_once::h4d02663acfc7597f
  13:     0x556f8f85b739 - std::sys_common::backtrace::__rust_begin_short_backtrace::h071d40135adb0101
  14:     0x556f8f85c149 - std::rt::lang_start::{{closure}}::h70dbfbf38b685e93
  15:     0x556f8f85c791 - std::rt::lang_start_internal::h798f1c0268d525aa
  16:     0x556f8f85c131 - std::rt::lang_start::h476a7ee0a0bb663f
  17:     0x556f8f85b963 - main
  18:     0x7f64c0822b25 - __libc_start_main
  19:     0x556f8f85ae8e - _start
  20:                0x0 - <unknown>
thread panicked while panicking. aborting.
Aborted (core dumped)
```

2 years agoRollup merge of #85967 - atopia:update-l4re-target, r=petrochenkov
Matthias Krüger [Sat, 22 Jan 2022 14:32:48 +0000 (15:32 +0100)]
Rollup merge of #85967 - atopia:update-l4re-target, r=petrochenkov

add support for the l4-bender linker on the x86_64-unknown-l4re-uclibc tier 3 target

This PR contains the work by ```@humenda``` to update support for the `x86_64-unknown-l4re-uclibc` tier 3 target (published at [humenda/rust](https://github.com/humenda/rust)), rebased and adapted to current rust in follow up commits by myself. The publishing of the rebased changes is authorized and preferred by the original author. As the goal was to distort the original work as little as possible, individual commits introduce changes that are incompatible to the newer code base that the changes were rebased on. These incompatibilities have been remedied in follow up commits, so that the PR as a whole should result in a clean update of the target.
If you prefer another strategy to mainline these changes while preserving attribution, please let me know.

2 years agoDisable test_try_reserve on Android
Amanieu d'Antras [Sat, 22 Jan 2022 13:51:57 +0000 (13:51 +0000)]
Disable test_try_reserve on Android

2 years agoRemove dead code from build_helper
Mateusz Mikuła [Sat, 22 Jan 2022 11:06:44 +0000 (12:06 +0100)]
Remove dead code from build_helper

2 years agorustdoc: Make some `pub` items crate-private
Noah Lev [Sat, 22 Jan 2022 02:41:34 +0000 (18:41 -0800)]
rustdoc: Make some `pub` items crate-private

They don't need to be `pub`. Making them crate-private improves code
clarity and `dead_code` linting.

2 years agoAuto merge of #93173 - matthiaskrgr:rollup-49bj7ta, r=matthiaskrgr
bors [Fri, 21 Jan 2022 23:52:58 +0000 (23:52 +0000)]
Auto merge of #93173 - matthiaskrgr:rollup-49bj7ta, r=matthiaskrgr

Rollup of 10 pull requests

Successful merges:

 - #91965 (Add more granular `--exclude` in `x.py`)
 - #92467 (Ensure that early-bound function lifetimes are always 'local')
 - #92586 (Set the allocation MIN_ALIGN for espidf to 4.)
 - #92835 (Improve error message for key="value" cfg arguments.)
 - #92843 (Improve string concatenation suggestion)
 - #92963 (Implement tuple array diagnostic)
 - #93046 (Use let_else in even more places)
 - #93109 (Improve `Arc` and `Rc` documentation)
 - #93134 (delete `Stdin::split` forwarder)
 - #93139 (rustdoc: fix overflow-wrap for table layouts)

Failed merges:

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

2 years agoAddress review comments.
Nicholas Nethercote [Wed, 19 Jan 2022 22:59:30 +0000 (09:59 +1100)]
Address review comments.

2 years agoMake `Decodable` and `Decoder` infallible.
Nicholas Nethercote [Tue, 18 Jan 2022 02:22:50 +0000 (13:22 +1100)]
Make `Decodable` and `Decoder` infallible.

`Decoder` has two impls:
- opaque: this impl is already partly infallible, i.e. in some places it
  currently panics on failure (e.g. if the input is too short, or on a
  bad `Result` discriminant), and in some places it returns an error
  (e.g. on a bad `Option` discriminant). The number of places where
  either happens is surprisingly small, just because the binary
  representation has very little redundancy and a lot of input reading
  can occur even on malformed data.
- json: this impl is fully fallible, but it's only used (a) for the
  `.rlink` file production, and there's a `FIXME` comment suggesting it
  should change to a binary format, and (b) in a few tests in
  non-fundamental ways. Indeed #85993 is open to remove it entirely.

And the top-level places in the compiler that call into decoding just
abort on error anyway. So the fallibility is providing little value, and
getting rid of it leads to some non-trivial performance improvements.

Much of this commit is pretty boring and mechanical. Some notes about
a few interesting parts:
- The commit removes `Decoder::{Error,error}`.
- `InternIteratorElement::intern_with`: the impl for `T` now has the same
  optimization for small counts that the impl for `Result<T, E>` has,
  because it's now much hotter.
- Decodable impls for SmallVec, LinkedList, VecDeque now all use
  `collect`, which is nice; the one for `Vec` uses unsafe code, because
  that gave better perf on some benchmarks.

2 years agoRename `Decoder::read_nil` and `read_unit`.
Nicholas Nethercote [Wed, 19 Jan 2022 01:09:19 +0000 (12:09 +1100)]
Rename `Decoder::read_nil` and `read_unit`.

Because `()` is called "unit" and it makes it match
`Encoder::emit_unit`.

2 years agoFix spacing for `·` between stability and source
Jacob Hoffman-Andrews [Wed, 19 Jan 2022 06:54:58 +0000 (22:54 -0800)]
Fix spacing for `·` between stability and source

2 years agoUnify search input and buttons size
Guillaume Gomez [Thu, 20 Jan 2022 13:18:59 +0000 (14:18 +0100)]
Unify search input and buttons size

2 years agoRollup merge of #93139 - jsha:fix-wrapped-names, r=Nemo157
Matthias Krüger [Fri, 21 Jan 2022 21:03:20 +0000 (22:03 +0100)]
Rollup merge of #93139 - jsha:fix-wrapped-names, r=Nemo157

rustdoc: fix overflow-wrap for table layouts

For all table layouts, set overflow-wrap: break-word.

Fixes #93135

Demo: https://rustdoc.crud.net/jsha/fix-wrapped-names/std/intrinsics/index.html#functions

(Compare vs https://doc.rust-lang.org/nightly/std/intrinsics/index.html - you may have to make your browser narrower to see the effect)

r? `@Nemo157`

2 years agoRollup merge of #93134 - tlyu:delete-stdin-split, r=Amanieu
Matthias Krüger [Fri, 21 Jan 2022 21:03:19 +0000 (22:03 +0100)]
Rollup merge of #93134 - tlyu:delete-stdin-split, r=Amanieu

delete `Stdin::split` forwarder

Part of #87096. Delete the `Stdin::split` forwarder because it's seen as too niche to expose at this level.

`@rustbot` label T-libs-api A-io

2 years agoRollup merge of #93109 - JakobDegen:arc-docs, r=m-ou-se
Matthias Krüger [Fri, 21 Jan 2022 21:03:18 +0000 (22:03 +0100)]
Rollup merge of #93109 - JakobDegen:arc-docs, r=m-ou-se

Improve `Arc` and `Rc` documentation

This makes two changes (I can split the PR if necessary, but the changes are pretty small):
 1. A bunch of trait implementations claimed to be zero cost; however, they use the `Arc<T>: From<Box<T>>` impl which is definitely not free, especially for large dynamically sized `T`.
 2.  The code in deferred initialization examples unnecessarily used excessive amounts of `unsafe`. This has been reduced.

2 years agoRollup merge of #93046 - est31:let_else, r=davidtwco
Matthias Krüger [Fri, 21 Jan 2022 21:03:17 +0000 (22:03 +0100)]
Rollup merge of #93046 - est31:let_else, r=davidtwco

Use let_else in even more places

Followup of #89933, #91018, #91481.

2 years agoRollup merge of #92963 - terrarier2111:tuple-diagnostic, r=davidtwco
Matthias Krüger [Fri, 21 Jan 2022 21:03:16 +0000 (22:03 +0100)]
Rollup merge of #92963 - terrarier2111:tuple-diagnostic, r=davidtwco

Implement tuple array diagnostic

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

2 years agoRollup merge of #92843 - camelid:str-concat-sugg, r=davidtwco
Matthias Krüger [Fri, 21 Jan 2022 21:03:15 +0000 (22:03 +0100)]
Rollup merge of #92843 - camelid:str-concat-sugg, r=davidtwco

Improve string concatenation suggestion

Before:

    error[E0369]: cannot add `&str` to `&str`
     --> file.rs:2:22
      |
    2 |     let _x = "hello" + " world";
      |              ------- ^ -------- &str
      |              |       |
      |              |       `+` cannot be used to concatenate two `&str` strings
      |              &str
      |
    help: `to_owned()` can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left
      |
    2 |     let _x = "hello".to_owned() + " world";
      |              ~~~~~~~~~~~~~~~~~~

After:

    error[E0369]: cannot add `&str` to `&str`
     --> file.rs:2:22
      |
    2 |     let _x = "hello" + " world";
      |              ------- ^ -------- &str
      |              |       |
      |              |       `+` cannot be used to concatenate two `&str` strings
      |              &str
      |
      = note: string concatenation requires an owned `String` on the left
    help: create an owned `String` from a string reference
      |
    2 |     let _x = "hello".to_owned() + " world";
      |                     +++++++++++

2 years agoRollup merge of #92835 - iwanders:issue-66450-improve-cfg-error-message, r=nagisa
Matthias Krüger [Fri, 21 Jan 2022 21:03:14 +0000 (22:03 +0100)]
Rollup merge of #92835 - iwanders:issue-66450-improve-cfg-error-message, r=nagisa

Improve error message for key="value" cfg arguments.

Hi, I ran into difficulties using the `--cfg` flag syntax, first hit when googling for the error was issue https://github.com/rust-lang/rust/issues/66450. Reading that issue, it sounded like the best way to improve the experience was to improve the error message, this is low risk and doesn't introduce any additional argument parsing.

The issue mentions that it is entirely dependent on the shell, while this may be true, I think guiding the the user into the realization that the quotes may need to be escaped is helpful. The two suggested escapings both work in Bash and in the Windows command prompt.

fyi `@ehuss`

2 years agoRollup merge of #92586 - esp-rs:bugfix/allocation-alignment-espidf, r=yaahc
Matthias Krüger [Fri, 21 Jan 2022 21:03:13 +0000 (22:03 +0100)]
Rollup merge of #92586 - esp-rs:bugfix/allocation-alignment-espidf, r=yaahc

Set the allocation MIN_ALIGN for espidf to 4.

Closes https://github.com/esp-rs/rust/issues/99.

cc: `@ivmarkov`

2 years agoRollup merge of #92467 - Aaron1011:extern-local-region, r=oli-obk
Matthias Krüger [Fri, 21 Jan 2022 21:03:12 +0000 (22:03 +0100)]
Rollup merge of #92467 - Aaron1011:extern-local-region, r=oli-obk

Ensure that early-bound function lifetimes are always 'local'

During borrowchecking, we treat any free (early-bound) regions on
the 'defining type' as `RegionClassification::External`. According
to the doc comments, we should only have 'external' regions when
checking a closure/generator.

However, a plain function can also have some if its regions
be considered 'early bound' - this occurs when the region is
constrained by an argument, appears in a `where` clause, or
in an opaque type. This was causing us to incorrectly mark these
regions as 'external', which caused some diagnostic code
to act as if we were referring to a 'parent' region from inside
a closure.

This PR marks all instantiated region variables as 'local'
when we're borrow-checking something other than a
closure/generator/inline-const.

2 years agoRollup merge of #91965 - ferrocene:pa-more-granular-exclude, r=Mark-Simulacrum
Matthias Krüger [Fri, 21 Jan 2022 21:03:11 +0000 (22:03 +0100)]
Rollup merge of #91965 - ferrocene:pa-more-granular-exclude, r=Mark-Simulacrum

Add more granular `--exclude` in `x.py`

x.py has support for excluding some steps from the current invocation, but unfortunately that's not granular enough: some steps have the same name in different modules, and that prevents excluding only *some* of them.

As a practical example, let's say you need to run everything in `./x.py test` except for the standard library tests, as those tests require IPv6 and need to be executed on a separate machine. Before this commit, if you were to just run this:

    ./x.py test --exclude library/std

...the invocation would eventually fail, as that would not only exclude running the tests for the standard library (`library/std` in the `test` module), it would also exclude generating its documentation (`library/std` in the `doc` module), breaking linkchecker.

This commit adds support to the `--exclude` flag for prefixing paths with the name of the module their step is defined in, allowing the user to choose which module to exclude from:

    ./x.py test --exclude test::library/std

This maintains backward compatibility with existing invocations, while allowing more ganular exclusion. Examples of the behavior:

| `--exclude`         | Docs    | Tests   |
| ------------------- | ------- | ------- |
| `library/std`       | Skipped | Skipped |
| `doc::library/std`  | Skipped | Run     |
| `test::library/std` | Run     | Skipped |

Note that this PR only changes the `--exclude` flag, and not in other `x.py` arguments or flags yet.

In the implementation I tried to limit the impact this would have with rustbuild as a whole as much as possible. The module name is extracted from the step by parsing the result of `std::any::type_name()`: unfortunately that output can change at any point in time, but IMO it's better than having to annotate all the existing and future `Step` implementations with the module name. I added a test to ensure the parsing works as expected, so hopefully if anyone makes changes to the output of `std::any::type_name()` they'll also notice they have to update rustbuild.

r? `@Mark-Simulacrum`

2 years agoAuto merge of #92363 - the8472:less-compiletest-normalization, r=Mark-Simulacrum
bors [Fri, 21 Jan 2022 20:47:48 +0000 (20:47 +0000)]
Auto merge of #92363 - the8472:less-compiletest-normalization, r=Mark-Simulacrum

Override rustc version in ui and mir-opt tests to get stable hashes

Building a dozen separate regexps for each test in compiletest consumes significant amounts of CPU cycles.

UI test timings on my machine:

OLD: 39.63s
NEW: 30.27s

2 years agorustdoc: remove dashed underline under main heading
Jacob Hoffman-Andrews [Fri, 21 Jan 2022 20:04:59 +0000 (12:04 -0800)]
rustdoc: remove dashed underline under main heading

2 years agoAdd missing GUI test explanations
Guillaume Gomez [Fri, 21 Jan 2022 19:41:47 +0000 (20:41 +0100)]
Add missing GUI test explanations

2 years agoAdd reference to breakage this works around
Eric Holk [Fri, 21 Jan 2022 19:06:14 +0000 (11:06 -0800)]
Add reference to breakage this works around

2 years agoAdd regression test for #93161
Eric Holk [Fri, 21 Jan 2022 17:48:39 +0000 (09:48 -0800)]
Add regression test for #93161

2 years agoAuto merge of #92983 - pietroalbini:pa-bump-runner-images, r=Mark-Simulacrum
bors [Fri, 21 Jan 2022 17:43:39 +0000 (17:43 +0000)]
Auto merge of #92983 - pietroalbini:pa-bump-runner-images, r=Mark-Simulacrum

Update Linux runners to Ubuntu 20.04

r? `@Mark-Simulacrum`

2 years agoDisable drop range tracking in generators
Eric Holk [Fri, 21 Jan 2022 17:36:24 +0000 (09:36 -0800)]
Disable drop range tracking in generators

Generator drop tracking caused an ICE for generators involving the Never
type (Issue #93161). Since this breaks miri, we temporarily disable drop
tracking so miri is unblocked while we properly fix the issue.

2 years agoUpdate HashMap::try_reserve test to version from hashbrown
Amanieu d'Antras [Fri, 21 Jan 2022 17:17:00 +0000 (17:17 +0000)]
Update HashMap::try_reserve test to version from hashbrown

2 years agoUpdate hashbrown to 0.12.0
Amanieu d'Antras [Mon, 17 Jan 2022 07:46:11 +0000 (07:46 +0000)]
Update hashbrown to 0.12.0

2 years agoGate `l4-bender` linker flavor
Vadim Petrochenkov [Fri, 7 Jan 2022 10:03:07 +0000 (18:03 +0800)]
Gate `l4-bender` linker flavor

2 years agoadapt L4Bender implementation
Benjamin Lamowski [Mon, 31 May 2021 12:34:23 +0000 (14:34 +0200)]
adapt L4Bender implementation

- Fix style errors.

- L4-bender does not yet support dynamic linking.

- Stack unwinding is not yet supported for x86_64-unknown-l4re-uclibc.
  For now, just abort on panics.

- Use GNU-style linker options where possible. As suggested by review:
    - Use standard GNU-style ld syntax for relro flags.
    - Use standard GNU-style optimization flags and logic.
    - Use standard GNU-style ld syntax for --subsystem.

- Don't read environment variables in L4Bender linker. Thanks to
  CARGO_ENCODED_RUSTFLAGS introduced in #9601, l4-bender's arguments can
  now be passed from the L4Re build system without resorting to custom
  parsing of environment variables.

2 years agoOld versions of Android generate SIGSEGV from libc::abort
Amanieu d'Antras [Fri, 21 Jan 2022 15:44:57 +0000 (15:44 +0000)]
Old versions of Android generate SIGSEGV from libc::abort

2 years agoAdd L4Bender as linker variant
Sebastian Humenda [Tue, 3 Apr 2018 12:53:13 +0000 (14:53 +0200)]
Add L4Bender as linker variant

2 years agoAuto merge of #92787 - camsteffen:methodcall-span, r=Mark-Simulacrum
bors [Fri, 21 Jan 2022 14:33:17 +0000 (14:33 +0000)]
Auto merge of #92787 - camsteffen:methodcall-span, r=Mark-Simulacrum

Remove a `Span` from `hir::ExprKind::MethodCall`

It's just a copy of `MethodCall.0.ident.span`.

2 years agoRemove a span from hir::ExprKind::MethodCall
Cameron Steffen [Wed, 1 Dec 2021 17:17:50 +0000 (11:17 -0600)]
Remove a span from hir::ExprKind::MethodCall

2 years agoAuto merge of #92896 - lqd:update-deps, r=Mark-Simulacrum
bors [Fri, 21 Jan 2022 10:38:30 +0000 (10:38 +0000)]
Auto merge of #92896 - lqd:update-deps, r=Mark-Simulacrum

Update some rustc dependencies to deduplicate them

This PR updates `rand` and `itertools` in rustc (not the whole workspace) in order to deduplicate them (and hopefully slightly improve compile times).

~~Currently, `object` is still duplicated, but https://github.com/rust-lang/thorin/pull/15 and updating `thorin` in the future will remove the use of version 0.27.~~  Update: Thorin 0.2 has now been released, and this PR updates `rustc_codegen_ssa` to use it and deduplicate the `object` crate.

There's a final tiny rustc dependency, `cfg-if`, which will be left: as both versions 0.1.x and 1.0 looked to be heavily depended on, they will require a few cascading updates to be removed.

2 years agoallow excluding paths only from a single module
Pietro Albini [Wed, 15 Dec 2021 11:51:26 +0000 (12:51 +0100)]
allow excluding paths only from a single module

x.py has support for excluding some steps from the invocation, but
unfortunately that's not granular enough: some steps have the same name
in different modules, and that prevents excluding only *some* of them.

As a practical example, let's say you need to run everything in `./x.py
test` except for the standard library tests, as those tests require IPv6
and need to be executed on a separate machine. Before this commit, if
you were to just run this:

    ./x.py test --exclude library/std

...the execution would fail, as that would not only exclude running the
tests for the standard library, it would also exclude generating its
documentation (breaking linkchecker).

This commit adds support for an optional module annotation in --exclude
paths, allowing the user to choose which module to exclude from:

    ./x.py test --exclude test::library/std

This maintains backward compatibility, but also allows for more ganular
exclusion. More examples on how this works:

| `--exclude`         | Docs    | Tests   |
| ------------------- | ------- | ------- |
| `library/std`       | Skipped | Skipped |
| `doc::library/std`  | Skipped | Run     |
| `test::library/std` | Run     | Skipped |

Note that the new behavior only works in the `--exclude` flag, and not
in other x.py arguments or flags yet.

2 years agoreplace paths in PathSet with a dedicated TaskPath struct
Pietro Albini [Wed, 15 Dec 2021 11:50:06 +0000 (12:50 +0100)]
replace paths in PathSet with a dedicated TaskPath struct

2 years agoAuto merge of #91359 - dtolnay:args, r=Mark-Simulacrum
bors [Fri, 21 Jan 2022 06:20:18 +0000 (06:20 +0000)]
Auto merge of #91359 - dtolnay:args, r=Mark-Simulacrum

Emit simpler code from format_args

I made this PR so that `cargo expand` dumps a less overwhelming amount of formatting-related code.

<br>

`println!("rust")` **Before:**

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

**After:**

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

`println!("{}", x)` **Before:**

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

**After:**

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

2 years agoClarify some code relating to interning and types.
Nicholas Nethercote [Fri, 21 Jan 2022 02:25:26 +0000 (13:25 +1100)]
Clarify some code relating to interning and types.

I have found this code very confusing at times. This commit clarifies
things.

In particular, the commit explains the requirements that the `Borrow`
impls put on the `Eq` and `Hash` impls, which are non-obvious. And it
puts the `Borrow` impls first, since they force `Eq` and `Hash` to have
particular forms.

The commit also notes `TyS`'s uniqueness requirements.

2 years agoAuto merge of #93138 - matthiaskrgr:rollup-m8akifd, r=matthiaskrgr
bors [Fri, 21 Jan 2022 03:04:43 +0000 (03:04 +0000)]
Auto merge of #93138 - matthiaskrgr:rollup-m8akifd, r=matthiaskrgr

Rollup of 17 pull requests

Successful merges:

 - #91032 (Introduce drop range tracking to generator interior analysis)
 - #92856 (Exclude "test" from doc_auto_cfg)
 - #92860 (Fix errors on blanket impls by ignoring the children of generated impls)
 - #93038 (Fix star handling in block doc comments)
 - #93061 (Only suggest adding `!` to expressions that can be macro invocation)
 - #93067 (rustdoc mobile: fix scroll offset when jumping to internal id)
 - #93086 (Add tests to ensure that `let_chains` works with `if_let_guard`)
 - #93087 (Fix src/test/run-make/raw-dylib-alt-calling-convention)
 - #93091 (⬆ chalk to 0.76.0)
 - #93094 (src/test/rustdoc-json: Check for `struct_field`s in `variant_tuple_struct.rs`)
 - #93098 (Show a more informative panic message when `DefPathHash` does not exist)
 - #93099 (rustdoc: auto create output directory when "--output-format json")
 - #93102 (Pretty printer algorithm revamp step 3)
 - #93104 (Support --bless for pp-exact pretty printer tests)
 - #93114 (update comment for `ensure_monomorphic_enough`)
 - #93128 (Add script to prevent point releases with same number as existing ones)
 - #93136 (Backport the 1.58.1 release notes to master)

Failed merges:

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

2 years agoReject may_unwind option in naked functions
Tomasz Miąsko [Fri, 21 Jan 2022 00:00:00 +0000 (00:00 +0000)]
Reject may_unwind option in naked functions

2 years agoReject unsupported naked functions
Tomasz Miąsko [Fri, 21 Jan 2022 00:00:00 +0000 (00:00 +0000)]
Reject unsupported naked functions

Transition unsupported naked functions future incompatibility lint into
an error:

* Naked functions must contain a single inline assembly block.
  Introduced as future incompatibility lint in 1.50 #79653.
  Change into an error fixes a soundness issue described in #32489.

* Naked functions must not use any forms of inline attribute.
  Introduced as future incompatibility lint in 1.56 #87652.

2 years agorustdoc: fix overflow-wrap for table layouts
Jacob Hoffman-Andrews [Thu, 20 Jan 2022 22:47:26 +0000 (14:47 -0800)]
rustdoc: fix overflow-wrap for table layouts

For all table layouts, set overflow-wrap: break-word.

2 years agouse lazy_static to compile `Regex::new` instances once instead on each test
The 8472 [Wed, 5 Jan 2022 05:40:46 +0000 (06:40 +0100)]
use lazy_static to compile `Regex::new` instances once instead on each test

2 years agoOverride rustc version in ui and mir-opt tests to get stable hashes
The 8472 [Tue, 28 Dec 2021 18:05:03 +0000 (19:05 +0100)]
Override rustc version in ui and mir-opt tests to get stable hashes

Building a dozen separate regexps for each test in compiletest consumes significant amounts of CPU cycles.
Using `RUSTC_FORCE_INCR_COMP_ARTIFACT_HEADER` stabilizes hashes calcuated for the individual tests so
no test-dependent normalization is needed. Hashes for the standard library still change so some
normalizations are still needed.

2 years agoMake stability interning follow the usual pattern.
Nicholas Nethercote [Thu, 20 Jan 2022 23:14:18 +0000 (10:14 +1100)]
Make stability interning follow the usual pattern.

2 years agoRollup merge of #93136 - pietroalbini:pa-1.58.1-relnotes-master, r=pietroalbini
Matthias Krüger [Thu, 20 Jan 2022 22:37:44 +0000 (23:37 +0100)]
Rollup merge of #93136 - pietroalbini:pa-1.58.1-relnotes-master, r=pietroalbini

Backport the 1.58.1 release notes to master

r? `@ghost`

2 years agoRollup merge of #93128 - pietroalbini:pa-verify-stable-version-number, r=Mark-Simulacrum
Matthias Krüger [Thu, 20 Jan 2022 22:37:43 +0000 (23:37 +0100)]
Rollup merge of #93128 - pietroalbini:pa-verify-stable-version-number, r=Mark-Simulacrum

Add script to prevent point releases with same number as existing ones

This will hopefully prevent what happened today with #93110 and #93121, where we built point release artifacts without changing version numbers, thus requiring another PR to change the version number.

r? `@Mark-Simulacrum`

2 years agoRollup merge of #93114 - lcnr:mk_array, r=RalfJung
Matthias Krüger [Thu, 20 Jan 2022 22:37:42 +0000 (23:37 +0100)]
Rollup merge of #93114 - lcnr:mk_array, r=RalfJung

update comment for `ensure_monomorphic_enough`

r? `@RalfJung`

2 years agoRollup merge of #93104 - dtolnay:ppbless, r=Mark-Simulacrum
Matthias Krüger [Thu, 20 Jan 2022 22:37:41 +0000 (23:37 +0100)]
Rollup merge of #93104 - dtolnay:ppbless, r=Mark-Simulacrum

Support --bless for pp-exact pretty printer tests

I ran into this while working on the stack of PRs containing #93102. `x.py test src/test/pretty --bless` previously would `fatal` instead of blessing the input files.

Tested by making a silly pretty-printer tweak and running the above command: 98823c3929ebfe796786345c5ee713f63317d9c6

2 years agoRollup merge of #93102 - dtolnay:ringbuffer, r=lcnr
Matthias Krüger [Thu, 20 Jan 2022 22:37:40 +0000 (23:37 +0100)]
Rollup merge of #93102 - dtolnay:ringbuffer, r=lcnr

Pretty printer algorithm revamp step 3

This PR follows #93065 as a third chunk of minor modernizations backported from https://github.com/dtolnay/prettyplease into rustc_ast_pretty.

I've broken this up into atomic commits that hopefully are sensible in isolation. At every commit, the pretty printer is compilable and has runtime behavior that is identical to before and after the PR. None of the refactoring so far changes behavior.

This PR is the last chunk of non-behavior-changing cleanup. After this the **next PR** will begin backporting behavior changes from `prettyplease`, starting with block indentation:

```rust
macro_rules! print_expr {
    ($expr:expr) => {
        println!("{}", stringify!($expr));
    };
}

fn main() {
    print_expr!(Struct { x: 0, y: 0 });
    print_expr!(Structtttttttttttttttttttttttttttttttttttttttttttttttttt { xxxxxxxxx: 0, yyyyyyyyy: 0 });
}
```

Output currently on master (nowhere near modern Rust style):

```console
Struct{x: 0, y: 0,}
Structtttttttttttttttttttttttttttttttttttttttttttttttttt{xxxxxxxxx: 0,
                                                         yyyyyyyyy: 0,}
```

After the upcoming PR for block indentation (based on https://github.com/dtolnay/prettyplease/commit/401d60c04213e6c66565e0e69a95b4588db5fdba):

```console
Struct { x: 0, y: 0, }
Structtttttttttttttttttttttttttttttttttttttttttttttttttt {
    xxxxxxxxx: 0,
    yyyyyyyyy: 0,
}
```

And the PR after that, for intelligent trailing commas (based on https://github.com/dtolnay/prettyplease/commit/e2a0297f1781b787b90bca5aba1bdb4966661882):

```console
Struct { x: 0, y: 0 }
Structtttttttttttttttttttttttttttttttttttttttttttttttttt {
    xxxxxxxxx: 0,
    yyyyyyyyy: 0,
}
```

2 years agoRollup merge of #93099 - tomkris:rustdoc-fix, r=jsha
Matthias Krüger [Thu, 20 Jan 2022 22:37:39 +0000 (23:37 +0100)]
Rollup merge of #93099 - tomkris:rustdoc-fix, r=jsha

rustdoc: auto create output directory when "--output-format json"

This PR allows rustdoc to automatically create output directory in case it does not exist (when run with `--output-format json`).

This fixes rustdoc crash:

````
$ rustdoc --output-format json -Z unstable-options src/main.rs
error: couldn't generate documentation: No such file or directory (os error 2)
  |
  = note: failed to create or modify "doc/main.json"

error: aborting due to previous error
````

With this fix behavior of `rustdoc --output-format json` becomes consistent with `rustdoc --output-format html` (which already auto-creates output directory if it's missing)

2 years agoRollup merge of #93098 - Aaron1011:def-path-hash-debug, r=oli-obk
Matthias Krüger [Thu, 20 Jan 2022 22:37:38 +0000 (23:37 +0100)]
Rollup merge of #93098 - Aaron1011:def-path-hash-debug, r=oli-obk

Show a more informative panic message when `DefPathHash` does not exist

This should hopefully make it easier to debug incremental compilation
bugs like #93096 without affecting performance.

2 years agoRollup merge of #93094 - Enselic:check-for-enum-tuple-struct-fields, r=CraftSpider
Matthias Krüger [Thu, 20 Jan 2022 22:37:37 +0000 (23:37 +0100)]
Rollup merge of #93094 - Enselic:check-for-enum-tuple-struct-fields, r=CraftSpider

src/test/rustdoc-json: Check for `struct_field`s in `variant_tuple_struct.rs`

The presence of `struct_field`s is being checked for already in
`variant_struct.rs`. We should also check for them in `variant_tuple_struct.rs`.

This PR is one small step towards resolving #92945.

2 years agoRollup merge of #93091 - pierwill:chalk-0.76, r=jackh726
Matthias Krüger [Thu, 20 Jan 2022 22:37:37 +0000 (23:37 +0100)]
Rollup merge of #93091 - pierwill:chalk-0.76, r=jackh726

⬆ chalk to 0.76.0

This update contains https://github.com/rust-lang/chalk/pull/740, which is needed for work on #90317.

2 years agoRollup merge of #93087 - ricobbe:alt-calling-convention-test-fix, r=Mark-Simulacrum
Matthias Krüger [Thu, 20 Jan 2022 22:37:36 +0000 (23:37 +0100)]
Rollup merge of #93087 - ricobbe:alt-calling-convention-test-fix, r=Mark-Simulacrum

Fix src/test/run-make/raw-dylib-alt-calling-convention

Fix the test headers so that the test now runs on all intended platforms; it is currently ignored on all platforms because the headers are incorrect.  Also comment out a couple of function calls that fail because of an unrelated problem, described in issue #91167.

2 years agoRollup merge of #93086 - c410-f3r:let-guard, r=Mark-Simulacrum
Matthias Krüger [Thu, 20 Jan 2022 22:37:35 +0000 (23:37 +0100)]
Rollup merge of #93086 - c410-f3r:let-guard, r=Mark-Simulacrum

Add tests to ensure that `let_chains` works with `if_let_guard`

The current machinery already makes such combination possible but lacks tests.

cc `@matthewjasper`

2 years agoRollup merge of #93067 - jsha:fix-scroll-padding-top, r=GuillaumeGomez
Matthias Krüger [Thu, 20 Jan 2022 22:37:34 +0000 (23:37 +0100)]
Rollup merge of #93067 - jsha:fix-scroll-padding-top, r=GuillaumeGomez

rustdoc mobile: fix scroll offset when jumping to internal id

Followup to #92692. The semantics of `scroll-margin-top` are a little surprising - the attribute needs to be applied to the element that gets scrolled into the viewport, not the scrolling element.

This fixes an issue where clicking on a method (or other item) from the sidebar takes you to a scroll position where the topbar covers up the method name.

I'm interested in ideas for how to test this with browser-ui-test, but I think it doesn't yet have what I need. What I need is an assert that `<element>.getBoundingClientRect().y` is > 45.

Demo: https://rustdoc.crud.net/jsha/fix-scroll-padding-top/std/string/struct.String.html#method.extend_from_within

r? `@GuillaumeGomez`

2 years agoRollup merge of #93061 - estebank:macr-suggestion, r=cjgillot
Matthias Krüger [Thu, 20 Jan 2022 22:37:33 +0000 (23:37 +0100)]
Rollup merge of #93061 - estebank:macr-suggestion, r=cjgillot

Only suggest adding `!` to expressions that can be macro invocation

2 years agoRollup merge of #93038 - GuillaumeGomez:block-doc-comments, r=notriddle
Matthias Krüger [Thu, 20 Jan 2022 22:37:32 +0000 (23:37 +0100)]
Rollup merge of #93038 - GuillaumeGomez:block-doc-comments, r=notriddle

Fix star handling in block doc comments

Fixes #92872.

Some extra explanation about this PR and why https://github.com/rust-lang/rust/pull/92357 created this regression: when we merge doc comment kinds for example in:

```rust
/// he
/**
* hello
*/
#[doc = "boom"]
```

We don't want to remove the empty lines between them. However, to correctly compute the "horizontal trim", we still need it, so instead, I put back a part of the "vertical trim" directly in the "horizontal trim" computation so it doesn't impact the output buffer but allows us to correctly handle the stars.

r? ``@camelid``

2 years agoRollup merge of #92860 - CraftSpider:rustdoc-json-impl-ice, r=jsha
Matthias Krüger [Thu, 20 Jan 2022 22:37:31 +0000 (23:37 +0100)]
Rollup merge of #92860 - CraftSpider:rustdoc-json-impl-ice, r=jsha

Fix errors on blanket impls by ignoring the children of generated impls

Related to #83718

We can safely skip the children, as they don't contain any new info, and may be subtly different for reasons hard to track down, in ways that are consistently worse than the actual generic impl.

2 years agoRollup merge of #92856 - GuillaumeGomez:exclude-test-doc_auto_cfg, r=Nemo157
Matthias Krüger [Thu, 20 Jan 2022 22:37:30 +0000 (23:37 +0100)]
Rollup merge of #92856 - GuillaumeGomez:exclude-test-doc_auto_cfg, r=Nemo157

Exclude "test" from doc_auto_cfg

Fixes #91740.

cc `@Nemo157` (you were the one suggesting this iirc)
r? `@camelid`

2 years agoRollup merge of #91032 - eholk:generator-drop-tracking, r=nikomatsakis
Matthias Krüger [Thu, 20 Jan 2022 22:37:29 +0000 (23:37 +0100)]
Rollup merge of #91032 - eholk:generator-drop-tracking, r=nikomatsakis

Introduce drop range tracking to generator interior analysis

This PR addresses cases such as this one from #57478:
```rust
struct Foo;
impl !Send for Foo {}

let _: impl Send = || {
    let guard = Foo;
    drop(guard);
    yield;
};
```

Previously, the `generator_interior` pass would unnecessarily include the type `Foo` in the generator because it was not aware of the behavior of `drop`. We fix this issue by introducing a drop range analysis that finds portions of the code where a value is guaranteed to be dropped. If a value is dropped at all suspend points, then it is no longer included in the generator type. Note that we are using "dropped" in a generic sense to include any case in which a value has been moved. That is, we do not only look at calls to the `drop` function.

There are several phases to the drop tracking algorithm, and we'll go into more detail below.
1. Use `ExprUseVisitor` to find values that are consumed and borrowed.
2. `DropRangeVisitor` uses consume and borrow information to gather drop and reinitialization events, as well as build a control flow graph.
3. We then propagate drop and reinitialization information through the CFG until we reach a fix point (see `DropRanges::propagate_to_fixpoint`).
4. When recording a type (see `InteriorVisitor::record`), we check the computed drop ranges to see if that value is definitely dropped at the suspend point. If so, we skip including it in the type.

## 1. Use `ExprUseVisitor` to find values that are consumed and borrowed.

We use `ExprUseVisitor` to identify the places where values are consumed. We track both the `hir_id` of the value, and the `hir_id` of the expression that consumes it. For example, in the expression `[Foo]`, the `Foo` is consumed by the array expression, so after the array expression we can consider the `Foo` temporary to be dropped.

In this process, we also collect values that are borrowed. The reason is that the MIR transform for generators conservatively assumes anything borrowed is live across a suspend point (see `rustc_mir_transform::generator::locals_live_across_suspend_points`). We match this behavior here as well.

## 2. Gather drop events, reinitialization events, and control flow graph

After finding the values of interest, we perform a post-order traversal over the HIR tree to find the points where these values are dropped or reinitialized. We use the post-order index of each event because this is how the existing generator interior analysis refers to the position of suspend points and the scopes of variables.

During this traversal, we also record branching and merging information to handle control flow constructs such as `if`, `match`, and `loop`. This is necessary because values may be dropped along some control flow paths but not others.

## 3. Iterate to fixed point

The previous pass found the interesting events and locations, but now we need to find the actual ranges where things are dropped. Upon entry, we have a list of nodes ordered by their position in the post-order traversal. Each node has a set of successors. For each node we additionally keep a bitfield with one bit per potentially consumed value. The bit is set if we the value is dropped along all paths entering this node.

To compute the drop information, we first reverse the successor edges to find each node's predecessors. Then we iterate through each node, and for each node we set its dropped value bitfield to the intersection of all incoming dropped value bitfields.

If any bitfield for any node changes, we re-run the propagation loop again.

## 4. Ignore dropped values across suspend points

At this point we have a data structure where we can ask whether a value is guaranteed to be dropped at any post order index for the HIR tree. We use this information in `InteriorVisitor` to check whether a value in question is dropped at a particular suspend point. If it is, we do not include that value's type in the generator type.

Note that we had to augment the region scope tree to include all yields in scope, rather than just the last one as we did before.

r? `@nikomatsakis`

2 years agobackport the 1.58.1 relnotes to master
Pietro Albini [Thu, 20 Jan 2022 21:59:54 +0000 (22:59 +0100)]
backport the 1.58.1 relnotes to master

2 years agodelete `Stdin::split` forwarder
Taylor Yu [Thu, 20 Jan 2022 21:37:44 +0000 (15:37 -0600)]
delete `Stdin::split` forwarder