Commit Graph

140477 Commits

Author SHA1 Message Date
Yuki Okushi 02326d5521
Rollup merge of #83003 - notriddle:rustdoc-index-v3, r=GuillaumeGomez
rustdoc: tweak the search index format

This essentially switches search-index.js from a "array of struct" to a "struct of array" format, like this:

    {
    "doc": "Crate documentation",
    "t": [ 1, 1, 2, 3, ... ],
    "n": [ "Something", "SomethingElse", "whatever", "do_stuff", ... ],
    "q": [ "a::b", "", "", "", ... ],
    "d": [ "A Struct That Does Something", "Another Struct", "a function", "another function", ... ],
    "i": [ 0, 0, 1, 1, ... ],
    "f": [ null, null, [], [], ... ],
    "p": ...,
    "a": ...
    }

So `{ty: 1, name: "Something", path: "a::b", desc: "A Struct That Does Something", parent_idx: 0, search_type: null}` is the first item.

This makes the uncompressed version smaller, but it really shows on the compressed version:

    notriddle:rust$ wc -c new-search-index1.52.0.js
    2622427 new-search-index1.52.0.js
    notriddle:rust$ wc -c old-search-index1.52.0.js
    2725046 old-search-index1.52.0.js
    notriddle:rust$ gzip new-search-index1.52.0.js
    notriddle:rust$ gzip old-search-index1.52.0.js
    notriddle:rust$ wc -c new-search-index1.52.0.js.gz
    239385 new-search-index1.52.0.js.gz
    notriddle:rust$ wc -c old-search-index1.52.0.js.gz
    296328 old-search-index1.52.0.js.gz

That's a 4% improvement on the uncompressed version (fewer `[]`, and also changing `null` to `0` in the parent_idx list), and 20% improvement after gzipping it, thanks to putting like-typed data next to each other. Any compression algorithm based on a sliding window will probably show this kind of improvement.
2021-03-12 08:55:20 +09:00
Yuki Okushi 3e6e808aa6
Rollup merge of #83001 - camelid:gitignore-vim-swap, r=Mark-Simulacrum
Ignore Vim swap files

I got this from [a Stack Overflow answer][so].
(I didn't add `*~` because it was already there.)

[so]: https://stackoverflow.com/a/4824199
2021-03-12 08:55:19 +09:00
Yuki Okushi 6ea16859fb
Rollup merge of #82979 - GuillaumeGomez:run-button-pos, r=Nemo157
Fix "run" button position in error index

This isn't really a rustdoc issue but I still made the same fix in the `rustdoc.css` file (doesn't hurt).

Before:

![Screenshot from 2021-03-10 16-35-49](https://user-images.githubusercontent.com/3050060/110655807-aa402800-81bf-11eb-8a88-bc979efd1697.png)

After:

![Screenshot from 2021-03-10 16-40-08](https://user-images.githubusercontent.com/3050060/110655843-b4622680-81bf-11eb-8670-42975d92b4eb.png)

cc ````@jyn514```` (considering this is quite a big bug and an easy fix)
r? ````@Nemo157````
2021-03-12 08:55:18 +09:00
Yuki Okushi a86ac16e54
Rollup merge of #82966 - tspiteri:msys2-link, r=Mark-Simulacrum
update MSYS2 link in README

Now https://msys2.github.io/ redirects to https://www.msys2.org/, so the README might just link to that immediately.
2021-03-12 08:55:17 +09:00
Yuki Okushi bb790d3412
Rollup merge of #82965 - XAMPPRocky:spv-ext, r=nagisa
Add spirv extension handling in compiletest

We're trying to use `compiletest` for Rust-GPU's testsuite, and ran into an issue with host specific extensions. This adds handling to fix that.
2021-03-12 08:55:16 +09:00
Yuki Okushi 16ce4f7513
Rollup merge of #82950 - mockersf:slice-intra-doc-link, r=jyn514
convert slice doc link to intra-doc links

Continuing where #80189 stopped, with `core::slice`.

I had an issue with two dead links in my doc when implementing `Deref<Target = [T]>` for one of my type. This means that [`binary_search_by_key`](https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.binary_search_by_key) was available, but not [`sort_by_key`](https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.sort_by_key) even though it was linked in it's doc (same issue with [`as_ptr`](https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.as_ptr) and [`as_mut_pbr`](https://doc.rust-lang.org/nightly/std/primitive.slice.html#method.as_mut_ptr)). It becomes available if I implement `DerefMut`, as it needs an `&mut self`.

<details>
  <summary>Code that will have dead links in its doc</summary>

```rust
pub struct A;
pub struct B;

impl std::ops::Deref for B{
    type Target = [A];

    fn deref(&self) -> &Self::Target {
        &A
    }
}
```
</details>

I removed the link to `sort_by_key` from `binary_search_by_key` doc as I didn't find a nice way to have a live link:
- `binary_search_by_key` is in `core`
- `sort_by_key` is in `alloc`
- intra-doc link `slice::sort_by_key` doesn't work, as `alloc` is not available when `core` is being build (the warning can't be ignored: ```error[E0710]: an unknown tool name found in scoped lint: `rustdoc::broken_intra_doc_links` ```)
- keeping the link as an anchor `#method.sort_by_key` meant a dead link
- an absolute link would work but doesn't feel right...
2021-03-12 08:55:15 +09:00
Yuki Okushi f183a3ec13
Rollup merge of #82860 - LeSeulArtichaut:unpretty-thir, r=spastorino
Add `-Z unpretty` flag for the THIR

This adds a new perma-unstable flag, `-Zunpretty=thir-tree`, that dumps the raw THIR tree for each body in the crate.

Implements the THIR part of MCP rust-lang/compiler-team#408, helps with rust-lang/rustc-dev-guide#1062.
Depends on #82495, blocked on that. Only the two last commits are added by this PR.
r? ```@spastorino``` cc ```@estebank```
2021-03-12 08:55:14 +09:00
Yuki Okushi a98dc9b3e7
Rollup merge of #82571 - aDotInTheVoid:reexport-tests, r=CraftSpider
Rustdoc Json: Add tests for Reexports, and improve jsondocck

The two changes are orthognal, so you can land just one if you want, but the improved errors realy helped write the tests.

Notably does not have the case from #80664, but I want to have all the ajacent cases tested before starting work on that to ensure I dont break anything.

Improves #81359

cc ```@CraftSpider```

r? ```@jyn514```

```@rustbot``` modify labels: +A-testsuite +T-rustdoc +A-rustdoc-json
2021-03-12 08:55:13 +09:00
Yuki Okushi 2f0bbc0d1d
Rollup merge of #80385 - camelid:clarify-cell-replace-docs, r=Mark-Simulacrum
Clarify what `Cell::replace` returns
2021-03-12 08:55:09 +09:00
Hiroki Noda 65ed23c282 Support merge_functions option in NewPM since LLVM >= 12
now we can pass this flag since https://reviews.llvm.org/D93002 has been
merged.
2021-03-12 08:16:10 +09:00
Nikita Popov ef269ac4fc Add tests for issues #82833 and #82859 2021-03-11 22:58:14 +01:00
bors 03e864fd86 Auto merge of #82417 - the8472:fix-copy_file_range-append, r=m-ou-se
Fix io::copy specialization using copy_file_range when writer was opened with O_APPEND

fixes #82410

While `sendfile()` returns `EINVAL` when the output was opened with O_APPEND,  `copy_file_range()` does not and returns `EBADF` instead, which – unlike other `EBADF` causes – is not fatal for this operation since a regular `write()` will likely succeed.

We now treat `EBADF` as a non-fatal error for `copy_file_range` and fall back to a read-write copy as we already did for several other errors.
2021-03-11 21:41:01 +00:00
Guillaume Gomez 1d26e6b632 Improve code by removing similar function calls and using loops instead for collecting iterators 2021-03-11 22:33:40 +01:00
Guillaume Gomez 2069d3e13b Update doc alias ui tests 2021-03-11 22:33:40 +01:00
Nikita Popov d9be71a5b8 Update llvm-project submodule 2021-03-11 22:04:10 +01:00
Guillaume Gomez 56898ec6a7 Prevent JS error when there is no dependency or other crate documented 2021-03-11 21:13:42 +01:00
bors 6ed6f1e6a1 Auto merge of #6826 - TaKO8Ki:refactor-methods-mod, r=phansch
Refactor: arrange lints in `methods` module

This PR arranges methods lints so that they can be accessed more easily.
Basically, I refactored them following the instruction described in #6680.

changelog: Move lints in methods module into their own modules.
2021-03-11 19:54:48 +00:00
LeSeulArtichaut 6bf4147646 Add `-Z unpretty` flag for the THIR 2021-03-11 19:42:40 +01:00
LeSeulArtichaut 2a34428253 Make THIR data structures public 2021-03-11 19:42:39 +01:00
bors 4a8b6f708c Auto merge of #82806 - nikic:memcpyopt-mssa, r=nagisa
Enable MemorySSA in MemCpyOpt

LLVM 12 ships with an implementation of MemCpyOpt which is based on MSSA instead of MDA. This implementation can eliminate memcpys across blocks, and as such fixes many (but not all) failures to eliminate redundant memcpys for Rust code. Unfortunately this was only enabled by default shortly after LLVM 12 was cut. This backports the enablement to our LLVM fork.

Perf results: https://perf.rust-lang.org/compare.html?start=8fd946c63a6c3aae9788bd459d278cb2efa77099&end=0628b91ce17035fb5b6a1a99a4f2ab9ab69be7a8

There are improvements on check and debug builds, which indicate that rustc itself has become faster. For opt builds this is, on average, a very minor improvement as well, although there is one significant outlier with deep-vector-opt. This benchmark creates ~140000 zero stores, which are now coalesced into a memset slightly later, resulting in longer compile-time for intermediate passes.
2021-03-11 18:14:59 +00:00
Mara Bos bf27819f37 Don't implement mem::replace with mem::swap. 2021-03-11 19:04:47 +01:00
Igor Matuszewski ae5cc8a75b Update RLS 2021-03-11 19:02:00 +01:00
csmoe 77fb6a0f32 fix: check before index into generated patterns 2021-03-12 01:54:08 +08:00
csmoe 2fd2796aae add ui testcase for issue 82772 2021-03-12 01:53:55 +08:00
bors 534a13db96 Auto merge of #6884 - matthiaskrgr:lintcheck_crate, r=Manishearth
move lintcheck into its own crate

This pr:
* moves lintcheck out of `clippy dev` and into its own crate (`lintcheck`)  (I should have done this earlier :D)
* makes lintcheck terminate if it is not launched from the repo root (to prevent problems with wrong paths when using `cargo run` in the crate root)
* fixes json lint messages leaking the runners `$HOME` when a lint messages comes from a proc macro that originates from a crate inside the `$CARGO_CACHE`
* adds more documentation to lintchecks `README.md` and mentions lintcheck in `docs/basics.md`

changelog: none
2021-03-11 16:10:33 +00:00
bors 61365c0625 Auto merge of #82495 - LeSeulArtichaut:eager-thir, r=oli-obk
Eagerly construct bodies of THIR

With this PR:
 - the THIR is no longer constructed lazily, but is entirely built before being passed to the MIR Builder
 - the THIR is now allocated in arenas instead of `Box`es

However, this PR doesn't make any changes to the way patterns are constructed: they are still boxed, and exhaustiveness checking is unchanged.

Implements MCP rust-lang/compiler-team#409.
Closes rust-lang/project-thir-unsafeck#1.
r? `@ghost` cc `@nikomatsakis` `@oli-obk`
2021-03-11 15:34:01 +00:00
Oli Scherer c69b108d2a Reintroduce accidentally deleted assertions.
These were removed in https://github.com/rust-lang/rust/pull/50198
2021-03-11 14:56:03 +00:00
Matthias Krüger 0af90fd15a doc line length fixes 2021-03-11 15:47:51 +01:00
Matthias Krüger ac935781f5 docs: basics.md: mention lintcheck 2021-03-11 15:37:10 +01:00
Matthias Krüger 528e464b4f lintcheck: fix clippy warnings 2021-03-11 15:28:27 +01:00
Matthias Krüger b068b742ee lintcheck: fix --fix and document it in the readme.
also hook lintcheck into clippy-dev so that `clippy dev fmt` formats it.
2021-03-11 15:27:30 +01:00
Matthias Krüger b29ef183fb lintcheck: update logs 2021-03-11 15:27:30 +01:00
Matthias Krüger 3e60ba073b lintcheck: fix bug where lint messages about macros coming from crate deps would sneak in absolute paths to registry sources.
make the path a relative path that starts at the CARGO_HOME to not print the users home location in the log
2021-03-11 15:27:30 +01:00
Matthias Krüger d859a17cdd lintcheck: update readme and remove the now redundant readme from clippy-dev 2021-03-11 15:27:30 +01:00
Matthias Krüger fac6da1cfb move testfiles to "lintcheck" and fix more paths 2021-03-11 15:27:26 +01:00
Nikita Popov 623ca84ab7 Enable MemorySSA-based MemCpyOpt
This updates the LLVM submodule to pick up a backported patch
to enable MemorySSA-based MemCpyOpt, which is capable of optimizing
away memcpy's across basic blocks.
2021-03-11 14:28:47 +01:00
Matthias Krüger c760150989 gitignore: add lintchecks target dir 2021-03-11 13:26:27 +01:00
Matthias Krüger a846945b82 lintcheck: make sure we lauch from the repo root
This will terminate the program if run via "cargo run".
"cargo run" does currently not work because at least a bunch of paths do not take that into account.
2021-03-11 13:26:26 +01:00
Matthias Krüger 2546e6f006 lintcheck: move out of clippy-dev into own crate 2021-03-11 13:26:26 +01:00
bors 5c6d3bf389 Auto merge of #83009 - RalfJung:miri, r=RalfJung
bump Miri

Fixes https://github.com/rust-lang/rust/issues/82961
Cc `@rust-lang/miri` r? `@ghost`
2021-03-11 11:37:36 +00:00
Camille GILLOT 34e92bbf65 Hash SyntaxContext first. 2021-03-11 12:31:31 +01:00
Camille GILLOT fe2d728e62 Remove useless method. 2021-03-11 12:24:58 +01:00
Camille GILLOT 84bf599bac Add inlining. 2021-03-11 12:24:43 +01:00
Takayuki Maeda 83a955335f fix interning-defined-symbol error 2021-03-11 20:18:33 +09:00
Takayuki Maeda 99f860768c remove unused imports 2021-03-11 20:02:29 +09:00
Takayuki Maeda c711de28ee move expect_fun_call to its own module 2021-03-11 19:40:50 +09:00
Takayuki Maeda f49349bf33 move or_fun_call to its own module 2021-03-11 19:40:24 +09:00
Takayuki Maeda b0824bf75f move map_unwrap_or to its own module 2021-03-11 19:40:24 +09:00
Takayuki Maeda 5557596926 move option_map_or_none to its own module 2021-03-11 19:40:24 +09:00
Takayuki Maeda bbed852f6f unnecessary_fold to its own module 2021-03-11 19:40:24 +09:00