]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #82532 - pnkfelix:rustbuild-print-step-rusage, r=Mark-Simulacrum
Yuki Okushi [Mon, 1 Mar 2021 06:07:35 +0000 (15:07 +0900)]
Rollup merge of #82532 - pnkfelix:rustbuild-print-step-rusage, r=Mark-Simulacrum

Add `build.print_step_rusage` to config.toml

Adds `build.print_step_rusage` to config.toml, which is meant to be an easy way to let compiler developers get feedback on the terminal during bootstrap about resource usage during each step.

The output is piggy-backed on `[PRINT-STEP-TIMINGS]`, mostly because the functionality seemed to naturally fit there in the overall control-flow and output structure (even if very little is shared between the implementations themselves).

Some sample output (from my Linux box, where I believe the `max rss` output to be somewhat trust-worthy...):

```
[...]
   Compiling regex v1.4.3
[RUSTC-TIMING] tempfile test:false 0.323 user: 1.418662 sys: 0.81767 max rss (kb): 182084 page reclaims: 26615 page faults: 0 fs block inputs: 0 fs block outputs: 2160 voluntary ctxt switches: 798 involuntary ctxt switches: 131
   Completed tempfile v3.1.0 in 0.3s
[RUSTC-TIMING] chalk_ir test:false 1.890 user: 1.893603 sys: 0.99663 max rss (kb): 239432 page reclaims: 32107 page faults: 0 fs block inputs: 0 fs block outputs: 25008 voluntary ctxt switches: 108 involuntary ctxt switches: 183
   Completed chalk-ir v0.55.0 in 1.9s
   Compiling rustc_data_structures v0.0.0 (/home/pnkfelix/Dev/Rust/rust.git/compiler/rustc_data_structures)
[RUSTC-TIMING] chrono test:false 1.244 user: 3.333198 sys: 0.134963 max rss (kb): 246612 page reclaims: 44857 page faults: 0 fs block inputs: 0 fs block outputs: 11704 voluntary ctxt switches: 1043 involuntary ctxt switches: 326
   Completed chrono v0.4.15 in 1.3s
[RUSTC-TIMING] rustc_rayon test:false 1.332 user: 1.763912 sys: 0.75996 max rss (kb): 239076 page reclaims: 35285 page faults: 0 fs block inputs: 0 fs block outputs: 19576 voluntary ctxt switches: 359 involuntary ctxt switches: 168
   Completed rustc-rayon v0.3.0 in 1.3s
   Compiling matchers v0.0.1
[RUSTC-TIMING] matchers test:false 0.100 user: 0.94495 sys: 0.15119 max rss (kb): 140076 page reclaims: 8200 page faults: 0 fs block inputs: 0 fs block outputs: 392 voluntary ctxt switches: 43 involuntary ctxt switches: 12
   Completed matchers v0.0.1 in 0.1s
[...]
```

3 years agoRollup merge of #82531 - GuillaumeGomez:gui-tests-start, r=jyn514
Yuki Okushi [Mon, 1 Mar 2021 06:07:34 +0000 (15:07 +0900)]
Rollup merge of #82531 - GuillaumeGomez:gui-tests-start, r=jyn514

Add GUI tests

The start of a lot more of GUI tests! \o/

One test is to ensure that the search input can always be selected in all rustdoc "modes" (mobile, tablet mostly) whereas the second checks the shortcuts.

r? `@jyn514`

3 years agoRollup merge of #82507 - jyn514:tidy-windows, r=Mark-Simulacrum
Yuki Okushi [Mon, 1 Mar 2021 06:07:33 +0000 (15:07 +0900)]
Rollup merge of #82507 - jyn514:tidy-windows, r=Mark-Simulacrum

Rename the `tidy` binary to `rust-tidy`

This avoids naming collisions, particularly on Windows where the
dynamic library variable is PATH and setting it causes the in-tree
`tidy` to take precedence over the HTML tidy used by compiletest.

This doesn't change the x.py interface in any way, it still accepts `x.py test tidy` and prints error messages about `tidy`. It only changes the name of the file on disk.

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

3 years agoRollup merge of #82403 - pnkfelix:rustbuild-emit-env-vars-on-verbose-verbose, r=Mark...
Yuki Okushi [Mon, 1 Mar 2021 06:07:32 +0000 (15:07 +0900)]
Rollup merge of #82403 - pnkfelix:rustbuild-emit-env-vars-on-verbose-verbose, r=Mark-Simulacrum

rustbuild: print out env vars on verbose rustc invocations

Print out environment variables related to Rust on sufficiently verbose rustc invocations.

Output is filtered via heuristic of only printing environment variables whose keys start with "RUST" or "CARGO." This filtering is mostly motivated by my not caring to see e.g. "PATH" in my own output, though it is also motivated as a way to try to avoid printing out personal secrets like github keys that people might have stored in their environments for better or for worse, especially since build output is often pasted into bug reports or gists.

Fix #38686.

<details>

<summary>Click here to see sample output</summary>

Sample output looks like:

```
...
      Fresh core v0.0.0 (/home/pnkfelix/Dev/Rust/rust.git/library/core)
rustc env[0]: "CARGO"="/home/pnkfelix/Dev/Rust/rust.git/objdir-default/build/x86_64-unknown-linux-gnu/stage0/bin/cargo"
rustc env[1]: "CARGO_CRATE_NAME"="core"
rustc env[2]: "CARGO_INCREMENTAL"="0"
rustc env[3]: "CARGO_MAKEFLAGS"="--jobserver-fds=5,6 -j --jobserver-auth=5,6 -j"
rustc env[4]: "CARGO_MANIFEST_DIR"="/home/pnkfelix/Dev/Rust/rust.git/library/core"
rustc env[5]: "CARGO_PKG_AUTHORS"="The Rust Project Developers"
rustc env[6]: "CARGO_PKG_DESCRIPTION"=""
rustc env[7]: "CARGO_PKG_HOMEPAGE"=""
rustc env[8]: "CARGO_PKG_LICENSE"=""
rustc env[9]: "CARGO_PKG_LICENSE_FILE"=""
rustc env[10]: "CARGO_PKG_NAME"="core"
rustc env[11]: "CARGO_PKG_REPOSITORY"=""
rustc env[12]: "CARGO_PKG_VERSION"="0.0.0"
rustc env[13]: "CARGO_PKG_VERSION_MAJOR"="0"
rustc env[14]: "CARGO_PKG_VERSION_MINOR"="0"
rustc env[15]: "CARGO_PKG_VERSION_PATCH"="0"
rustc env[16]: "CARGO_PKG_VERSION_PRE"=""
rustc env[17]: "CARGO_PROFILE_RELEASE_CODEGEN_UNITS"="256"
rustc env[18]: "CARGO_PROFILE_RELEASE_DEBUG"="0"
rustc env[19]: "CARGO_PROFILE_RELEASE_DEBUG_ASSERTIONS"="false"
rustc env[20]: "CARGO_TARGET_DIR"="/home/pnkfelix/Dev/Rust/rust.git/objdir-default/build/x86_64-unknown-linux-gnu/stage0-std"
rustc env[21]: "RUSTBUILD_NATIVE_DIR"="/home/pnkfelix/Dev/Rust/rust.git/objdir-default/build/x86_64-unknown-linux-gnu/native"
rustc env[22]: "RUSTC"="/home/pnkfelix/Dev/Rust/rust.git/objdir-default/build/bootstrap/debug/rustc"
rustc env[23]: "RUSTC_BOOTSTRAP"="1"
rustc env[24]: "RUSTC_BREAK_ON_ICE"="1"
rustc env[25]: "RUSTC_ERROR_METADATA_DST"="/home/pnkfelix/Dev/Rust/rust.git/objdir-default/build/tmp/extended-error-metadata"
rustc env[26]: "RUSTC_FORCE_UNSTABLE"="1"
rustc env[27]: "RUSTC_INSTALL_BINDIR"="bin"
rustc env[28]: "RUSTC_LIBDIR"="/home/pnkfelix/Dev/Rust/rust.git/objdir-default/build/x86_64-unknown-linux-gnu/stage0/lib"
rustc env[29]: "RUSTC_LINT_FLAGS"="-Wrust_2018_idioms -Wunused_lifetimes -Dwarnings"
rustc env[30]: "RUSTC_PRINT_STEP_TIMINGS"="1"
rustc env[31]: "RUSTC_REAL"="/home/pnkfelix/Dev/Rust/rust.git/objdir-default/build/x86_64-unknown-linux-gnu/stage0/bin/rustc"
rustc env[32]: "RUSTC_SNAPSHOT"="/home/pnkfelix/Dev/Rust/rust.git/objdir-default/build/x86_64-unknown-linux-gnu/stage0/bin/rustc"
rustc env[33]: "RUSTC_SNAPSHOT_LIBDIR"="/home/pnkfelix/Dev/Rust/rust.git/objdir-default/build/x86_64-unknown-linux-gnu/stage0/lib"
rustc env[34]: "RUSTC_STAGE"="0"
rustc env[35]: "RUSTC_SYSROOT"="/home/pnkfelix/Dev/Rust/rust.git/objdir-default/build/x86_64-unknown-linux-gnu/stage0-sysroot"
rustc env[36]: "RUSTC_VERBOSE"="2"
rustc env[37]: "RUSTDOC"="/home/pnkfelix/Dev/Rust/rust.git/objdir-default/build/bootstrap/debug/rustdoc"
rustc env[38]: "RUSTDOCFLAGS"="--cfg=bootstrap -Dwarnings -Winvalid_codeblock_attributes --crate-version 1.52.0-dev"
rustc env[39]: "RUSTDOC_REAL"="/path/to/nowhere/rustdoc/not/required"
rustc env[40]: "RUSTFLAGS"="--cfg=bootstrap -Zmacro-backtrace -Clink-args=-Wl,-rpath,$ORIGIN/../lib -Cprefer-dynamic"
rustc env[41]: "RUST_COMPILER_RT_ROOT"="/home/pnkfelix/Dev/Rust/rust.git/src/llvm-project/compiler-rt"
rustc env[42]: "RUST_TEST_THREADS"="128"
rustc working directory: /home/pnkfelix/Dev/Rust/rust.git
rustc command: "LD_LIBRARY_PATH"="/home/pnkfelix/Dev/Rust/rust.git/objdir-default/build/x86_64-unknown-linux-gnu/stage0/lib:/home/pnkfelix/Dev/Rust/rust.git/objdi\
r-default/build/x86_64-unknown-linux-gnu/stage0-std/release/deps:/home/pnkfelix/Dev/Rust/rust.git/objdir-default/build/x86_64-unknown-linux-gnu/stage0/lib" "/home\
/pnkfelix/Dev/Rust/rust.git/objdir-default/build/x86_64-unknown-linux-gnu/stage0/bin/rustc" "--crate-name" "core" "--edition=2018" "library/core/src/lib.rs" "--er\
ror-format=json" "--json=diagnostic-rendered-ansi,artifacts" "--crate-type" "lib" "--emit=dep-info,metadata,link" "-C" "opt-level=3" "-C" "embed-bitcode=no" "-C" \
"codegen-units=256" "-C" "debuginfo=0" "-C" "metadata=6748933694d8be19" "-C" "extra-filename=-6748933694d8be19" "--out-dir" "/home/pnkfelix/Dev/Rust/rust.git/objd\
ir-default/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps" "--target" "x86_64-unknown-linux-gnu" "-L" "dependency=/home/pnkfelix/\
Dev/Rust/rust.git/objdir-default/build/x86_64-unknown-linux-gnu/stage0-std/x86_64-unknown-linux-gnu/release/deps" "-L" "dependency=/home/pnkfelix/Dev/Rust/rust.gi\
t/objdir-default/build/x86_64-unknown-linux-gnu/stage0-std/release/deps" "--cfg=bootstrap" "-Zmacro-backtrace" "-Clink-args=-Wl,-rpath,$ORIGIN/../lib" "-Cprefer-d\
ynamic" "-Z" "binary-dep-depinfo" "-Wrust_2018_idioms" "-Wunused_lifetimes" "-Dwarnings" "--sysroot" "/home/pnkfelix/Dev/Rust/rust.git/objdir-default/build/x86_64\
-unknown-linux-gnu/stage0-sysroot" "-Z" "force-unstable-if-unmarked"
...
```

3 years agoRollup merge of #82309 - jyn514:rustdocflags, r=Mark-Simulacrum
Yuki Okushi [Mon, 1 Mar 2021 06:07:31 +0000 (15:07 +0900)]
Rollup merge of #82309 - jyn514:rustdocflags, r=Mark-Simulacrum

Propagate RUSTDOCFLAGS in the environment when documenting

Previously, RUSTDOCFLAGS would get overriden when bootstrap set
`RUSTDOCFLAGS` itself. Propagate the flag manually, using the same logic
as `RUSTFLAGS`.

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

3 years agoAuto merge of #81094 - ssomers:btree_drainy_refactor_3, r=Mark-Simulacrum
bors [Mon, 1 Mar 2021 02:48:29 +0000 (02:48 +0000)]
Auto merge of #81094 - ssomers:btree_drainy_refactor_3, r=Mark-Simulacrum

BTreeMap: split up range_search into two stages

`range_search` expects the caller to pass the same root twice and starts searching a node for both bounds of a range. It's not very clear that in the early iterations, it searches twice in the same node. This PR splits that search up in an initial `find_leaf_edges_spanning_range` that postpones aliasing until the last second, and a second phase for continuing the search for the range in the each subtree independently (`find_lower_bound_edge` & `find_upper_bound_edge`), which greatly helps for use in #81075. It also moves those functions over to the search module.

r? `@Mark-Simulacrum`

3 years agoAuto merge of #82601 - terhechte:catalyst-support-m1-fix, r=petrochenkov
bors [Mon, 1 Mar 2021 00:07:29 +0000 (00:07 +0000)]
Auto merge of #82601 - terhechte:catalyst-support-m1-fix, r=petrochenkov

Fixed support for macOS Catalyst on ARM64

When I initially added Arm64 Catalyst support in https://github.com/rust-lang/rust/pull/77484 I had access to a DTK. However, while waiting to merge the PR some other changes were merged which caused conflicts in the branch. When fixing those conflicts I had no access to the DTK anymore and didn't try out if the resulting binaries did indeed work on Apple Silicon. I finally have a M1 and I realized that some small changes were necessary to support Apple Silicon. This PR adds the required changes. I've been running binaries generated with this branch for some time now and they work without issues.

3 years agoAdd GUI tests
Guillaume Gomez [Thu, 25 Feb 2021 21:05:02 +0000 (22:05 +0100)]
Add GUI tests

3 years agoAuto merge of #81349 - jyn514:blanket-impls-cleanup, r=lcnr
bors [Sun, 28 Feb 2021 19:19:09 +0000 (19:19 +0000)]
Auto merge of #81349 - jyn514:blanket-impls-cleanup, r=lcnr

Remove unnecessary `self_ty` parameter to `get_blanket_impls`

It can be calculated when necessary at the callsite, there's no need to
pass it separately.

This also renames `param_env_def_id` to `item_def_id`.

cc `@eddyb`

3 years agoRemove unnecessary `self_ty` parameter to `get_blanket_impls`
Joshua Nelson [Sun, 24 Jan 2021 18:42:14 +0000 (13:42 -0500)]
Remove unnecessary `self_ty` parameter to `get_blanket_impls`

It can be calculated when necessary at the callsite, there's no need to
pass it separately.

This also renames `param_env_def_id` to `item_def_id`.

3 years agoAuto merge of #82560 - tspiteri:releases-typo, r=ehuss
bors [Sun, 28 Feb 2021 15:39:41 +0000 (15:39 +0000)]
Auto merge of #82560 - tspiteri:releases-typo, r=ehuss

fix typo in RELEASES.md

3 years agoAuto merge of #82603 - RalfJung:miri, r=RalfJung
bors [Sun, 28 Feb 2021 12:53:39 +0000 (12:53 +0000)]
Auto merge of #82603 - RalfJung:miri, r=RalfJung

update Miri

Pulls in a fix for unnecessary rebuilds that basically breaks Playground.

3 years agoupdate Miri
Ralf Jung [Sun, 28 Feb 2021 11:07:53 +0000 (12:07 +0100)]
update Miri

3 years agoAuto merge of #82350 - ehuss:test-chapter, r=jyn514
bors [Sun, 28 Feb 2021 09:18:27 +0000 (09:18 +0000)]
Auto merge of #82350 - ehuss:test-chapter, r=jyn514

Add a chapter on the test harness.

There isn't really any online documentation on the test harness, so this adds a chapter to the rustc book which provides information on how the harness works and details on the command-line options.

3 years agoAuto merge of #82605 - cuviper:issue81051, r=nikic
bors [Sun, 28 Feb 2021 06:37:18 +0000 (06:37 +0000)]
Auto merge of #82605 - cuviper:issue81051, r=nikic

Revert LLVM D81803 because it broke Windows 7

This submodule update reverts <https://reviews.llvm.org/D81803>.

While that change is meant to fix a real bug, [LLVM PR42623], it caused
new permission errors on Windows 7 that make it unable to build any
archives. This is probably the same root cause as [LLVM PR48378].

Fixes #81051. We'll file a new Rust issue to track the LLVM resolution.

[LLVM PR42623]: https://bugs.llvm.org/show_bug.cgi?id=42623
[LLVM PR48378]: https://bugs.llvm.org/show_bug.cgi?id=48378

3 years agoAuto merge of #82594 - nagisa:nagisa/remove-rumprun, r=petrochenkov
bors [Sun, 28 Feb 2021 03:56:16 +0000 (03:56 +0000)]
Auto merge of #82594 - nagisa:nagisa/remove-rumprun, r=petrochenkov

Remove the x86_64-rumprun-netbsd target

Herein we remove the target from the compiler and the code from libstd intended to support the now-defunct rumprun project.

Closes #81514

3 years agoAuto merge of #82611 - Dylan-DPC:rollup-l7xlpks, r=Dylan-DPC
bors [Sun, 28 Feb 2021 01:15:16 +0000 (01:15 +0000)]
Auto merge of #82611 - Dylan-DPC:rollup-l7xlpks, r=Dylan-DPC

Rollup of 11 pull requests

Successful merges:

 - #81856 (Suggest character encoding is incorrect when encountering random null bytes)
 - #82395 (Add missing "see its documentation for more" stdio)
 - #82401 (Remove a redundant macro)
 - #82498 (Use log level to control partitioning debug output)
 - #82534 (Link crtbegin/crtend on musl to terminate .eh_frame)
 - #82537 (Update measureme dependency to the latest version)
 - #82561 (doc: cube root, not cubic root)
 - #82563 (Fix intra-doc handling of `Self` in enum)
 - #82584 (Add ARIA role to sidebar toggle in Rustdoc)
 - #82596 (clarify RW lock's priority gotcha)
 - #82607 (Add a getter for Frame.loc)

Failed merges:

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

3 years agoRollup merge of #82607 - bjorn3:frame_loc_getter, r=RalfJung
Dylan DPC [Sat, 27 Feb 2021 20:56:25 +0000 (21:56 +0100)]
Rollup merge of #82607 - bjorn3:frame_loc_getter, r=RalfJung

Add a getter for Frame.loc

This is necessary for Priroda.

For context see https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/Frame.3A.3Aloc.20no.20longer.20public/near/228070266 and oli-obk/priroda#27.

cc `@DJMcNab`

r? `@RalfJung`

3 years agoRollup merge of #82596 - matklad:rwlock, r=sfackler
Dylan DPC [Sat, 27 Feb 2021 20:56:24 +0000 (21:56 +0100)]
Rollup merge of #82596 - matklad:rwlock, r=sfackler

clarify RW lock's priority gotcha

In particular, the following program works on Linux, but deadlocks on
mac:

```rust
    use std::{
        sync::{Arc, RwLock},
        thread,
        time::Duration,
    };

    fn main() {
        let lock = Arc::new(RwLock::new(()));

        let r1 = thread::spawn({
            let lock = Arc::clone(&lock);
            move || {
                let _rg = lock.read();
                eprintln!("r1/1");
                sleep(1000);

                let _rg = lock.read();
                eprintln!("r1/2");

                sleep(5000);
            }
        });
        sleep(100);
        let w = thread::spawn({
            let lock = Arc::clone(&lock);
            move || {
                let _wg = lock.write();
                eprintln!("w");
            }
        });
        sleep(100);
        let r2 = thread::spawn({
            let lock = Arc::clone(&lock);
            move || {
                let _rg = lock.read();
                eprintln!("r2");
                sleep(2000);
            }
        });

        r1.join().unwrap();
        r2.join().unwrap();
        w.join().unwrap();
    }

    fn sleep(ms: u64) {
        std::thread::sleep(Duration::from_millis(ms))
    }
```

Context: I was completely mystified by a my CI deadlocking on mac ([here](https://github.com/matklad/xshell/pull/7)), until ``@azdavis`` debugged the issue. See a stand-alone reproduciton here: https://github.com/matklad/xshell/pull/15

3 years agoRollup merge of #82584 - tazjin:rustdoc-aria, r=GuillaumeGomez
Dylan DPC [Sat, 27 Feb 2021 20:56:23 +0000 (21:56 +0100)]
Rollup merge of #82584 - tazjin:rustdoc-aria, r=GuillaumeGomez

Add ARIA role to sidebar toggle in Rustdoc

This indicates that the div is an interactive element, and makes the sidebar toggle "clickable" in assistive technologies.

Example of Vimium after this change has been applied (see the issue mentioned below for a screenshot of before):

![Screenshot of Vimium link hints on a Rustdoc page, indicating that the sidebar toggle is clickable](https://user-images.githubusercontent.com/1552853/109384961-ff935400-78f8-11eb-8199-1d35181aeff0.png)

Fixes #82582

3 years agoRollup merge of #82563 - lucas-deangelis:issue-82209-fix, r=jyn514
Dylan DPC [Sat, 27 Feb 2021 20:56:22 +0000 (21:56 +0100)]
Rollup merge of #82563 - lucas-deangelis:issue-82209-fix, r=jyn514

Fix intra-doc handling of `Self` in enum

Fixes #82209

3 years agoRollup merge of #82561 - tspiteri:cube-root, r=Dylan-DPC
Dylan DPC [Sat, 27 Feb 2021 20:56:21 +0000 (21:56 +0100)]
Rollup merge of #82561 - tspiteri:cube-root, r=Dylan-DPC

doc: cube root, not cubic root

Like we say square root, not quadratic root.

3 years agoRollup merge of #82537 - wesleywiser:update_measureme, r=oli-obk
Dylan DPC [Sat, 27 Feb 2021 20:56:20 +0000 (21:56 +0100)]
Rollup merge of #82537 - wesleywiser:update_measureme, r=oli-obk

Update measureme dependency to the latest version

This version adds the ability to use `rdpmc` hardware-based performance
counters instead of wall-clock time for measuring duration. This also
introduces a dependency on the `perf-event-open-sys` crate on Linux
which is used when using hardware counters.

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

3 years agoRollup merge of #82534 - nikic:musl-crtend, r=nagisa
Dylan DPC [Sat, 27 Feb 2021 20:56:19 +0000 (21:56 +0100)]
Rollup merge of #82534 - nikic:musl-crtend, r=nagisa

Link crtbegin/crtend on musl to terminate .eh_frame

For some targets, rustc uses a "CRT fallback", where it links CRT
object files it ships instead of letting the host compiler link
them.

On musl, rustc currently links crt1, crti and crtn (provided by
libc), but does not link crtbegin and crtend (provided by libgcc).
In particular, crtend is responsible for terminating the .eh_frame
section. Lack of terminator may result in segfaults during
unwinding, as reported in #47551 and encountered by the LLVM 12
update in #81451.

This patch links crtbegin and crtend for musl as well, following
the table at the top of crt_objects.rs.

r? ``@nagisa``

3 years agoRollup merge of #82498 - tmiasko:partitioning-debug, r=matthewjasper
Dylan DPC [Sat, 27 Feb 2021 20:56:18 +0000 (21:56 +0100)]
Rollup merge of #82498 - tmiasko:partitioning-debug, r=matthewjasper

Use log level to control partitioning debug output

3 years agoRollup merge of #82401 - osa1:remove_redundant_macro, r=matthewjasper
Dylan DPC [Sat, 27 Feb 2021 20:56:17 +0000 (21:56 +0100)]
Rollup merge of #82401 - osa1:remove_redundant_macro, r=matthewjasper

Remove a redundant macro

Turn the macro into a function. Also remove unused 'span' argument.

3 years agoRollup merge of #82395 - pickfire:see-more, r=GuillaumeGomez
Dylan DPC [Sat, 27 Feb 2021 20:56:16 +0000 (21:56 +0100)]
Rollup merge of #82395 - pickfire:see-more, r=GuillaumeGomez

Add missing "see its documentation for more" stdio

StdoutLock and StderrLock does not have example, it would be better
to leave "see its documentation for more" like iter docs.

3 years agoRollup merge of #81856 - Smittyvb:utf16-warn, r=matthewjasper
Dylan DPC [Sat, 27 Feb 2021 20:56:15 +0000 (21:56 +0100)]
Rollup merge of #81856 - Smittyvb:utf16-warn, r=matthewjasper

Suggest character encoding is incorrect when encountering random null bytes

This adds a note whenever null bytes are seen at the start of a token unexpectedly, since those tend to come from UTF-16 encoded files without a [BOM](https://en.wikipedia.org/wiki/Byte_order_mark) (if a UTF-16 BOM appears it won't be valid UTF-8, but if there is no BOM it be both valid UTF-16 and valid but garbled UTF-8). This approach was suggested in https://github.com/rust-lang/rust/issues/73979#issuecomment-653976451.

Closes #73979.

3 years agoAdd a getter for Frame.loc
bjorn3 [Sat, 27 Feb 2021 20:01:02 +0000 (21:01 +0100)]
Add a getter for Frame.loc

This is necessary for Priroda.

3 years agoRevert LLVM D81803 because it broke Windows 7
Josh Stone [Sat, 27 Feb 2021 19:09:00 +0000 (11:09 -0800)]
Revert LLVM D81803 because it broke Windows 7

This submodule update reverts <https://reviews.llvm.org/D81803>.

While that change is meant to fix a real bug, [LLVM PR42623], it caused
new permission errors on Windows 7 that make it unable to build any
archives. This is probably the same root cause as [LLVM PR48378].

Fixes #81051. We'll file a new Rust issue to track the LLVM resolution.

[LLVM PR42623]: https://bugs.llvm.org/show_bug.cgi?id=42623
[LLVM PR48378]: https://bugs.llvm.org/show_bug.cgi?id=48378

3 years agoAuto merge of #80454 - JulianKnodt:ob_forest_op, r=matthewjasper
bors [Sat, 27 Feb 2021 17:35:35 +0000 (17:35 +0000)]
Auto merge of #80454 - JulianKnodt:ob_forest_op, r=matthewjasper

Skip Ty w/o infer ty/const in trait select

Remove some allocations & also add `skip_current_subtree` to skip subtrees with no inferred items.

r? `@eddyb` since marked in the FIXME

3 years agoFixed support for macOS Catalyst for Apple Silicon
Benedikt Terhechte [Sat, 27 Feb 2021 17:15:55 +0000 (18:15 +0100)]
Fixed support for macOS Catalyst for Apple Silicon

3 years agoUpdate library/std/src/sync/rwlock.rs
Aleksey Kladov [Sat, 27 Feb 2021 16:44:17 +0000 (19:44 +0300)]
Update library/std/src/sync/rwlock.rs

Co-authored-by: Steven Fackler <sfackler@gmail.com>
3 years agoclarify RW lock's priority gotcha
Aleksey Kladov [Sat, 27 Feb 2021 16:07:19 +0000 (19:07 +0300)]
clarify RW lock's priority gotcha

In particular, the following program works on Linux, but deadlocks on
mac:

    use std::{
        sync::{Arc, RwLock},
        thread,
        time::Duration,
    };

    fn main() {
        let lock = Arc::new(RwLock::new(()));

        let r1 = thread::spawn({
            let lock = Arc::clone(&lock);
            move || {
                let _rg = lock.read();
                eprintln!("r1/1");
                sleep(1000);

                let _rg = lock.read();
                eprintln!("r1/2");

                sleep(5000);
            }
        });
        sleep(100);
        let w = thread::spawn({
            let lock = Arc::clone(&lock);
            move || {
                let _wg = lock.write();
                eprintln!("w");
            }
        });
        sleep(100);
        let r2 = thread::spawn({
            let lock = Arc::clone(&lock);
            move || {
                let _rg = lock.read();
                eprintln!("r2");
                sleep(2000);
            }
        });

        r1.join().unwrap();
        r2.join().unwrap();
        w.join().unwrap();
    }

    fn sleep(ms: u64) {
        std::thread::sleep(Duration::from_millis(ms))
    }

3 years agoRemove the x86_64-rumprun-netbsd target
Simonas Kazlauskas [Sat, 27 Feb 2021 15:55:22 +0000 (17:55 +0200)]
Remove the x86_64-rumprun-netbsd target

Closes #81514

3 years agoAuto merge of #81874 - tesuji:spec_slice_fill, r=matthewjasper
bors [Sat, 27 Feb 2021 14:54:31 +0000 (14:54 +0000)]
Auto merge of #81874 - tesuji:spec_slice_fill, r=matthewjasper

Specialize slice::fill with Copy type and u8/i8/bool

I don't expect rustperf could measure any perf improvements with this changes
since `slice::fill` is newly added.

Godbolt link for this change: <https://rust.godbolt.org/z/r3fzee>.

r? `@matthewjasper` since this patch added new specialization.

3 years agoAdd ARIA role to sidebar toggle in Rustdoc
Vincent Ambo [Sat, 27 Feb 2021 10:37:05 +0000 (12:37 +0200)]
Add ARIA role to sidebar toggle in Rustdoc

This indicates that the div is an interactive element, and makes the
sidebar toggle "clickable" in assistive technologies.

Fixes #82582

3 years agoAuto merge of #82448 - Aaron1011:merge-hastokens-hasattrs, r=petrochenkov
bors [Sat, 27 Feb 2021 07:52:11 +0000 (07:52 +0000)]
Auto merge of #82448 - Aaron1011:merge-hastokens-hasattrs, r=petrochenkov

Combine HasAttrs and HasTokens into AstLike

When token-based attribute handling is implemeneted in #80689,
we will need to access tokens from `HasAttrs` (to perform
cfg-stripping), and we will to access attributes from `HasTokens` (to
construct a `PreexpTokenStream`).

This PR merges the `HasAttrs` and `HasTokens` traits into a new
`AstLike` trait. The previous `HasAttrs` impls from `Vec<Attribute>` and `AttrVec`
are removed - they aren't attribute targets, so the impls never really
made sense.

3 years agoCombine HasAttrs and HasTokens into AstLike
Aaron Hill [Tue, 23 Feb 2021 15:21:20 +0000 (10:21 -0500)]
Combine HasAttrs and HasTokens into AstLike

When token-based attribute handling is implemeneted in #80689,
we will need to access tokens from `HasAttrs` (to perform
cfg-stripping), and we will to access attributes from `HasTokens` (to
construct a `PreexpTokenStream`).

This PR merges the `HasAttrs` and `HasTokens` traits into a new
`AstLike` trait. The previous `HasAttrs` impls from `Vec<Attribute>` and `AttrVec`
are removed - they aren't attribute targets, so the impls never really
made sense.

3 years agoAuto merge of #82511 - jsha:fix-bfcache2, r=GuillaumeGomez
bors [Sat, 27 Feb 2021 05:06:05 +0000 (05:06 +0000)]
Auto merge of #82511 - jsha:fix-bfcache2, r=GuillaumeGomez

Fix back-forward cache in rustdoc frontend

Rustdoc's frontend set a no-op unload handler, specifically to disable
Firefox's back-forward cache because it caused a bug. It's nice to
allow the back-forward cache because it permits faster navigations.

This change addresses the issues that were caused by back-forward cache.

https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/1.5/Using_Firefox_1.5_caching
https://web.dev/bfcache/

Demo: https://jacob.hoffman-andrews.com/rust/fix-bfcache/std/string/struct.String.html

Related: #72272

3 years agoAuto merge of #82577 - Dylan-DPC:rollup-c3si8ju, r=Dylan-DPC
bors [Sat, 27 Feb 2021 02:18:11 +0000 (02:18 +0000)]
Auto merge of #82577 - Dylan-DPC:rollup-c3si8ju, r=Dylan-DPC

Rollup of 14 pull requests

Successful merges:

 - #81794 (update tracking issue for `relaxed_struct_unsize`)
 - #82057 (Replace const_cstr with cstr crate)
 - #82370 (Improve anonymous lifetime note to indicate the target span)
 - #82394 (:arrow_up: rust-analyzer)
 - #82396 (Add Future trait for doc_spotlight feature doc)
 - #82404 (Test hexagon-enum only when llvm target is present)
 - #82419 (expand: Preserve order of inert attributes during expansion)
 - #82420 (Enable API documentation for `std::os::wasi`.)
 - #82421 (Add a `size()` function to WASI's `MetadataExt`.)
 - #82442 (Skip emitting closure diagnostic when closure_kind_origins has no entry)
 - #82473 (Use libc::accept4 on Android instead of raw syscall.)
 - #82482 (Use small hash set in `mir_inliner_callees`)
 - #82490 (Update cargo)
 - #82494 (Substitute erased lifetimes on bad placeholder type)

Failed merges:

 - #82448 (Combine HasAttrs and HasTokens into AstLike)

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

3 years agoRollup merge of #82494 - estebank:issue-82455, r=petrochenkov
Dylan DPC [Sat, 27 Feb 2021 01:34:35 +0000 (02:34 +0100)]
Rollup merge of #82494 - estebank:issue-82455, r=petrochenkov

Substitute erased lifetimes on bad placeholder type

Fix #82455.

3 years agoRollup merge of #82490 - ehuss:update-cargo, r=ehuss
Dylan DPC [Sat, 27 Feb 2021 01:34:33 +0000 (02:34 +0100)]
Rollup merge of #82490 - ehuss:update-cargo, r=ehuss

Update cargo

11 commits in bf5a5d5e5d3ae842a63bfce6d070dfd438cf6070..572e201536dc2e4920346e28037b63c0f4d88b3c
2021-02-18 15:49:14 +0000 to 2021-02-24 16:51:20 +0000
- Pass the error message format to rustdoc (rust-lang/cargo#9128)
- Fix test target_in_environment_contains_lower_case (rust-lang/cargo#9203)
- Fix hang on broken stderr. (rust-lang/cargo#9201)
- Make it more clear which module is being tested when running cargo test (rust-lang/cargo#9195)
- Updates to edition handling. (rust-lang/cargo#9184)
- Add --cfg and --rustc-cfg flags to output compiler configuration (rust-lang/cargo#9002)
- Run rustdoc doctests relative to the workspace (rust-lang/cargo#9105)
- Add support for [env] section in .cargo/config.toml (rust-lang/cargo#9175)
- Add schema field and `features2` to the index. (rust-lang/cargo#9161)
- Document the default location where cargo install emitting build artifacts (rust-lang/cargo#9189)
- Do not exit prematurely if anything failed installing. (rust-lang/cargo#9185)

3 years agoRollup merge of #82482 - tmiasko:small-cycles, r=varkor
Dylan DPC [Sat, 27 Feb 2021 01:34:32 +0000 (02:34 +0100)]
Rollup merge of #82482 - tmiasko:small-cycles, r=varkor

Use small hash set in `mir_inliner_callees`

Use small hash set in `mir_inliner_callees` to avoid temporary
allocation when possible and quadratic behaviour for large number of
callees.

3 years agoRollup merge of #82473 - de-vri-es:android-x86-accept4, r=m-ou-se
Dylan DPC [Sat, 27 Feb 2021 01:34:31 +0000 (02:34 +0100)]
Rollup merge of #82473 - de-vri-es:android-x86-accept4, r=m-ou-se

Use libc::accept4 on Android instead of raw syscall.

This PR replaces the use of a raw `accept4` syscall with `libc::accept4`. This was originally added (by me) because `std` couldn't update to the latest `libc` with `accept4` support for android. By now, libc is already on 0.2.85, so the workaround can be removed.

`@rustbot` label +O-android +T-libs-impl

3 years agoRollup merge of #82442 - Aaron1011:fix/closure-mut-crash, r=matthewjasper
Dylan DPC [Sat, 27 Feb 2021 01:34:30 +0000 (02:34 +0100)]
Rollup merge of #82442 - Aaron1011:fix/closure-mut-crash, r=matthewjasper

Skip emitting closure diagnostic when closure_kind_origins has no entry

Fixes #82438

This map is not guarnateed to have an entry for a closure.

3 years agoRollup merge of #82421 - sunfishcode:wasi-metadata-size, r=alexcrichton
Dylan DPC [Sat, 27 Feb 2021 01:34:28 +0000 (02:34 +0100)]
Rollup merge of #82421 - sunfishcode:wasi-metadata-size, r=alexcrichton

Add a `size()` function to WASI's `MetadataExt`.

WASI's `filestat` type includes a size field, so expose it in
`MetadataExt` via a `size()` function, similar to the corresponding Unix
function.

r? ``````@alexcrichton``````

3 years agoRollup merge of #82420 - sunfishcode:wasi-docs, r=alexcrichton
Dylan DPC [Sat, 27 Feb 2021 01:34:27 +0000 (02:34 +0100)]
Rollup merge of #82420 - sunfishcode:wasi-docs, r=alexcrichton

Enable API documentation for `std::os::wasi`.

This adds API documentation support for `std::os::wasi` modeled after
how `std::os::unix` works, so that WASI can be documented [here] along
with the other platforms.

[here]: https://doc.rust-lang.org/stable/std/os/index.html

Two changes of particular interest:

 - This changes the `AsRawFd` for `io::Stdin` for WASI to return
   `libc::STDIN_FILENO` instead of `sys::stdio::Stdin.as_raw_fd()` (and
   similar for `Stdout` and `Stderr`), which matches how the `unix`
   version works. `STDIN_FILENO` etc. may not always be explicitly
   reserved at the WASI level, but as long as we have Rust's `std` and
   `libc`, I think it's reasonable to guarantee that we'll always use
   `libc::STDIN_FILENO` for stdin.

 - This duplicates the `osstr2str` utility function, rather than
   trying to share it across all the configurations that need it.

r? ```@alexcrichton```

3 years agoRollup merge of #82419 - petrochenkov:inertord, r=Aaron1011
Dylan DPC [Sat, 27 Feb 2021 01:34:26 +0000 (02:34 +0100)]
Rollup merge of #82419 - petrochenkov:inertord, r=Aaron1011

expand: Preserve order of inert attributes during expansion

Fixes https://github.com/rust-lang/rust/issues/67839
Fixes https://github.com/rust-lang/rust/issues/81871
r? `````@Aaron1011`````

3 years agoRollup merge of #82404 - nagisa:nagisa/hexagon-enums-llvm-comps, r=petrochenkov
Dylan DPC [Sat, 27 Feb 2021 01:34:25 +0000 (02:34 +0100)]
Rollup merge of #82404 - nagisa:nagisa/hexagon-enums-llvm-comps, r=petrochenkov

Test hexagon-enum only when llvm target is present

See https://github.com/rust-lang/rust/pull/82379#issuecomment-783439754

r? ``````@petrochenkov``````

``````@bors`````` rollup

3 years agoRollup merge of #82396 - pickfire:patch-5, r=GuillaumeGomez
Dylan DPC [Sat, 27 Feb 2021 01:34:24 +0000 (02:34 +0100)]
Rollup merge of #82396 - pickfire:patch-5, r=GuillaumeGomez

Add Future trait for doc_spotlight feature doc

3 years agoRollup merge of #82394 - lnicola:rust-analyzer-2021-02-22, r=jonas-schievink
Dylan DPC [Sat, 27 Feb 2021 01:34:23 +0000 (02:34 +0100)]
Rollup merge of #82394 - lnicola:rust-analyzer-2021-02-22, r=jonas-schievink

:arrow_up: rust-analyzer

3 years agoRollup merge of #82370 - 0yoyoyo:update-issue-81650-point-anonymous-lifetime, r=estebank
Dylan DPC [Sat, 27 Feb 2021 01:34:22 +0000 (02:34 +0100)]
Rollup merge of #82370 - 0yoyoyo:update-issue-81650-point-anonymous-lifetime, r=estebank

Improve anonymous lifetime note to indicate the target span

Improvement for  #81650
Cc #81995

Message after this improvement:
(Improve note in the middle)

```
error[E0311]: the parameter type `T` may not live long enough
  --> src/main.rs:25:11
   |
24 | fn play_with<T: Animal + Send>(scope: &Scope, animal: T) {
   |              -- help: consider adding an explicit lifetime bound...: `T: 'a +`
25 |     scope.spawn(move |_| {
   |           ^^^^^
   |
note: the parameter type `T` must be valid for the anonymous lifetime defined on the function body at 24:40...
  --> src/main.rs:24:40
   |
24 | fn play_with<T: Animal + Send>(scope: &Scope, animal: T) {
   |                                        ^^^^^
note: ...so that the type `[closure@src/main.rs:25:17: 27:6]` will meet its required lifetime bounds
  --> src/main.rs:25:11
   |
25 |     scope.spawn(move |_| {
   |           ^^^^^
```

r? ``````@estebank``````

3 years agoRollup merge of #82057 - upsuper-forks:cstr, r=davidtwco,wesleywiser
Dylan DPC [Sat, 27 Feb 2021 01:34:21 +0000 (02:34 +0100)]
Rollup merge of #82057 - upsuper-forks:cstr, r=davidtwco,wesleywiser

Replace const_cstr with cstr crate

This PR replaces the `const_cstr` macro inside `rustc_data_structures` with `cstr` macro from [cstr](https://crates.io/crates/cstr) crate.

The two macros basically serve the same purpose, which is to generate `&'static CStr` from a string literal. `cstr` is better because it validates the literal at compile time, while the existing `const_cstr` does it at runtime when `debug_assertions` is enabled. In addition, the value `cstr` generates can be used in constant context (which is seemingly not needed anywhere currently, though).

3 years agoRollup merge of #81794 - lcnr:relaxed_adt_unsize-tracking-issue, r=camelid
Dylan DPC [Sat, 27 Feb 2021 01:34:20 +0000 (02:34 +0100)]
Rollup merge of #81794 - lcnr:relaxed_adt_unsize-tracking-issue, r=camelid

update tracking issue for `relaxed_struct_unsize`

forgot to do this before #80726 got merged. The tracking issue is #81793

3 years agoMove test file, add test of generated link
Lucas De Angelis [Sat, 27 Feb 2021 00:08:05 +0000 (01:08 +0100)]
Move test file, add test of generated link

3 years agoUpdate src/librustdoc/passes/collect_intra_doc_links.rs
Lucas De Angelis [Fri, 26 Feb 2021 22:48:45 +0000 (23:48 +0100)]
Update src/librustdoc/passes/collect_intra_doc_links.rs

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoAuto merge of #82559 - tmiasko:inlined, r=petrochenkov
bors [Fri, 26 Feb 2021 21:58:58 +0000 (21:58 +0000)]
Auto merge of #82559 - tmiasko:inlined, r=petrochenkov

Miscellaneous inlining improvements

Inline a few small and hot functions.

3 years agoFix formatting
Lucas De Angelis [Fri, 26 Feb 2021 21:48:53 +0000 (22:48 +0100)]
Fix formatting

3 years agoFix intra-doc handling of `Self` in enum
Lucas De Angelis [Fri, 26 Feb 2021 21:09:39 +0000 (22:09 +0100)]
Fix intra-doc handling of `Self` in enum

Fixes #82209

3 years agoAuto merge of #82552 - GuillaumeGomez:rollup-8dn1ztn, r=GuillaumeGomez
bors [Fri, 26 Feb 2021 19:17:00 +0000 (19:17 +0000)]
Auto merge of #82552 - GuillaumeGomez:rollup-8dn1ztn, r=GuillaumeGomez

Rollup of 8 pull requests

Successful merges:

 - #81940 (Stabilize str_split_once)
 - #82165 (Reword labels on E0308 involving async fn return type)
 - #82456 (Replaced some unwrap_or and map_or with lazy variants)
 - #82491 (Consider inexpensive inlining criteria first)
 - #82506 (Properly account for non-shorthand pattern field in unused variable lint)
 - #82535 (Set codegen thread names)
 - #82545 (rustdoc: add optional woff2 versions of FiraSans.)
 - #82549 (Revert "Update normalize.css to 8.0.1")

Failed merges:

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

3 years agodoc: cube root, not cubic root
Trevor Spiteri [Fri, 26 Feb 2021 18:03:44 +0000 (19:03 +0100)]
doc: cube root, not cubic root

Like we say square root, not quadratic root.

3 years agofix typo in RELEASES.md
Trevor Spiteri [Fri, 26 Feb 2021 17:41:22 +0000 (18:41 +0100)]
fix typo in RELEASES.md

3 years agoAdd for example word to spotlight doc
Ivan Tham [Fri, 26 Feb 2021 17:29:56 +0000 (01:29 +0800)]
Add for example word to spotlight doc

As suggested by GuillaumeGomez

3 years agoRollup merge of #82549 - rust-lang:revert-82313-update-normalize-css, r=apiraino
Guillaume Gomez [Fri, 26 Feb 2021 14:52:37 +0000 (15:52 +0100)]
Rollup merge of #82549 - rust-lang:revert-82313-update-normalize-css, r=apiraino

Revert "Update normalize.css to 8.0.1"

Reverts rust-lang/rust#82313

Fixes #82548
Fixes #82542

``@jsha:`` I'm reverting until we can come up with a new version which is fully working.

r? ``@jyn514``

3 years agoRollup merge of #82545 - jsha:woff2, r=GuillaumeGomez
Guillaume Gomez [Fri, 26 Feb 2021 14:52:36 +0000 (15:52 +0100)]
Rollup merge of #82545 - jsha:woff2, r=GuillaumeGomez

rustdoc: add optional woff2 versions of FiraSans.

For browsers that support woff2 (most modern ones:
https://caniuse.com/woff2), this offers a reduction in download size
for these two fonts from 362k to 257k (32% reduction). It decreases the
total page size for `struct.String.html` (counting all subresources) by
about 2.5%.

If this is interesting, I'm happy to apply the same treatment to the
other fonts, but these two are the biggest.

3 years agoRollup merge of #82535 - wesleywiser:wip_codegen_thread_names, r=nagisa
Guillaume Gomez [Fri, 26 Feb 2021 14:52:35 +0000 (15:52 +0100)]
Rollup merge of #82535 - wesleywiser:wip_codegen_thread_names, r=nagisa

Set codegen thread names

Set names on threads spawned during codegen. Various debugging and profiling tools can take advantage of this to show a more useful identifier for threads.

For example, gdb will show thread names in `info threads`:

```
(gdb) info threads
  Id   Target Id                                          Frame
  1    Thread 0x7fffefa7ec40 (LWP 2905) "rustc"           __pthread_clockjoin_ex (threadid=140737214134016, thread_return=0x0, clockid=<optimized out>, abstime=<optimized out>, block=<optimized out>)
    at pthread_join_common.c:145
  2    Thread 0x7fffefa7b700 (LWP 2957) "rustc"           0x00007ffff125eaa8 in llvm::X86_MC::initLLVMToSEHAndCVRegMapping(llvm::MCRegisterInfo*) ()
   from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-f866439e29074957.so
  3    Thread 0x7fffeef0f700 (LWP 3116) "rustc"           futex_wait_cancelable (private=0, expected=0, futex_word=0x7fffe8602ac8) at ../sysdeps/nptl/futex-internal.h:183
* 4    Thread 0x7fffeed0e700 (LWP 3123) "rustc"           rustc_codegen_ssa::back::write::spawn_work (cgcx=..., work=...) at /home/wesley/code/rust/rust/compiler/rustc_codegen_ssa/src/back/write.rs:1573
  6    Thread 0x7fffe113b700 (LWP 3150) "opt foof.7rcbfp" 0x00007ffff2940e62 in llvm::CallGraph::populateCallGraphNode(llvm::CallGraphNode*) ()
   from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-f866439e29074957.so
  8    Thread 0x7fffe0d39700 (LWP 3158) "opt foof.7rcbfp" 0x00007fffefe8998e in malloc_consolidate (av=av@entry=0x7ffe2c000020) at malloc.c:4492
  9    Thread 0x7fffe0f3a700 (LWP 3162) "opt foof.7rcbfp" 0x00007fffefef27c4 in __libc_open64 (file=0x7fffe0f38608 "foof.foof.7rcbfp3g-cgu.6.rcgu.o", oflag=524865) at ../sysdeps/unix/sysv/linux/open64.c:48
(gdb)
```

and Windows Performance Analyzer will also show this information when profiling:

![image](https://user-images.githubusercontent.com/831192/109231017-d311f780-7793-11eb-8072-ab836a830e90.png)

3 years agoRollup merge of #82506 - estebank:unused_variable_lint, r=lcnr
Guillaume Gomez [Fri, 26 Feb 2021 14:52:33 +0000 (15:52 +0100)]
Rollup merge of #82506 - estebank:unused_variable_lint, r=lcnr

Properly account for non-shorthand pattern field in unused variable lint

Fix #82488

3 years agoRollup merge of #82491 - tmiasko:i, r=lcnr
Guillaume Gomez [Fri, 26 Feb 2021 14:52:32 +0000 (15:52 +0100)]
Rollup merge of #82491 - tmiasko:i, r=lcnr

Consider inexpensive inlining criteria first

Refactor inlining decisions so that inexpensive criteria are considered first:

1. Based on code generation attributes.
2. Based on MIR availability (examines call graph).
3. Based on MIR body.

3 years agoRollup merge of #82456 - klensy:or-else, r=estebank
Guillaume Gomez [Fri, 26 Feb 2021 14:52:31 +0000 (15:52 +0100)]
Rollup merge of #82456 - klensy:or-else, r=estebank

Replaced some unwrap_or and map_or with lazy variants

Replaced some `unwrap_or` and `map_or` with `unwrap_or_else` and `map_or_else`.

3 years agoRollup merge of #82165 - nellshamrell:nell/fix-80658-B, r=estebank
Guillaume Gomez [Fri, 26 Feb 2021 14:52:30 +0000 (15:52 +0100)]
Rollup merge of #82165 - nellshamrell:nell/fix-80658-B, r=estebank

Reword labels on E0308 involving async fn return type

Fix for #80658.

When someone writes code like this:

```rust
fn foo() -> u8 {
    async fn async_fn() -> () {}

    async_fn()
}
```

And they try to compile it, they will see an error that looks like this:

```bash
error[E0308]: mismatched types
 --> test.rs:4:5
  |
1 | fn foo() -> u8 {
  |             -- expected `u8` because of return type
2 |     async fn async_fn() -> () {}
  |                            -- checked the `Output` of this `async fn`, found opaque type
3 |
4 |     async_fn()
  |     ^^^^^^^^^^ expected `u8`, found opaque type
  |
  = note: while checking the return type of this `async fn`
  = note:     expected type `u8`
          found opaque type `impl Future`
```

3 years agoRollup merge of #81940 - jhpratt:stabilize-str_split_once, r=m-ou-se
Guillaume Gomez [Fri, 26 Feb 2021 14:52:29 +0000 (15:52 +0100)]
Rollup merge of #81940 - jhpratt:stabilize-str_split_once, r=m-ou-se

Stabilize str_split_once

Closes #74773

3 years agoRevert "Update normalize.css to 8.0.1"
Guillaume Gomez [Fri, 26 Feb 2021 13:59:24 +0000 (14:59 +0100)]
Revert "Update normalize.css to 8.0.1"

3 years agoAuto merge of #81458 - estebank:match-stmt-remove-semi, r=oli-obk
bors [Fri, 26 Feb 2021 12:03:38 +0000 (12:03 +0000)]
Auto merge of #81458 - estebank:match-stmt-remove-semi, r=oli-obk

Detect match statement intended to be tail expression

CC #24157

3 years agoLink crtbegin/crtend on musl to terminate .eh_frame
Nikita Popov [Fri, 26 Feb 2021 10:01:23 +0000 (11:01 +0100)]
Link crtbegin/crtend on musl to terminate .eh_frame

For some targets, rustc uses a "CRT fallback", where it links CRT
object files it ships instead of letting the host compiler link
them.

On musl, rustc currently links crt1, crti and crtn (provided by
libc), but does not link crtbegin and crtend (provided by libgcc).
In particular, crtend is responsible for terminating the .eh_frame
section. Lack of terminator may result in segfaults during
unwinding, as reported in #47551 and encountered by the LLVM 12
update in #81451.

This patch links crtbegin and crtend for musl as well, following
the table at the top of crt_objects.rs.

3 years agoEmbed woff2 files in rustdoc binary.
Jacob Hoffman-Andrews [Fri, 26 Feb 2021 08:38:05 +0000 (00:38 -0800)]
Embed woff2 files in rustdoc binary.

3 years agoAdd optional woff2 versions of FiraSans.
Jacob Hoffman-Andrews [Fri, 26 Feb 2021 08:02:11 +0000 (00:02 -0800)]
Add optional woff2 versions of FiraSans.

For browsers that support woff2 (most modern ones:
https://caniuse.com/woff2), this offers a reduction in download size
for these two fonts from 362k to 257k (32% reduction). It decreases the
total page size for `struct.String.html` (counting all subresources) by
about 2.5%.

If this is interesting, I'm happy to apply the same treatment to the
other fonts, but these two are the biggest.

3 years agoupdate tracking issue for `relaxed_struct_unsize`
lcnr [Fri, 26 Feb 2021 07:32:38 +0000 (08:32 +0100)]
update tracking issue for `relaxed_struct_unsize`

3 years agoAuto merge of #78429 - casey:doctest-attribute-splitting, r=jyn514
bors [Fri, 26 Feb 2021 00:17:22 +0000 (00:17 +0000)]
Auto merge of #78429 - casey:doctest-attribute-splitting, r=jyn514

[librustdoc] Only split lang string on `,`, ` `, and `\t`

Split markdown lang strings into tokens on `,`.

The previous behavior was to split lang strings into tokens on any
character that wasn't a `_`, `_`, or alphanumeric.

This is a potentially breaking change, so please scrutinize! See discussion in #78344.

I noticed some test cases that made me wonder if there might have been some reason for the original behavior:

```
t("{.no_run .example}", false, true, Ignore::None, true, false, false, false, v(), None);
t("{.sh .should_panic}", true, false, Ignore::None, false, false, false, false, v(), None);
t("{.example .rust}", false, false, Ignore::None, true, false, false, false, v(), None);
t("{.test_harness .rust}", false, false, Ignore::None, true, true, false, false, v(), None);
```

It seemed pretty peculiar to specifically test lang strings in braces, with all the tokens prefixed by `.`.

I did some digging, and it looks like the test cases were added way back in [this commit from 2014](https://github.com/rust-lang/rust/commit/3fef7a74ca9a) by `@skade.`

It looks like they were added just to make sure that the splitting was permissive, and aren't testing that those strings in particular are accepted.

Closes https://github.com/rust-lang/rust/issues/78344.

3 years agoMiscellaneous inlining improvements
Tomasz Miąsko [Fri, 26 Feb 2021 00:00:00 +0000 (00:00 +0000)]
Miscellaneous inlining improvements

Inline a few small and hot functions.

3 years agoSet codegen thread names
Wesley Wiser [Thu, 18 Feb 2021 19:27:37 +0000 (14:27 -0500)]
Set codegen thread names

For example, gdb:

```
(gdb) info threads
  Id   Target Id                                          Frame
  1    Thread 0x7fffefa7ec40 (LWP 2905) "rustc"           __pthread_clockjoin_ex (threadid=140737214134016, thread_return=0x0, clockid=<optimized out>, abstime=<optimized out>, block=<optimized out>)
    at pthread_join_common.c:145
  2    Thread 0x7fffefa7b700 (LWP 2957) "rustc"           0x00007ffff125eaa8 in llvm::X86_MC::initLLVMToSEHAndCVRegMapping(llvm::MCRegisterInfo*) ()
   from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-f866439e29074957.so
  3    Thread 0x7fffeef0f700 (LWP 3116) "rustc"           futex_wait_cancelable (private=0, expected=0, futex_word=0x7fffe8602ac8) at ../sysdeps/nptl/futex-internal.h:183
* 4    Thread 0x7fffeed0e700 (LWP 3123) "rustc"           rustc_codegen_ssa::back::write::spawn_work (cgcx=..., work=...) at /home/wesley/code/rust/rust/compiler/rustc_codegen_ssa/src/back/write.rs:1573
  6    Thread 0x7fffe113b700 (LWP 3150) "opt foof.7rcbfp" 0x00007ffff2940e62 in llvm::CallGraph::populateCallGraphNode(llvm::CallGraphNode*) ()
   from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-f866439e29074957.so
  8    Thread 0x7fffe0d39700 (LWP 3158) "opt foof.7rcbfp" 0x00007fffefe8998e in malloc_consolidate (av=av@entry=0x7ffe2c000020) at malloc.c:4492
  9    Thread 0x7fffe0f3a700 (LWP 3162) "opt foof.7rcbfp" 0x00007fffefef27c4 in __libc_open64 (file=0x7fffe0f38608 "foof.foof.7rcbfp3g-cgu.6.rcgu.o", oflag=524865) at ../sysdeps/unix/sysv/linux/open64.c:48
(gdb)
```

3 years agoUpdate measureme dependency to the latest version
Wesley Wiser [Thu, 25 Feb 2021 23:25:38 +0000 (18:25 -0500)]
Update measureme dependency to the latest version

This version adds the ability to use `rdpmc` hardware-based performance
counters instead of wall-clock time for measuring duration. This also
introduces a dependency on the `perf-event-open-sys` crate on Linux
which is used when using hardware counters.

3 years agoAuto merge of #82530 - Aaron1011:rollup-aalwq15, r=Aaron1011
bors [Thu, 25 Feb 2021 21:34:55 +0000 (21:34 +0000)]
Auto merge of #82530 - Aaron1011:rollup-aalwq15, r=Aaron1011

Rollup of 11 pull requests

Successful merges:

 - #82269 (Cleanup `PpMode` and friends)
 - #82431 (Set RUST_BACKTRACE=0 when running `treat-err-as-bug` tests)
 - #82441 (Fix typo in sanitizer flag in unstable book.)
 - #82463 (panic_bounds_checks should be panic_bounds_check)
 - #82464 (Update outdated comment in unix Command.)
 - #82467 (library: Normalize safety-for-unsafe-block comments)
 - #82468 (Move pick_by_value_method docs above function header)
 - #82484 (rustdoc: Remove duplicate "List of all items")
 - #82502 (Only look for HTML `tidy` when running rustdoc tests)
 - #82503 (fix typo in `pre-commit.sh`)
 - #82510 (Fix typo in `param_env_reveal_all_normalized`)

Failed merges:

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

3 years agoRollup merge of #82510 - jyn514:fix-typo, r=Dylan-DPC
Aaron Hill [Thu, 25 Feb 2021 21:06:26 +0000 (16:06 -0500)]
Rollup merge of #82510 - jyn514:fix-typo, r=Dylan-DPC

Fix typo in `param_env_reveal_all_normalized`

This made the generated docs look strange: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html#method.param_env_reveal_all_normalized

3 years agoRollup merge of #82503 - cratelyn:patch-1, r=Mark-Simulacrum
Aaron Hill [Thu, 25 Feb 2021 21:06:25 +0000 (16:06 -0500)]
Rollup merge of #82503 - cratelyn:patch-1, r=Mark-Simulacrum

fix typo in `pre-commit.sh`

This updates a small typo I found, no more no less :slightly_smiling_face:

3 years agoRollup merge of #82502 - jyn514:tidy, r=petrochenkov
Aaron Hill [Thu, 25 Feb 2021 21:06:24 +0000 (16:06 -0500)]
Rollup merge of #82502 - jyn514:tidy, r=petrochenkov

Only look for HTML `tidy` when running rustdoc tests

This avoids printing lots of unnecessary errors, as well as making the
test suite slightly faster. This doesn't fix the windows bug tracked by https://github.com/rust-lang/rust/issues/82501, though.

r? `@petrochenkov`

3 years agoRollup merge of #82484 - bugadani:docfix, r=jyn514
Aaron Hill [Thu, 25 Feb 2021 21:06:23 +0000 (16:06 -0500)]
Rollup merge of #82484 - bugadani:docfix, r=jyn514

rustdoc: Remove duplicate "List of all items"

Closes #82477

r? `@jyn514`

3 years agoRollup merge of #82468 - osa1:pick_by_value_method_docs, r=petrochenkov
Aaron Hill [Thu, 25 Feb 2021 21:06:22 +0000 (16:06 -0500)]
Rollup merge of #82468 - osa1:pick_by_value_method_docs, r=petrochenkov

Move pick_by_value_method docs above function header

- Currently style triggers #81183 so we can't add `#[instrument]` to
  this function.

- Having docs above the header is more consistent with the rest of the
  code base.

3 years agoRollup merge of #82467 - ojeda:tidy-normalize-safety-comments, r=kennytm
Aaron Hill [Thu, 25 Feb 2021 21:06:21 +0000 (16:06 -0500)]
Rollup merge of #82467 - ojeda:tidy-normalize-safety-comments, r=kennytm

library: Normalize safety-for-unsafe-block comments

Almost all safety comments are of the form `// SAFETY:`,
so normalize the rest and fix a few of them that should
have been a `/// # Safety` section instead.

Furthermore, make `tidy` only allow the uppercase form. While
currently `tidy` only checks `core`, it is a good idea to prevent
`core` from drifting to non-uppercase comments, so that later
we can start checking `alloc` etc. too.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
3 years agoRollup merge of #82464 - ehuss:unix-command-comment, r=kennytm
Aaron Hill [Thu, 25 Feb 2021 21:06:20 +0000 (16:06 -0500)]
Rollup merge of #82464 - ehuss:unix-command-comment, r=kennytm

Update outdated comment in unix Command.

The big comment in the `Command` struct has been incorrect for some time (at least since #46789 which removed `envp`). Rather than try to remove the allocations, this PR just updates the comment to reflect reality. There is an explanation for the reasoning at https://github.com/rust-lang/rust/pull/31409#issuecomment-182122895, discussing the potential of being able to call `Command::exec` after `libc::fork`.  That can still be done in the future, but I think for now it would be good to just correct the comment.

3 years agoRollup merge of #82463 - jrmuizel:patch-1, r=steveklabnik
Aaron Hill [Thu, 25 Feb 2021 21:06:19 +0000 (16:06 -0500)]
Rollup merge of #82463 - jrmuizel:patch-1, r=steveklabnik

panic_bounds_checks should be panic_bounds_check

3 years agoRollup merge of #82441 - frewsxcv:frewsxcv-docs, r=GuillaumeGomez
Aaron Hill [Thu, 25 Feb 2021 21:06:18 +0000 (16:06 -0500)]
Rollup merge of #82441 - frewsxcv:frewsxcv-docs, r=GuillaumeGomez

Fix typo in sanitizer flag in unstable book.

3 years agoRollup merge of #82431 - Aaron1011:fix/bug-env, r=jyn514
Aaron Hill [Thu, 25 Feb 2021 21:06:17 +0000 (16:06 -0500)]
Rollup merge of #82431 - Aaron1011:fix/bug-env, r=jyn514

Set RUST_BACKTRACE=0 when running `treat-err-as-bug` tests

These ensure that these tests pass regardless of what RUST_BACKTRACE is
set to in the user's shell.

3 years agoRollup merge of #82269 - LeSeulArtichaut:cleanup-ppmode, r=spastorino
Aaron Hill [Thu, 25 Feb 2021 21:06:16 +0000 (16:06 -0500)]
Rollup merge of #82269 - LeSeulArtichaut:cleanup-ppmode, r=spastorino

Cleanup `PpMode` and friends

This PR:
 - Separates `PpSourceMode` and `PpHirMode` to remove invalid states
 - Renames the variant to remove the redundant `Ppm` prefix
 - Adds basic documentation for the different pretty-print modes
 - Cleanups some code to make it more idiomatic

Not sure if this is actually useful, but it looks cleaner to me.

3 years agoAuto merge of #82447 - Amanieu:legacy_const_generics, r=oli-obk
bors [Thu, 25 Feb 2021 18:14:50 +0000 (18:14 +0000)]
Auto merge of #82447 - Amanieu:legacy_const_generics, r=oli-obk

Add #[rustc_legacy_const_generics]

This is the first step towards removing `#[rustc_args_required_const]`: a new attribute is added which rewrites function calls of the form `func(a, b, c)` to `func::<{b}>(a, c)`. This allows previously stabilized functions in `stdarch` which use `rustc_args_required_const` to use const generics instead.

This new attribute is not intended to ever be stabilized, it is only intended for use in `stdarch` as a replacement for `#[rustc_args_required_const]`.

```rust
#[rustc_legacy_const_generics(1)]
pub fn foo<const Y: usize>(x: usize, z: usize) -> [usize; 3] {
    [x, Y, z]
}

fn main() {
    assert_eq!(foo(0 + 0, 1 + 1, 2 + 2), [0, 2, 4]);
    assert_eq!(foo::<{1 + 1}>(0 + 0, 2 + 2), [0, 2, 4]);
}
```

r? `@oli-obk`

3 years agoDetect match statement intended to be tail expression
Esteban Küber [Thu, 28 Jan 2021 02:27:13 +0000 (18:27 -0800)]
Detect match statement intended to be tail expression

CC #24157

3 years agoImplementation of build.print_step_rusage.
Felix S. Klock II [Fri, 19 Feb 2021 18:27:39 +0000 (13:27 -0500)]
Implementation of build.print_step_rusage.

On non-unix platforms, does not try to call `getrusage` (and does not attempt to
implement its own shim; that could be follow-on work, though its probably best
to not invest too much effort there, versus using separate dedicated tooling).

On unix platforms, calls libc::rusage and attempts to emit the subset of fields
that are supported on Linux and Mac OS X. Omits groups of related stats which
appear to be unsupported on the platform (due to them all remaining zero).

Adjusts output to compensate for Mac using bytes instead of kb (a well known
discrepancy on Mac OS X). However, so far I observe a lot of strange values
(orders of magnitude wrong) reported on Mac OS X in some cases, so I would not
trust this in that context currently.

3 years agoCreated experimental build.print_step_rusage setting
Felix S. Klock II [Fri, 19 Feb 2021 18:25:26 +0000 (13:25 -0500)]
Created experimental build.print_step_rusage setting

Intended to piggy-back on output from existing build.print_step_timings setting.

3 years agoAuto merge of #82517 - Dylan-DPC:rollup-a1958gb, r=Dylan-DPC
bors [Thu, 25 Feb 2021 15:15:59 +0000 (15:15 +0000)]
Auto merge of #82517 - Dylan-DPC:rollup-a1958gb, r=Dylan-DPC

Rollup of 16 pull requests

Successful merges:

 - #75807 (Convert core/num/mod.rs to intra-doc links)
 - #80534 (Use #[doc = include_str!()] in std)
 - #80553 (Add an impl of Error on `Arc<impl Error>`.)
 - #81167 (Make ptr::write const)
 - #81575 (rustdoc: Name fields of `ResolutionFailure::WrongNamespace`)
 - #81713 (Account for associated consts in the "unstable assoc item name colission" lint)
 - #82078 (Make char and u8 methods const)
 - #82087 (Fix ICE caused by suggestion with no code substitutions)
 - #82090 (Do not consider using a semicolon inside of a different-crate macro)
 - #82213 (Slices for vecs)
 - #82214 (Remove redundant to_string calls)
 - #82220 (fix the false 'defined here' messages)
 - #82313 (Update normalize.css to 8.0.1)
 - #82321 (AST: Remove some unnecessary boxes)
 - #82364 (Improve error msgs when found type is deref of expected)
 - #82514 (Update Clippy)

Failed merges:

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

3 years agoRollup merge of #82514 - flip1995:clippyup, r=Manishearth
Dylan DPC [Thu, 25 Feb 2021 13:34:05 +0000 (14:34 +0100)]
Rollup merge of #82514 - flip1995:clippyup, r=Manishearth

Update Clippy

Bi-weekly Clippy update.

This updates `Cargo.lock`, so probably needs rollup=never. (https://github.com/rust-lang/rust/commit/0046d7c33e944e87a5cabc940f21bacdce5af307)

https://github.com/rust-lang/rust/commit/a6dd9b96068800fd548a72b3aa7ac4712d1d0c49 fixes things in Clippy, so that it can be build and tested. This needs proper fixing in Clippy, but I didn't want this to block the sync.

r? `@Manishearth`