]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRollup merge of #78572 - de-vri-es:bsd-cloexec, r=m-ou-se
Mara Bos [Sun, 8 Nov 2020 12:36:07 +0000 (13:36 +0100)]
Rollup merge of #78572 - de-vri-es:bsd-cloexec, r=m-ou-se

Use SOCK_CLOEXEC and accept4() on more platforms.

This PR enables the use of `SOCK_CLOEXEC` and `accept4` on more platforms.

-----

Android uses the linux kernel, so it should also support it.

DragonflyBSD introduced them in 4.4 (December 2015):
https://www.dragonflybsd.org/release44/

FreeBSD introduced them in 10.0 (January 2014):
https://wiki.freebsd.org/AtomicCloseOnExec

Illumos introduced them in a commit in April 2013, not sure when it was released. It is quite possible that is has always been in Illumos:
https://github.com/illumos/illumos-gate/commit/5dbfd19ad5fcc2b779f40f80fa05c1bd28fd0b4e
https://illumos.org/man/3socket/socket
https://illumos.org/man/3socket/accept4

NetBSD introduced them in 6.0 (Oktober 2012) and 8.0 (July 2018):
https://man.netbsd.org/NetBSD-6.0/socket.2
https://man.netbsd.org/NetBSD-8.0/accept.2

OpenBSD introduced them in 5.7 (May 2015):
https://man.openbsd.org/socket https://man.openbsd.org/accept

3 years agoRollup merge of #78570 - sasurau4:test/check-pass-print-type-size, r=jyn514
Mara Bos [Sun, 8 Nov 2020 12:36:05 +0000 (13:36 +0100)]
Rollup merge of #78570 - sasurau4:test/check-pass-print-type-size, r=jyn514

Remove FIXME comment in print_type_sizes ui test suite

## Overview
Helps with #62277

> The type sizes are likely only printed when the actual layout is computed. For generic types, this only happens during codegen.

ref: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Codegen.20process.20question/near/215836807

Some tests like `multiple_types.rs` are passed even if using `check-pass`. But tests should be agnostic to when the actual layout is computed. The `build-pass` is intentionally used for them. I remove FIXME comments.

3 years agoRollup merge of #78065 - tshepang:nits, r=dtolnay
Mara Bos [Sun, 8 Nov 2020 12:36:01 +0000 (13:36 +0100)]
Rollup merge of #78065 - tshepang:nits, r=dtolnay

make concurrency helper more pleasant to read

3 years agoRollup merge of #76227 - CDirkx:const-poll, r=KodrAus
Mara Bos [Sun, 8 Nov 2020 12:35:58 +0000 (13:35 +0100)]
Rollup merge of #76227 - CDirkx:const-poll, r=KodrAus

Stabilize `Poll::is_ready` and `is_pending` as const

Insta-stabilize the methods `is_ready` and `is_pending` of `std::task::Poll` as const, in the same way as [PR#76198](https://github.com/rust-lang/rust/pull/76198).

Possible because of the recent stabilization of const control flow.

Part of #76225.

3 years agoRollup merge of #76097 - pickfire:stabilize-spin-loop, r=KodrAus
Mara Bos [Sun, 8 Nov 2020 12:35:54 +0000 (13:35 +0100)]
Rollup merge of #76097 - pickfire:stabilize-spin-loop, r=KodrAus

Stabilize hint::spin_loop

Partially fix #55002, deprecate in another release

r? ``````@KodrAus``````

3 years agoAuto merge of #77729 - petrochenkov:mergetarg, r=Mark-Simulacrum
bors [Sun, 8 Nov 2020 02:21:55 +0000 (02:21 +0000)]
Auto merge of #77729 - petrochenkov:mergetarg, r=Mark-Simulacrum

rustc_target: Move some target options from `Target` to `TargetOptions`

The only reason for `Target` to `TargetOptions` to be separate structures is that options in `TargetOptions` have reasonable defaults and options in `Target` don't.
(Otherwise all the options logically belong to a single `Target` struct.)

This PR moves a number of options with reasonable defaults from `Target` to `TargetOptions`, so they no longer needs to be specified explicitly for majority of the targets.
The move also allows to inherit the options from `rustc_target/src/spec/*_base.rs` files in a nicer way.
I didn't change any specific option values here.

The moved options are `target_c_int_width` (defaults to `"32"`), `target_endian` (defaults to `"little"`), `target_os` (defaults to `"none"`), `target_env` (defaults to `""`), `target_vendor` (defaults to `"unknown"`) and `linker_flavor` (defaults to `LinkerFlavor::Gcc`).

Next steps (in later PRs):
- Find a way to merge `TargetOptions` into `Target`
- If not, always access `TargetOptions` fields through `Deref` making it a part of `Target` at least logically (`session.target.target.options.foo` -> `session.target.target.foo`)
- ~Eliminate `session::config::Config` and use `Target` instead (`session.target.target.foo` -> `session.target.foo`)~ Done in https://github.com/rust-lang/rust/pull/77943.
- Avoid tautologies in option names (`target.target_os` -> `target.os`)
- Resolve _ https://github.com/rust-lang/rust/issues/77730 (rustc_target: The differences between `target_os = "none"` and `target_os = "unknown"`, and `target_vendor = "unknown"` and `target_vendor = ""` are unclear) noticed during implementation of this PR.

3 years agoAuto merge of #78784 - Mark-Simulacrum:revert-77421, r=petrochenkov
bors [Sat, 7 Nov 2020 21:57:02 +0000 (21:57 +0000)]
Auto merge of #78784 - Mark-Simulacrum:revert-77421, r=petrochenkov

Revert "Revert "resolve: Avoid "self-confirming" import resolutions in one more case""

Specifically, this reverts commit b20bce8ce54ea9d47c2e3eb0b17cbb6baf916ae2 from #77421 to fix #77586.

The lang team has decided that for the time being we want to avoid the breakage here (perhaps for a future edition; though almost certainly not the upcoming one), though a future PR may want to add a lint around this case (and perhaps others) which are unlikely to be readable code.

r? `@petrochenkov` to confirm this is the right way to fix #77586.

3 years agoAuto merge of #75199 - Mark-Simulacrum:debug-asserts, r=pietroalbini
bors [Sat, 7 Nov 2020 16:54:23 +0000 (16:54 +0000)]
Auto merge of #75199 - Mark-Simulacrum:debug-asserts, r=pietroalbini

Re-enable debug and LLVM assertions

Historically we've disabled these assertions on a number of platforms with the
goal of speeding up CI. Now, though, having migrated to GitHub actions, CI is
already pretty fast, and these debug assertions do bring us some value.

This does leave in some debug assertions that are performance-related: macOS
currently hovers at just under 2 hours.

There are also some other builders which have debug and LLVM assertions
disabled:

llvm-8, PR builder:

In one view, this builder tests our support for older LLVMs. But in reality, a
lot of our tests already disable themselves on older LLVMs, and I think our
general stance is that we really only support the in-tree LLVM. Plus, we really
want CI times on this builder to be really low, as it's run on *every* PR --
that's a lot of CI time.

test-various:

This disables debug asserts still -- as noted in the Dockerfile, we test code
size, and we need debug asserts off for that to work well.

Helps with #59637 -- but doesn't close it, macOS still has asserts off.

r? `@pietroalbini`

3 years agoremove FIXME comment of #62277 in print_type_sizez ui tests
Daiki Ihara [Sat, 7 Nov 2020 12:34:40 +0000 (21:34 +0900)]
remove FIXME comment of #62277 in print_type_sizez ui tests

3 years agoUpdate recently added targets
Vadim Petrochenkov [Sat, 7 Nov 2020 11:34:44 +0000 (14:34 +0300)]
Update recently added targets

3 years agorustc_target: Move `linker_flavor` from `Target` to `TargetOptions`
Vadim Petrochenkov [Thu, 8 Oct 2020 19:22:28 +0000 (22:22 +0300)]
rustc_target: Move `linker_flavor` from `Target` to `TargetOptions`

3 years agorustc_target: Move `target_vendor` from `Target` to `TargetOptions`
Vadim Petrochenkov [Thu, 8 Oct 2020 19:10:13 +0000 (22:10 +0300)]
rustc_target: Move `target_vendor` from `Target` to `TargetOptions`

3 years agorustc_target: Move `target_env` from `Target` to `TargetOptions`
Vadim Petrochenkov [Thu, 8 Oct 2020 18:47:22 +0000 (21:47 +0300)]
rustc_target: Move `target_env` from `Target` to `TargetOptions`

3 years agorustc_target: Move `target_os` from `Target` to `TargetOptions`
Vadim Petrochenkov [Thu, 8 Oct 2020 17:54:45 +0000 (20:54 +0300)]
rustc_target: Move `target_os` from `Target` to `TargetOptions`

3 years agorustc_target: Move `target_endian` from `Target` to `TargetOptions`
Vadim Petrochenkov [Thu, 8 Oct 2020 16:57:41 +0000 (19:57 +0300)]
rustc_target: Move `target_endian` from `Target` to `TargetOptions`

3 years agorustc_target: Move `target_c_int_width` from `Target` to `TargetOptions`
Vadim Petrochenkov [Thu, 8 Oct 2020 16:36:11 +0000 (19:36 +0300)]
rustc_target: Move `target_c_int_width` from `Target` to `TargetOptions`

3 years agoAuto merge of #78817 - RalfJung:miri, r=RalfJung
bors [Sat, 7 Nov 2020 08:40:56 +0000 (08:40 +0000)]
Auto merge of #78817 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/78741
Cc `@rust-lang/miri` r? `@ghost`

3 years agoupdate Miri
Ralf Jung [Fri, 6 Nov 2020 20:46:07 +0000 (21:46 +0100)]
update Miri

3 years agoAdd debug asserts to PR builder
Mark Rousskov [Wed, 5 Aug 2020 21:43:59 +0000 (17:43 -0400)]
Add debug asserts to PR builder

This is helpful to catch slightly more bugs before things hit main CI, and
doesn't cost too much extra CI time.

3 years agoRe-enable debug and LLVM assertions
Mark Rousskov [Wed, 5 Aug 2020 20:17:18 +0000 (16:17 -0400)]
Re-enable debug and LLVM assertions

Historically we've disabled these assertions on a number of platforms with the
goal of speeding up CI. Now, though, having migrated to GitHub actions, CI is
already pretty fast, and these debug assertions do bring us some value.

This does leave in some debug assertions that are performance-related: macOS
currently hovers at just under 2 hours.

There are also some other builders which have debug and LLVM assertions
disabled:

llvm-8, PR builder:

In one view, this builder tests our support for older LLVMs. But in reality, a
lot of our tests already disable themselves on older LLVMs, and I think our
general stance is that we really only support the in-tree LLVM. Plus, we really
want CI times on this builder to be really low, as it's run on *every* PR --
that's a lot of CI time.

test-various:

This disables debug asserts still -- as noted in the Dockerfile, we test code
size, and we need debug asserts off for that to work well.

3 years agoAuto merge of #75778 - AndyGauge:75521-rustdoc-book-improvements, r=jyn514
bors [Fri, 6 Nov 2020 19:01:10 +0000 (19:01 +0000)]
Auto merge of #75778 - AndyGauge:75521-rustdoc-book-improvements, r=jyn514

75521 rustdoc book improvements

Added some guidelines about documenting with rustdoc
Fixes #75521

3 years agoRevert "Revert "resolve: Avoid "self-confirming" import resolutions in one more case""
Mark Rousskov [Thu, 5 Nov 2020 20:16:12 +0000 (15:16 -0500)]
Revert "Revert "resolve: Avoid "self-confirming" import resolutions in one more case""

This reverts commit b20bce8ce54ea9d47c2e3eb0b17cbb6baf916ae2.

It retains the test added in that commit as a check-pass test, intended to
prevent future (unintentional) regressions.

3 years agoAuto merge of #78810 - JohnTitor:rollup-8fhtvxu, r=JohnTitor
bors [Fri, 6 Nov 2020 16:12:13 +0000 (16:12 +0000)]
Auto merge of #78810 - JohnTitor:rollup-8fhtvxu, r=JohnTitor

Rollup of 15 pull requests

Successful merges:

 - #74979 (`#![deny(unsafe_op_in_unsafe_fn)]` in sys/hermit)
 - #78006 (Use Intra-doc links for std::io::buffered)
 - #78167 (Fix unreachable sub-branch detection in or-patterns)
 - #78514 (Allow using 1/2/3/4 for `x.py setup` options)
 - #78538 (BTreeMap: document a curious assumption in test cases)
 - #78559 (Add LLVM upgrades from 7 to 10 to RELEASES.md)
 - #78666 (Fix shellcheck error)
 - #78705 (Print a summary of which test suite failed)
 - #78726 (Add link to rust website)
 - #78730 (Expand explanation of reverse_bits)
 - #78760 (`deny(invalid_codeblock_attributes)` for rustc_error_codes)
 - #78771 (inliner: Copy unevaluated constants only after successful inlining)
 - #78794 (rustc_expand: use collect_bang helper instead of manual reimplementation)
 - #78795 (The renumber pass is long gone)
 - #78798 (Fixing Spelling Typos)

Failed merges:

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

3 years agoRollup merge of #78798 - ankushduacodes:fixing-typo, r=jonas-schievink
Yuki Okushi [Fri, 6 Nov 2020 16:02:30 +0000 (01:02 +0900)]
Rollup merge of #78798 - ankushduacodes:fixing-typo, r=jonas-schievink

Fixing Spelling Typos

Fixing #78787

3 years agoRollup merge of #78795 - est31:node_id_assignment_doc_fix, r=oli-obk
Yuki Okushi [Fri, 6 Nov 2020 16:02:28 +0000 (01:02 +0900)]
Rollup merge of #78795 - est31:node_id_assignment_doc_fix, r=oli-obk

The renumber pass is long gone

Originally, there has been a dedicated pass for renumbering
AST NodeIds to have actual values. This pass had been added by
commit a5ad4c379466519a0bf977864a5cdc50a7ade385.

Then, later, this step was moved to where it resides now,
macro expansion. See commit c86c8d41a26b2037e80c9fd028a59313a78b3a66
or PR #36438.

The comment snippet, added by the original commit, has
survived the times without any change, becoming outdated
at removal of the dedicated pass.

Nowadays, grepping for the next_node_id function will show up
multiple places in the compiler that call it, but the main
rewriting that the comment talks about is still done in the
expansion step, inside an innocious looking visit_id function
that's called during macro invocation collection.

3 years agoRollup merge of #78794 - est31:collect_bang, r=oli-obk
Yuki Okushi [Fri, 6 Nov 2020 16:02:26 +0000 (01:02 +0900)]
Rollup merge of #78794 - est31:collect_bang, r=oli-obk

rustc_expand: use collect_bang helper instead of manual reimplementation

3 years agoRollup merge of #78771 - tmiasko:inline-consts, r=oli-obk
Yuki Okushi [Fri, 6 Nov 2020 16:02:24 +0000 (01:02 +0900)]
Rollup merge of #78771 - tmiasko:inline-consts, r=oli-obk

inliner: Copy unevaluated constants only after successful inlining

Inliner copies the unevaluated constants from the callee body to the
caller at the point where decision to inline is yet to be made. The
constants will be unnecessary if inlining were to fail.

Organize the code moving items from callee to the caller together in one
place to avoid the issue.

3 years agoRollup merge of #78760 - jyn514:deny-invalid-codeblocks, r=GuillaumeGomez
Yuki Okushi [Fri, 6 Nov 2020 16:02:22 +0000 (01:02 +0900)]
Rollup merge of #78760 - jyn514:deny-invalid-codeblocks, r=GuillaumeGomez

`deny(invalid_codeblock_attributes)` for rustc_error_codes

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

r? ``@GuillaumeGomez``

3 years agoRollup merge of #78730 - kornelski:not-inverse, r=Dylan-DPC
Yuki Okushi [Fri, 6 Nov 2020 16:02:20 +0000 (01:02 +0900)]
Rollup merge of #78730 - kornelski:not-inverse, r=Dylan-DPC

Expand explanation of reverse_bits

Original documentation only rephrased the function name

3 years agoRollup merge of #78726 - GuillaumeGomez:back-link-to-main-website, r=steveklabnik
Yuki Okushi [Fri, 6 Nov 2020 16:02:18 +0000 (01:02 +0900)]
Rollup merge of #78726 - GuillaumeGomez:back-link-to-main-website, r=steveklabnik

Add link to rust website

Fixes #30838

This doesn't fix the issue as suggested but it at least adds a link to allow to go back to the rust website.

r? `@steveklabnik`

3 years agoRollup merge of #78705 - Mark-Simulacrum:nicer-failure-compiletest, r=jyn514
Yuki Okushi [Fri, 6 Nov 2020 16:02:16 +0000 (01:02 +0900)]
Rollup merge of #78705 - Mark-Simulacrum:nicer-failure-compiletest, r=jyn514

Print a summary of which test suite failed

Especially on CI, where cross-compiling is common and single builder may end up
with multiple hosts and multiple targets, it can be annoying to scroll back to
the nearest start of test marker. This prints out a summary of the test suite
being run directly in compiletest.

For example, on a mir-opt failure, this would show something like this:

```
failures:
    [mir-opt] mir-opt/while-storage.rs

test result: FAILED. 140 passed; 1 failed; 2 ignored; 0 measured; 0 filtered out

Some tests failed in compiletest suite=mir-opt mode=mir-opt host=x86_64-unknown-linux-gnu target=x86_64-unknown-linux-gnu
```

Fixes #78517

3 years agoRollup merge of #78666 - sasurau4:fix/shellcheck-error, r=jyn514
Yuki Okushi [Fri, 6 Nov 2020 16:02:14 +0000 (01:02 +0900)]
Rollup merge of #78666 - sasurau4:fix/shellcheck-error, r=jyn514

Fix shellcheck error

## Overview

Helps with #77290

This pr fix only errors of shellcheck, the result of `git ls-files '*.sh' | xargs shellcheck --severity=error`.

Fixing error are following.

- https://github.com/koalaman/shellcheck/wiki/SC2148
- https://github.com/koalaman/shellcheck/wiki/SC1008

Disable error following.
- https://github.com/koalaman/shellcheck/wiki/SC2068

3 years agoRollup merge of #78559 - glandium:release-notes, r=Mark-Simulacrum
Yuki Okushi [Fri, 6 Nov 2020 16:02:12 +0000 (01:02 +0900)]
Rollup merge of #78559 - glandium:release-notes, r=Mark-Simulacrum

Add LLVM upgrades from 7 to 10 to RELEASES.md

Fixes #78464

3 years agoRollup merge of #78538 - ssomers:btree_testing_rng, r=Mark-Simulacrum
Yuki Okushi [Fri, 6 Nov 2020 16:02:09 +0000 (01:02 +0900)]
Rollup merge of #78538 - ssomers:btree_testing_rng, r=Mark-Simulacrum

BTreeMap: document a curious assumption in test cases

r? ```@Mark-Simulacrum```

3 years agoRollup merge of #78514 - jyn514:setup-number, r=Mark-Simulacrum
Yuki Okushi [Fri, 6 Nov 2020 16:02:07 +0000 (01:02 +0900)]
Rollup merge of #78514 - jyn514:setup-number, r=Mark-Simulacrum

Allow using 1/2/3/4 for `x.py setup` options

This undocumented feature allows you to typo 'a' as '1'.

r? ```@Mark-Simulacrum```
cc ```@Lokathor```

3 years agoRollup merge of #78167 - Nadrieril:fix-76836_, r=varkor
Yuki Okushi [Fri, 6 Nov 2020 16:02:05 +0000 (01:02 +0900)]
Rollup merge of #78167 - Nadrieril:fix-76836_, r=varkor

Fix unreachable sub-branch detection in or-patterns

The previous implementation was too eager to avoid unnecessary "unreachable pattern" warnings. I feel more confident about this implementation than I felt about the previous one.
Fixes https://github.com/rust-lang/rust/issues/76836.

``@rustbot`` modify labels: +A-exhaustiveness-checking

3 years agoRollup merge of #78006 - pitaj:master, r=jyn514
Yuki Okushi [Fri, 6 Nov 2020 16:02:03 +0000 (01:02 +0900)]
Rollup merge of #78006 - pitaj:master, r=jyn514

Use Intra-doc links for std::io::buffered

Helps with #75080. I used the implicit link style for intrinsics, as that was what `minnumf32` and others already had.

``@rustbot`` modify labels: T-doc, A-intra-doc-links

r? ``@jyn514``

3 years agoRollup merge of #74979 - maekawatoshiki:fix, r=Mark-Simulacrum
Yuki Okushi [Fri, 6 Nov 2020 16:01:59 +0000 (01:01 +0900)]
Rollup merge of #74979 - maekawatoshiki:fix, r=Mark-Simulacrum

`#![deny(unsafe_op_in_unsafe_fn)]` in sys/hermit

Partial fix of #73904.

This encloses ``unsafe`` operations in ``unsafe fn`` in ``sys/hermit``.
Some unsafe blocks are not well documented because some system-based functions lack documents.

3 years agoStabilize hint::spin_loop
Ivan Tham [Sun, 30 Aug 2020 02:35:50 +0000 (10:35 +0800)]
Stabilize hint::spin_loop

Partially fix #55002, deprecate in another release

Co-authored-by: Ashley Mannix <kodraus@hey.com>
Update stable version for stabilize_spin_loop

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
Use better example for spinlock

As suggested by KodrAus

Remove renamed_spin_loop already available in master

Fix spin loop example

3 years agoDisable accept4 on Android.
Maarten de Vries [Sat, 31 Oct 2020 13:20:18 +0000 (14:20 +0100)]
Disable accept4 on Android.

3 years agoignore shellcheck error SC2068
Daiki Ihara [Tue, 3 Nov 2020 13:57:56 +0000 (22:57 +0900)]
ignore shellcheck error SC2068

3 years agofix shellcheck error of SC2068
Daiki Ihara [Mon, 2 Nov 2020 12:17:52 +0000 (21:17 +0900)]
fix shellcheck error of SC2068

3 years agofix shellcheck error of SC1008
Daiki Ihara [Mon, 2 Nov 2020 12:58:43 +0000 (21:58 +0900)]
fix shellcheck error of SC1008

3 years agofix shellcheck error of SC2148
Daiki Ihara [Tue, 3 Nov 2020 13:55:49 +0000 (22:55 +0900)]
fix shellcheck error of SC2148

3 years agoAuto merge of #77351 - jyn514:clippy-sysroot, r=Mark-Simulacrum
bors [Fri, 6 Nov 2020 11:31:18 +0000 (11:31 +0000)]
Auto merge of #77351 - jyn514:clippy-sysroot, r=Mark-Simulacrum

Fix `x.py clippy`

I don't think this ever worked.

Fixes https://github.com/rust-lang/rust/issues/77309. `--fix` support is a work in progress, but works for a very small subset of `libtest`.

This works by using the host `cargo-clippy` driver; it does not use `stage0.txt` at all. To mitigate confusion from this, it gives an error if you don't have `rustc +nightly` as the default rustc in `$PATH`. Additionally, it means that bootstrap can't set `RUSTC`; this makes it no longer possible for clippy to detect the sysroot itself. Instead, bootstrap passes the sysroot to cargo.

r? `@ghost`

3 years agoAuto merge of #78267 - richkadel:llvm-coverage-counters-2.0.3r1, r=tmandry
bors [Fri, 6 Nov 2020 06:59:44 +0000 (06:59 +0000)]
Auto merge of #78267 - richkadel:llvm-coverage-counters-2.0.3r1, r=tmandry

Working expression optimization, and some improvements to branch-level source coverage

This replaces PR #78040 after reorganizing the original commits (by request) into a more logical sequence of major changes.

Most of the work is in the MIR `transform/coverage/` directory (originally, `transform/instrument_coverage.rs`).

Note this PR includes some significant additional debugging capabilities, to help myself and any future developer working on coverage improvements or issues.

In particular, there's a new Graphviz (.dot file) output for the coverage graph (the `BasicCoverageBlock` control flow graph) that provides ways to get some very good insight into the relationships between the MIR, the coverage graph BCBs, coverage spans, and counters. (There are also some cool debugging options, available via environment variable, to alter how some data in the graph appears.)

And the code for this Graphviz view is actually generic... it can be used by any implementation of the Rust `Graph` traits.

Finally (for now), I also now output information from `llvm-cov` that shows the actual counters and spans it found in the coverage map, and their counts (from the `--debug` flag). I found this to be enormously helpful in debugging some coverage issues, so I kept it in the test results as well for additional context.

`@tmandry` `@wesleywiser`

r? `@tmandry`

Here's an example of the new coverage graph:

* Within each `BasicCoverageBlock` (BCB), you can see each `CoverageSpan` and its contributing statements (MIR `Statement`s and/or `Terminator`s)
* Each `CoverageSpan` has a `Counter` or and `Expression`, and `Expression`s show their Add/Subtract operation with nested operations. (This can be changed to show the Counter and Expression IDs instead, or in addition to, the BCB.)
* The terminators of all MIR `BasicBlock`s in the BCB, including one final `Terminator`
* If an "edge counter" is required (because we need to count an edge between blocks, in some cases) the edge's Counter or Expression is shown next to its label. (Not shown in the example below.) (FYI, Edge Counters are converted into a new MIR `BasicBlock` with `Goto`)

<img width="1116" alt="Screen Shot 2020-10-17 at 12 23 29 AM" src="https://user-images.githubusercontent.com/3827298/96331095-616cb480-100f-11eb-8212-60f2d433e2d8.png">

r? `@tmandry`
FYI: `@wesleywiser`

3 years agoDisable the spanview tests on MacOS for now
Rich Kadel [Fri, 6 Nov 2020 02:21:30 +0000 (18:21 -0800)]
Disable the spanview tests on MacOS for now

And even though CI should now pass for MacOS, the llvm-cov show --debug
flag does not work when developing outside of CI, so I'm disabling it
for MacOS by default.

3 years agoAuto merge of #77856 - GuillaumeGomez:automatic-links-lint, r=jyn514,ollie27
bors [Fri, 6 Nov 2020 04:17:41 +0000 (04:17 +0000)]
Auto merge of #77856 - GuillaumeGomez:automatic-links-lint, r=jyn514,ollie27

Add non_autolinks lint

Part of #77501.

r? `@jyn514`

3 years agoFixing Spelling Typos
ankushduacodes [Fri, 6 Nov 2020 03:55:58 +0000 (09:25 +0530)]
Fixing Spelling Typos

3 years agodocument HACKs
Peter Jaszkowiak [Fri, 6 Nov 2020 02:26:08 +0000 (19:26 -0700)]
document HACKs

3 years agoFix sed command for Mac
Rich Kadel [Thu, 5 Nov 2020 07:27:47 +0000 (23:27 -0800)]
Fix sed command for Mac

add -e between -i and quoted script

I had tested on my mac but forgot I had aliased sed=gsed. My bad.

3 years agorename some tests to avoid exceeding windows path limits
Rich Kadel [Wed, 4 Nov 2020 05:45:32 +0000 (21:45 -0800)]
rename some tests to avoid exceeding windows path limits

And restored missing error message from llvm-cov show

And since some CI builds disable LLVM assertions (which disables the
--debug option in llvm-cov show), I check to see if LLVM assertions are
disabled, and if so, I don't add --debug and don't check the counter
file diffs.

3 years agofix cross-platform test bugs
Rich Kadel [Mon, 2 Nov 2020 23:01:30 +0000 (15:01 -0800)]
fix cross-platform test bugs

More portable way to make python 2/3 portable.

Strip Args line (with hardcoded paths) from debug counters output.

Ignore diff failures from llvm-cov debug output files ("counters"
files), since generic function instantiations will appear in those files
with mangled names. (Sadly, the demangler is apparently not applied to
the debug output.)

3 years agoResponded to all feedback as of 2020-10-30
Rich Kadel [Fri, 30 Oct 2020 23:09:05 +0000 (16:09 -0700)]
Responded to all feedback as of 2020-10-30

3 years agoAddressed all feedback to date
Rich Kadel [Sun, 25 Oct 2020 18:13:16 +0000 (11:13 -0700)]
Addressed all feedback to date

3 years agoAdded comments on remapping expression IDs, and URL to spanviews
Rich Kadel [Sun, 25 Oct 2020 08:53:44 +0000 (01:53 -0700)]
Added comments on remapping expression IDs, and URL to spanviews

3 years agoInjecting expressions in place of counters where helpful
Rich Kadel [Thu, 22 Oct 2020 21:30:03 +0000 (14:30 -0700)]
Injecting expressions in place of counters where helpful

Implementing the Graph traits for the BasicCoverageBlock
graph.

optimized replacement of counters with expressions plus new BCB graphviz

* Avoid adding coverage to unreachable blocks.
* Special case for Goto at the end of the body. Make it non-reportable.

Improved debugging and formatting options (from env)

Don't automatically add counters to BCBs without CoverageSpans. They may
still get counters but only if there are dependencies from
other BCBs that have spans, I think.

Make CodeRegions optional for Counters too. It is
possible to inject counters (`llvm.instrprof.increment` intrinsic calls
without corresponding code regions in the coverage map. An expression
can still uses these counter values.

Refactored instrument_coverage.rs -> instrument_coverage/mod.rs, and
then broke up the mod into multiple files.

Compiling with coverage, with the expression optimization, works on
the json5format crate and its dependencies.

Refactored debug features from mod.rs to debug.rs

3 years agoAdds coverage graphviz
Rich Kadel [Fri, 23 Oct 2020 03:28:16 +0000 (20:28 -0700)]
Adds coverage graphviz

3 years agoImplemented CoverageGraph of BasicCoverageBlocks
Rich Kadel [Fri, 23 Oct 2020 06:11:38 +0000 (23:11 -0700)]
Implemented CoverageGraph of BasicCoverageBlocks

3 years agoSplitting transform/instrument_coverage.rs into transform/coverage/...
Rich Kadel [Fri, 23 Oct 2020 07:45:07 +0000 (00:45 -0700)]
Splitting transform/instrument_coverage.rs into transform/coverage/...

3 years agoRust coverage before splitting instrument_coverage.rs
Rich Kadel [Mon, 5 Oct 2020 23:36:10 +0000 (16:36 -0700)]
Rust coverage before splitting instrument_coverage.rs

3 years agoThe renumber pass is long gone
est31 [Fri, 6 Nov 2020 02:03:22 +0000 (03:03 +0100)]
The renumber pass is long gone

Originally, there has been a dedicated pass for renumbering
AST NodeIds to have actual values. This pass had been added by
commit a5ad4c379466519a0bf977864a5cdc50a7ade385.

Then, later, this step was moved to where it resides now,
macro expansion. See commit c86c8d41a26b2037e80c9fd028a59313a78b3a66
or PR #36438.

The comment snippet, added by the original commit, has
survived the times without any change, becoming outdated
at removal of the dedicated pass.

Nowadays, grepping for the next_node_id function will show up
multiple places in the compiler that call it, but the main
rewriting that the comment talks about is still done in the
expansion step, inside an innocious looking visit_id function
that's called during macro invocation collection.

3 years agorustc_expand: use collect_bang helper instead of manual reimplementation
est31 [Fri, 6 Nov 2020 01:46:03 +0000 (02:46 +0100)]
rustc_expand: use collect_bang helper instead of manual reimplementation

3 years agoIntra-doc links for std::io::buffered
Peter Jaszkowiak [Fri, 16 Oct 2020 04:48:57 +0000 (22:48 -0600)]
Intra-doc links for std::io::buffered

3 years agoGet `--fix` working for everything except rustdoc
Joshua Nelson [Tue, 27 Oct 2020 01:18:28 +0000 (21:18 -0400)]
Get `--fix` working for everything except rustdoc

Here's the error for rustdoc:

```
Checking rustdoc artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
error: no library targets found in package `rustdoc-tool`
```

3 years agoEmit lints in the order in which they occur in the file.
Nadrieril [Thu, 5 Nov 2020 22:17:26 +0000 (22:17 +0000)]
Emit lints in the order in which they occur in the file.

3 years agoFix unreachable sub-branch detection
Nadrieril [Tue, 20 Oct 2020 21:08:19 +0000 (22:08 +0100)]
Fix unreachable sub-branch detection

This fixes https://github.com/rust-lang/rust/issues/76836

3 years agoAdd test
Nadrieril [Tue, 20 Oct 2020 18:32:59 +0000 (19:32 +0100)]
Add test

3 years agoFix even more URLs
Guillaume Gomez [Thu, 5 Nov 2020 13:33:23 +0000 (14:33 +0100)]
Fix even more URLs

3 years agoAuto merge of #78774 - flip1995:clippyup, r=Manishearth
bors [Thu, 5 Nov 2020 17:57:31 +0000 (17:57 +0000)]
Auto merge of #78774 - flip1995:clippyup, r=Manishearth

Update Clippy

Biweekly Clippy update

r? `@Manishearth`

3 years ago`deny(invalid_codeblock_attributes)`
Joshua Nelson [Thu, 5 Nov 2020 04:33:00 +0000 (23:33 -0500)]
`deny(invalid_codeblock_attributes)`

3 years agoMerge commit 'b20d4c155d2fe3a8391f86dcf9a8c49e17188703' into clippyup
flip1995 [Thu, 5 Nov 2020 13:29:48 +0000 (14:29 +0100)]
Merge commit 'b20d4c155d2fe3a8391f86dcf9a8c49e17188703' into clippyup

3 years agoAuto merge of #78638 - vn-ki:bindigs-after-at-issue-69971, r=oli-obk
bors [Thu, 5 Nov 2020 13:26:08 +0000 (13:26 +0000)]
Auto merge of #78638 - vn-ki:bindigs-after-at-issue-69971, r=oli-obk

reverse binding order in matches to allow the subbinding of copyable fields in bindings after @

Fixes #69971

### TODO

- [x] Regression tests

r? `@oli-obk`

3 years agoAuto merge of #6296 - flip1995:rustup, r=flip1995
bors [Thu, 5 Nov 2020 13:14:26 +0000 (13:14 +0000)]
Auto merge of #6296 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: none

3 years agoAuto merge of #78767 - m-ou-se:rollup-eu5wgxl, r=m-ou-se
bors [Thu, 5 Nov 2020 10:22:20 +0000 (10:22 +0000)]
Auto merge of #78767 - m-ou-se:rollup-eu5wgxl, r=m-ou-se

Rollup of 15 pull requests

Successful merges:

 - #76718 (Move Vec UI tests to unit tests when possible)
 - #78093 (Clean up docs for 'as' keyword)
 - #78425 (Move f64::NAN ui tests into `library`)
 - #78465 (Change as_str → to_string in proc_macro::Ident::span() docs)
 - #78584 (Add keyboard handling to the theme picker menu)
 - #78716 (Array trait impl comment/doc fixes)
 - #78727 ((rustdoc) fix test for trait impl display)
 - #78733 (fix a couple of clippy warnings:)
 - #78735 (Simplify the implementation of `get_mut` (no unsafe))
 - #78738 (Move range in ui test to ops test in library/core)
 - #78739 (Fix ICE on type error in async function)
 - #78742 (make intern_const_alloc_recursive return error)
 - #78756 (Update cargo)
 - #78757 (Improve and clean up some intra-doc links)
 - #78758 (Fixed typo in comment)

Failed merges:

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

3 years agoRollup merge of #78758 - eltociear:patch-1, r=jyn514
Mara Bos [Thu, 5 Nov 2020 09:30:04 +0000 (10:30 +0100)]
Rollup merge of #78758 - eltociear:patch-1, r=jyn514

Fixed typo in comment

paramter -> parameter

3 years agoRollup merge of #78757 - camelid:crate-link-text, r=jyn514
Mara Bos [Thu, 5 Nov 2020 09:30:02 +0000 (10:30 +0100)]
Rollup merge of #78757 - camelid:crate-link-text, r=jyn514

Improve and clean up some intra-doc links

3 years agoRollup merge of #78756 - ehuss:update-cargo, r=ehuss
Mara Bos [Thu, 5 Nov 2020 09:30:01 +0000 (10:30 +0100)]
Rollup merge of #78756 - ehuss:update-cargo, r=ehuss

Update cargo

7 commits in becb4c282b8f37469efb8f5beda45a5501f9d367..d5556aeb8405b1fe696adb6e297ad7a1f2989b62
2020-10-28 16:41:55 +0000 to 2020-11-04 22:20:36 +0000
- Implement weak dependency features. (rust-lang/cargo#8818)
- Avoid some extra downloads with new feature resolver. (rust-lang/cargo#8823)
- fix: remove install command `$`, for copying friendly (rust-lang/cargo#8828)
- Bump `anyhow` dependency to `1.0.34` in `crates-io` crate (rust-lang/cargo#8826)
- Normalize SourceID in `cargo metadata`. (rust-lang/cargo#8824)
- vendor: correct the path to cargo config (rust-lang/cargo#8822)
- Make host_root return host.root(), not host.dest() (rust-lang/cargo#8819)

3 years agoRollup merge of #78742 - vn-ki:fix-issue-78655, r=oli-obk
Mara Bos [Thu, 5 Nov 2020 09:29:59 +0000 (10:29 +0100)]
Rollup merge of #78742 - vn-ki:fix-issue-78655, r=oli-obk

make intern_const_alloc_recursive return error

fix #78655

r? ``@oli-obk``

3 years agoRollup merge of #78739 - hameerabbasi:issue-78654, r=nikomatsakis
Mara Bos [Thu, 5 Nov 2020 09:29:57 +0000 (10:29 +0100)]
Rollup merge of #78739 - hameerabbasi:issue-78654, r=nikomatsakis

Fix ICE on type error in async function

Fixes #78654

3 years agoRollup merge of #78738 - sasurau4:test/move-range-test-to-library-core, r=jyn514
Mara Bos [Thu, 5 Nov 2020 09:29:56 +0000 (10:29 +0100)]
Rollup merge of #78738 - sasurau4:test/move-range-test-to-library-core, r=jyn514

Move range in ui test to ops test in library/core

Helps with #76268

r? ````@matklad````

3 years agoRollup merge of #78735 - danielhenrymantilla:simplify-unsafecell-getmut, r=RalfJung
Mara Bos [Thu, 5 Nov 2020 09:29:54 +0000 (10:29 +0100)]
Rollup merge of #78735 - danielhenrymantilla:simplify-unsafecell-getmut, r=RalfJung

Simplify the implementation of `get_mut` (no unsafe)

Quick PR to reduce one use of `unsafe` pointed out in the previous PR

r? ````@RalfJung````

3 years agoRollup merge of #78733 - matthiaskrgr:cl11ppy, r=jyn514
Mara Bos [Thu, 5 Nov 2020 09:29:53 +0000 (10:29 +0100)]
Rollup merge of #78733 - matthiaskrgr:cl11ppy, r=jyn514

fix a couple of clippy warnings:

filter_next
manual_strip
redundant_static_lifetimes
single_char_pattern
unnecessary_cast
unused_unit
op_ref
redundant_closure
useless_conversion

3 years agoRollup merge of #78727 - liketechnik:issue-55201, r=GuillaumeGomez
Mara Bos [Thu, 5 Nov 2020 09:29:50 +0000 (10:29 +0100)]
Rollup merge of #78727 - liketechnik:issue-55201, r=GuillaumeGomez

(rustdoc) fix test for trait impl display

The test checks that parameters and return values with `impl Trait` types are correctly generated in rustdoc's output.

In essence, the previous version of the test checked the absence of values that would never be generated by rustdoc, so it could basically never fail. These values were adjusted to the expected output and are now required to exist in rustdoc's output. See https://github.com/rust-lang/rust/issues/55201#issuecomment-716182474 for a detailed explanation of the reasoning behind the changes.

Note that the output of rustdoc for `impl Trait`s in parameters and return values did not change since the inital test creation, so this PR only modifies the test.

Closes #55201

3 years agoRollup merge of #78716 - est31:array_traits, r=Dylan-DPC
Mara Bos [Thu, 5 Nov 2020 09:29:46 +0000 (10:29 +0100)]
Rollup merge of #78716 - est31:array_traits, r=Dylan-DPC

Array trait impl comment/doc fixes

Two small doc/comment fixes regarding trait implementations on arrays.

3 years agoRollup merge of #78584 - notriddle:master, r=GuillaumeGomez
Mara Bos [Thu, 5 Nov 2020 09:29:45 +0000 (10:29 +0100)]
Rollup merge of #78584 - notriddle:master, r=GuillaumeGomez

Add keyboard handling to the theme picker menu

This PR is mostly designed to bring the theme picker closer to feature parity with the menu bar from docs.rs. Though the rustdoc theme picker is technically already usable from the keyboard, it's really weird that arrow keys work on some of the menus, but not all of them, in the exact same page.

3 years agoRollup merge of #78465 - est31:proc_macro_to_string, r=jyn514
Mara Bos [Thu, 5 Nov 2020 09:29:42 +0000 (10:29 +0100)]
Rollup merge of #78465 - est31:proc_macro_to_string, r=jyn514

Change as_str → to_string in proc_macro::Ident::span() docs

There is no `as_str` function on Ident any more.

Also change it to an intra doc link while we're at it.

3 years agoRollup merge of #78425 - chansuke:move_nan, r=jyn514
Mara Bos [Thu, 5 Nov 2020 09:29:40 +0000 (10:29 +0100)]
Rollup merge of #78425 - chansuke:move_nan, r=jyn514

Move f64::NAN ui tests into `library`

This is a partial fix of #76268.

r? ```@matklad```

3 years agoRollup merge of #78093 - camelid:as-cleanup, r=jyn514
Mara Bos [Thu, 5 Nov 2020 09:29:38 +0000 (10:29 +0100)]
Rollup merge of #78093 - camelid:as-cleanup, r=jyn514

Clean up docs for 'as' keyword

3 years agoRollup merge of #76718 - poliorcetics:vec-ui-to-unit-test, r=jyn514
Mara Bos [Thu, 5 Nov 2020 09:29:35 +0000 (10:29 +0100)]
Rollup merge of #76718 - poliorcetics:vec-ui-to-unit-test, r=jyn514

Move Vec UI tests to unit tests when possible

Helps with #76268.

I'm moving the tests using `Vec` or `VecDeque`.

````@rustbot```` modify labels: A-testsuite C-cleanup T-libs

3 years agoFix more URLs
Guillaume Gomez [Thu, 5 Nov 2020 09:23:39 +0000 (10:23 +0100)]
Fix more URLs

3 years agoRename lint to non_autolinks
Guillaume Gomez [Sat, 31 Oct 2020 14:14:44 +0000 (15:14 +0100)]
Rename lint to non_autolinks

3 years agoImprove lint even more
Guillaume Gomez [Sat, 31 Oct 2020 12:46:28 +0000 (13:46 +0100)]
Improve lint even more

3 years agoDon't check for URLs inside codeblocks
Guillaume Gomez [Sat, 17 Oct 2020 21:58:46 +0000 (23:58 +0200)]
Don't check for URLs inside codeblocks

3 years agoUpdate URLs used in the lint example
Guillaume Gomez [Sat, 17 Oct 2020 14:43:13 +0000 (16:43 +0200)]
Update URLs used in the lint example

3 years agoRename automatic_links to url_improvements
Guillaume Gomez [Sat, 17 Oct 2020 14:38:49 +0000 (16:38 +0200)]
Rename automatic_links to url_improvements

3 years agoFix automatic_links warnings
Guillaume Gomez [Wed, 14 Oct 2020 15:35:43 +0000 (17:35 +0200)]
Fix automatic_links warnings

3 years agoImprove automatic_links globally
Guillaume Gomez [Wed, 14 Oct 2020 13:11:55 +0000 (15:11 +0200)]
Improve automatic_links globally

3 years agoExtend automatic_links lint to take into account URLs without link syntax
Guillaume Gomez [Tue, 13 Oct 2020 13:46:34 +0000 (15:46 +0200)]
Extend automatic_links lint to take into account URLs without link syntax

3 years agoAdd tests for automatic_links lint
Guillaume Gomez [Mon, 12 Oct 2020 16:29:56 +0000 (18:29 +0200)]
Add tests for automatic_links lint