Commit graph

139183 commits

Author SHA1 Message Date
Christiaan Dirkx
738f736066 Remove unnecessary conditional cfg(target_os) for redox and vxworks
`redox` and `vxworks` are part of target_family `unix`, thus `cfg(unix)` already implies `cfg(target_os="redox")` and `(target_os="vxworks")`
2021-03-03 01:14:17 +01:00
bors
5233edcf1c Auto merge of #82216 - kulikjak:fix-solaris-target, r=nagisa,Mark-Simulacrum
make x86_64-pc-solaris the default target for x86-64 Solaris

This change makes `x86_64-pc-solaris` the default compilation target for x86-64 Solaris/Illumos (based on [this exchange](https://github.com/rust-lang/rust/issues/68214#issuecomment-748042054) with `@varkor).`

I tried several ways of doing this (leveraging the alias support added with #61761 and improved/fixed with #80073) and found out that cross-compilation to the new one is by far the simplest way of doing this. It can be achieved by adding the following arguments: `--build x86_64-sun-solaris --host x86_64-pc-solaris --target x86_64-pc-solaris` and enabling the cross compilation with `PKG_CONFIG_ALLOW_CROSS=1` environment variable.

I also removed alias support altogether - `x86_64-pc-solaris` and `x86_64-sun-solaris` are now two separate targets. The problem with aliases is that even if rust internally knows that two are the same, other tools building with rust don't know that, resulting in build issues like the one with firefox mentioned [here](https://github.com/rust-lang/rust/issues/68214#issuecomment-746144229). I think that once the dust settles and `x86_64-pc-solaris` becomes the default, `x86_64-sun-solaris` can be removed.

If you agree with the above, I have two subsequent questions:
1. Is there a preferred way to display deprecation warnings when `x86_64-sun-solaris` is passed into the compiler as an argument? I am not sure whether target deprecation was done before.
2. Where would be the best way to document this change for those using rust on Solaris? Without the cross-compilation arguments (used once to build a new version), the build won't work. Should I add it into [RELEASES.md](https://github.com/rust-lang/rust/blob/master/RELEASES.md)?

Thanks!
2021-03-01 14:34:19 +00:00
Jakub Kulik
47f291ec2d Update Docker to use the correct target 2021-03-01 15:06:32 +01:00
Jakub Kulik
c3226accbe Update supported platforms doc 2021-03-01 15:06:32 +01:00
Jakub Kulik
c615bed387 Change default Solaris x86 target to x86_64-pc-solaris 2021-03-01 15:05:31 +01:00
bors
09db05762b Auto merge of #78360 - tmiasko:storage-markers, r=wesleywiser,oli-obk
Remove storage markers if they won't be used during code generation

The storage markers constitute a substantial portion of all MIR
statements. At the same time, for builds without any optimizations,
the storage markers have no further use during and after MIR
optimization phase.

If storage markers are not necessary for code generation, remove them.
2021-03-01 11:53:24 +00:00
bors
d2731d8e93 Auto merge of #82654 - JohnTitor:rollup-nkcdkzp, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #82309 (Propagate RUSTDOCFLAGS in the environment when documenting)
 - #82403 (rustbuild: print out env vars on verbose rustc invocations)
 - #82507 (Rename the `tidy` binary to `rust-tidy`)
 - #82531 (Add GUI tests)
 - #82532 (Add `build.print_step_rusage` to config.toml)
 - #82543 (fix env var name in CI)
 - #82622 (Propagate `--test-args` for `x.py test src/tools/cargo`)
 - #82628 (Try to clarify GlobalAlloc::realloc documentation comment.)
 - #82630 (Fix a typo in the `find_anon_type` doc)
 - #82643 (Add more proc-macro attribute tests)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-03-01 08:22:06 +00:00
Yuki Okushi
e2d8efb997
Rollup merge of #82643 - Aaron1011:test-macro-attrs, r=petrochenkov
Add more proc-macro attribute tests

r? `@petrochenkov`
2021-03-01 15:07:40 +09:00
Yuki Okushi
cebbcf1b09
Rollup merge of #82630 - JohnTitor:fix-typo-in-find-anon-type-doc, r=petrochenkov
Fix a typo in the `find_anon_type` doc
2021-03-01 15:07:39 +09:00
Yuki Okushi
1b9f420e1b
Rollup merge of #82628 - vakaras:realloc-doc, r=Mark-Simulacrum
Try to clarify GlobalAlloc::realloc documentation comment.

This PR tries to improve the documentation of [GlobalAlloc::realloc](https://doc.rust-lang.org/alloc/alloc/trait.GlobalAlloc.html#method.realloc) with two aspects:

1. Explicitly mention that `realloc` preserves the contents of the original memory block.
2. Explicitly mention which layout should be used to deallocate the reallocated block.
2021-03-01 15:07:38 +09:00
Yuki Okushi
d65b231cec
Rollup merge of #82622 - jyn514:cargo-test-args, r=Mark-Simulacrum
Propagate `--test-args` for `x.py test src/tools/cargo`

Fixes https://github.com/rust-lang/rust/issues/82621.
2021-03-01 15:07:37 +09:00
Yuki Okushi
b8150e7a3c
Rollup merge of #82543 - klensy:skip-jobs, r=Mark-Simulacrum
fix env var name in CI

There no `SKIP_JOBS` env var name, only `SKIP_JOB`.
2021-03-01 15:07:36 +09:00
Yuki Okushi
1020ed3d50
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
[...]
```
2021-03-01 15:07:35 +09:00
Yuki Okushi
a95c3f74b3
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`
2021-03-01 15:07:34 +09:00
Yuki Okushi
6c76dacccc
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.
2021-03-01 15:07:33 +09:00
Yuki Okushi
9720cd1d56
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"
...
```
2021-03-01 15:07:32 +09:00
Yuki Okushi
3de9b41850
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.
2021-03-01 15:07:31 +09:00
bors
05c300144c Auto merge of #82440 - ssomers:btree_fix_casts, r=Mark-Simulacrum
BTree: no longer define impossible casts

Casts to leaf to internal only make sense when the original has a chance of being the thing it's cast to.

r? `@Mark-Simulacrum`
2021-03-01 05:39:01 +00:00
Aaron Hill
8aed5b4334
Add more proc-macro attribute tests 2021-02-28 22:41:21 -05:00
bors
3b150b7a8f 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`
2021-03-01 02:48:29 +00:00
bors
43fc1b3e24 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.
2021-03-01 00:07:29 +00:00
Guillaume Gomez
c3f88a0be8 Add GUI tests 2021-02-28 23:01:29 +01:00
bors
e37a13cc35 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`
2021-02-28 19:19:09 +00:00
Joshua Nelson
c47c2c6016 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`.
2021-02-28 11:09:11 -05:00
bors
573a697a61 Auto merge of #82560 - tspiteri:releases-typo, r=ehuss
fix typo in RELEASES.md
2021-02-28 15:39:41 +00:00
Yuki Okushi
5091209750 Fix a typo in the find_anon_type doc 2021-02-28 23:10:55 +09:00
Vytautas Astrauskas
cdfff98394 Try to clarify GlobalAlloc::realloc documentation comment. 2021-02-28 14:30:26 +01:00
bors
1b1d85fd4c Auto merge of #82603 - RalfJung:miri, r=RalfJung
update Miri

Pulls in a fix for unnecessary rebuilds that basically breaks Playground.
2021-02-28 12:53:39 +00:00
Ralf Jung
6f101f4f52 update Miri 2021-02-28 12:07:53 +01:00
bors
247337f409 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.
2021-02-28 09:18:27 +00:00
bors
7c3a914b5d 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
2021-02-28 06:37:18 +00:00
Joshua Nelson
05140ec091 Propagate --test-args for x.py test src/tools/cargo 2021-02-28 01:00:26 -05:00
bors
6e2801c44e 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
2021-02-28 03:56:16 +00:00
bors
130b2ab0ed 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
2021-02-28 01:15:16 +00:00
Tomasz Miąsko
57de468ff9 Use -O in try_identity test that requires storage markers 2021-02-28 00:00:00 +00:00
Tomasz Miąsko
70760507e6 compiletest: run mir-opt tests with -C opt-level=1
The storage markers are removed at -C opt-level=0 and as a result output
of mir opt tests vary based on used optimization level. Use opt-level=1
for mir-opt tests to avoid the issue.
2021-02-28 20:10:45 +01:00
Tomasz Miąsko
8b184ff1b8 Remove storage markers if they won't be used during code generation
The storage markers constitute a substantial portion of all MIR
statements. At the same time, for builds without any optimizations,
the storage markers have no further use during and after MIR
optimization phase.

If storage markers are not necessary for code generation, remove them.
2021-02-28 20:10:44 +01:00
Dylan DPC
7847f690fd
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`
2021-02-27 21:56:25 +01:00
Dylan DPC
e38b3eb0b5
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:🧵: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
2021-02-27 21:56:24 +01:00
Dylan DPC
a70be0bec9
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
2021-02-27 21:56:23 +01:00
Dylan DPC
b5f5c106c0
Rollup merge of #82563 - lucas-deangelis:issue-82209-fix, r=jyn514
Fix intra-doc handling of `Self` in enum

Fixes #82209
2021-02-27 21:56:22 +01:00
Dylan DPC
b1113abacd
Rollup merge of #82561 - tspiteri:cube-root, r=Dylan-DPC
doc: cube root, not cubic root

Like we say square root, not quadratic root.
2021-02-27 21:56:21 +01:00
Dylan DPC
6d288c65df
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```
2021-02-27 21:56:20 +01:00
Dylan DPC
a7f9aca0a6
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``
2021-02-27 21:56:19 +01:00
Dylan DPC
13ea3fab5f
Rollup merge of #82498 - tmiasko:partitioning-debug, r=matthewjasper
Use log level to control partitioning debug output
2021-02-27 21:56:18 +01:00
Dylan DPC
840622910f
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.
2021-02-27 21:56:17 +01:00
Dylan DPC
ea43e5e21d
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.
2021-02-27 21:56:16 +01:00
Dylan DPC
be3d1eb301
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.
2021-02-27 21:56:15 +01:00
bjorn3
632a89529a Add a getter for Frame.loc
This is necessary for Priroda.
2021-02-27 21:01:02 +01:00
Josh Stone
31814c41aa 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
2021-02-27 11:09:00 -08:00