Commit graph

132806 commits

Author SHA1 Message Date
Giacomo Stevanato
387568cd56 Added SAFETY comment as request 2020-11-09 22:34:31 +01:00
Giacomo Stevanato
8d1575365d Remove useless bound checks from into_sorted_vec 2020-11-07 22:20:26 +01:00
Giacomo Stevanato
25b3f61c38 Remove useless branches from sift_down_range loop 2020-11-07 22:20:26 +01:00
Giacomo Stevanato
6dfcf9afde Remove branches from sift_down_to_bottom loop 2020-11-07 22:20:26 +01:00
bors
dc06a36074 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`
2020-11-06 11:31:18 +00:00
bors
8532e742fc 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`
2020-11-06 06:59:44 +00:00
Rich Kadel
68014e6b1c 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.
2020-11-05 20:24:36 -08:00
bors
f92b931045 Auto merge of #77856 - GuillaumeGomez:automatic-links-lint, r=jyn514,ollie27
Add non_autolinks lint

Part of #77501.

r? `@jyn514`
2020-11-06 04:17:41 +00:00
Rich Kadel
430dcb6110 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.
2020-11-05 18:24:20 -08:00
Rich Kadel
8fc697f958 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.
2020-11-05 18:24:20 -08:00
Rich Kadel
cdbce10926 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.)
2020-11-05 18:24:19 -08:00
Rich Kadel
a7d956583c Responded to all feedback as of 2020-10-30 2020-11-05 18:24:18 -08:00
Rich Kadel
1973f84ebb Addressed all feedback to date 2020-11-05 18:24:17 -08:00
Rich Kadel
5545c56e9d Added comments on remapping expression IDs, and URL to spanviews 2020-11-05 18:24:16 -08:00
Rich Kadel
198ba3bd1c 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
2020-11-05 18:24:15 -08:00
Rich Kadel
3291d28e9a Adds coverage graphviz 2020-11-05 18:24:14 -08:00
Rich Kadel
b5020648fe Implemented CoverageGraph of BasicCoverageBlocks 2020-11-05 18:24:13 -08:00
Rich Kadel
c7ae4c2cb6 Splitting transform/instrument_coverage.rs into transform/coverage/... 2020-11-05 18:24:12 -08:00
Rich Kadel
c7747cc772 Rust coverage before splitting instrument_coverage.rs 2020-11-05 18:24:12 -08:00
Joshua Nelson
8d2fa72fc8 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`
```
2020-11-05 18:06:09 -05:00
Guillaume Gomez
99200f760b Fix even more URLs 2020-11-05 20:11:29 +01:00
bors
9d78d1d027 Auto merge of #78774 - flip1995:clippyup, r=Manishearth
Update Clippy

Biweekly Clippy update

r? `@Manishearth`
2020-11-05 17:57:31 +00:00
flip1995
46c714f641
Merge commit 'b20d4c155d2fe3a8391f86dcf9a8c49e17188703' into clippyup 2020-11-05 14:29:48 +01:00
bors
b1d9f31e04 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`
2020-11-05 13:26:08 +00:00
bors
b20d4c155d Auto merge of #6296 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2020-11-05 13:14:26 +00:00
bors
f7801d6c7c 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
2020-11-05 10:22:20 +00:00
Mara Bos
8416e13d88
Rollup merge of #78758 - eltociear:patch-1, r=jyn514
Fixed typo in comment

paramter -> parameter
2020-11-05 10:30:04 +01:00
Mara Bos
f383e4f1d9
Rollup merge of #78757 - camelid:crate-link-text, r=jyn514
Improve and clean up some intra-doc links
2020-11-05 10:30:02 +01:00
Mara Bos
679c4c7015
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)
2020-11-05 10:30:01 +01:00
Mara Bos
5ffccc4dfa
Rollup merge of #78742 - vn-ki:fix-issue-78655, r=oli-obk
make intern_const_alloc_recursive return error

fix #78655

r? ``@oli-obk``
2020-11-05 10:29:59 +01:00
Mara Bos
171d29c9c5
Rollup merge of #78739 - hameerabbasi:issue-78654, r=nikomatsakis
Fix ICE on type error in async function

Fixes #78654
2020-11-05 10:29:57 +01:00
Mara Bos
86e6afafe1
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````
2020-11-05 10:29:56 +01:00
Mara Bos
29fad213b2
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````
2020-11-05 10:29:54 +01:00
Mara Bos
8640360870
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
2020-11-05 10:29:53 +01:00
Mara Bos
9bbb052af8
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
2020-11-05 10:29:50 +01:00
Mara Bos
43e1b58bcc
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.
2020-11-05 10:29:46 +01:00
Mara Bos
cbf74bc4ca
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.
2020-11-05 10:29:45 +01:00
Mara Bos
6d7098f543
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.
2020-11-05 10:29:42 +01:00
Mara Bos
99229337a8
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```
2020-11-05 10:29:40 +01:00
Mara Bos
10d2843604
Rollup merge of #78093 - camelid:as-cleanup, r=jyn514
Clean up docs for 'as' keyword
2020-11-05 10:29:38 +01:00
Mara Bos
55f4b802fb
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
2020-11-05 10:29:35 +01:00
Guillaume Gomez
16ed8501ef Fix more URLs 2020-11-05 10:23:39 +01:00
Guillaume Gomez
9d114506c6 Rename lint to non_autolinks 2020-11-05 10:22:08 +01:00
Guillaume Gomez
6be97e2250 Improve lint even more 2020-11-05 10:22:08 +01:00
Guillaume Gomez
1fb404bebe Don't check for URLs inside codeblocks 2020-11-05 10:22:08 +01:00
Guillaume Gomez
fce2be0ea7 Update URLs used in the lint example 2020-11-05 10:22:08 +01:00
Guillaume Gomez
60caf51b0d Rename automatic_links to url_improvements 2020-11-05 10:22:08 +01:00
Guillaume Gomez
55b4d21e25 Fix automatic_links warnings 2020-11-05 10:22:08 +01:00
Guillaume Gomez
7f839b2ece Improve automatic_links globally 2020-11-05 10:22:08 +01:00
Guillaume Gomez
f467b8d77c Extend automatic_links lint to take into account URLs without link syntax 2020-11-05 10:22:08 +01:00