]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoUpdate compiler/rustc_middle/src/ty/consts/valtree.rs
Oli Scherer [Tue, 16 Mar 2021 17:31:33 +0000 (18:31 +0100)]
Update compiler/rustc_middle/src/ty/consts/valtree.rs

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoUpdate compiler/rustc_middle/src/ty/consts/valtree.rs
Oli Scherer [Tue, 16 Mar 2021 17:31:25 +0000 (18:31 +0100)]
Update compiler/rustc_middle/src/ty/consts/valtree.rs

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoUpdate compiler/rustc_mir/src/const_eval/mod.rs
Oli Scherer [Tue, 16 Mar 2021 17:26:09 +0000 (18:26 +0100)]
Update compiler/rustc_mir/src/const_eval/mod.rs

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoPacify tidy
Oli Scherer [Mon, 15 Mar 2021 12:19:29 +0000 (12:19 +0000)]
Pacify tidy

3 years agoDo not expose fallible `to_int` operation on `Scalar`.
Oli Scherer [Mon, 15 Mar 2021 12:06:07 +0000 (12:06 +0000)]
Do not expose fallible `to_int` operation on `Scalar`.

Any use of it has been shown to be a bug in the past.

3 years agoExplain pointer and dyn Trait handling in const_to_valtree
Oli Scherer [Mon, 15 Mar 2021 11:53:37 +0000 (11:53 +0000)]
Explain pointer and dyn Trait handling in const_to_valtree

3 years agoExplain how we encode enums at the encoding site
Oli Scherer [Mon, 15 Mar 2021 11:52:26 +0000 (11:52 +0000)]
Explain how we encode enums at the encoding site

3 years agoExplain why we do not allow const_to_valtree to read from statics
Oli Scherer [Mon, 15 Mar 2021 11:52:00 +0000 (11:52 +0000)]
Explain why we do not allow const_to_valtree to read from statics

3 years agoDocument valtree
Oli Scherer [Mon, 15 Mar 2021 11:31:01 +0000 (11:31 +0000)]
Document valtree

3 years agos/ConstantSource/ConstantKind/
Oli Scherer [Mon, 15 Mar 2021 11:23:44 +0000 (11:23 +0000)]
s/ConstantSource/ConstantKind/

3 years agoRun rustfmt
Oli Scherer [Fri, 12 Mar 2021 13:46:39 +0000 (13:46 +0000)]
Run rustfmt

3 years agoWe won't support trait object constants in type level constants for the forseeable...
Oli Scherer [Fri, 12 Mar 2021 13:00:16 +0000 (13:00 +0000)]
We won't support trait object constants in type level constants for the forseeable future

3 years agoVisit `mir::Constant::user_ty` for completeness.
Oli Scherer [Fri, 12 Mar 2021 12:59:37 +0000 (12:59 +0000)]
Visit `mir::Constant::user_ty` for completeness.

It's not necessary yet, but it may become necessary with things like lazy normalization.

3 years agoReplace a custom lift method with a Lift impl
Oli Scherer [Wed, 10 Mar 2021 11:45:22 +0000 (11:45 +0000)]
Replace a custom lift method with a Lift impl

3 years agoPrepare mir::Constant for ty::Const only supporting valtrees
Oli Scherer [Mon, 8 Mar 2021 16:18:03 +0000 (16:18 +0000)]
Prepare mir::Constant for ty::Const only supporting valtrees

3 years agoDirectly intern allocations so that we can write a `Lift` impl for them
Oli Scherer [Mon, 8 Mar 2021 15:01:53 +0000 (15:01 +0000)]
Directly intern allocations so that we can write a `Lift` impl for them

3 years agoAdd `ty` helper function for mir constants
Oli Scherer [Mon, 8 Mar 2021 14:14:11 +0000 (14:14 +0000)]
Add `ty` helper function for mir constants

This is in preparation of the `literal` field becoming an enum that distinguishes between type level constants and runtime constants

3 years agoUse the explicit error constant instead of fake dummies
Oli Scherer [Mon, 8 Mar 2021 14:09:22 +0000 (14:09 +0000)]
Use the explicit error constant instead of fake dummies

3 years agoSplit pretty printer logic for scalar int and scalar ptr
Oli Scherer [Tue, 2 Mar 2021 14:54:10 +0000 (14:54 +0000)]
Split pretty printer logic for scalar int and scalar ptr

Value trees won't have scalar ptr at all, so we need a scalar int printing method anyway. This way we'll be able to share that method between all const representations.

3 years agoPull out ConstValue relating into its own function
Oli Scherer [Tue, 2 Mar 2021 12:21:10 +0000 (12:21 +0000)]
Pull out ConstValue relating into its own function

3 years agoReduce the duplication in the relation logic for constants
Oli Scherer [Tue, 2 Mar 2021 12:13:17 +0000 (12:13 +0000)]
Reduce the duplication in the relation logic for constants

3 years agoReduce destructuring and re-interning where possible
Oli Scherer [Tue, 2 Mar 2021 11:38:03 +0000 (11:38 +0000)]
Reduce destructuring and re-interning where possible

3 years agoResolve a FIXME around type equality checks in Relate for constants
Oli Scherer [Tue, 2 Mar 2021 11:22:37 +0000 (11:22 +0000)]
Resolve a FIXME around type equality checks in Relate for constants

3 years agoAdd convenience conversion methods for ScalarInt
Oli Scherer [Tue, 23 Feb 2021 14:11:29 +0000 (14:11 +0000)]
Add convenience conversion methods for ScalarInt

3 years agoAdd fallible Scalar to ScalarInt conversion method
Oli Scherer [Tue, 23 Feb 2021 10:16:24 +0000 (10:16 +0000)]
Add fallible Scalar to ScalarInt conversion method

3 years agoIntern valtree field vector
Oli Scherer [Mon, 22 Feb 2021 14:34:23 +0000 (14:34 +0000)]
Intern valtree field vector

3 years agoImplement valtree
Oli Scherer [Mon, 22 Feb 2021 14:09:24 +0000 (14:09 +0000)]
Implement valtree

valtree is a version of constants that is inherently safe to be used within types.
This is in contrast to ty::Const which can have different representations of the same value. These representation differences can show up in hashing or equality comparisons, breaking type equality of otherwise equal types.
valtrees do not have this problem.

3 years agoAuto merge of #82935 - henryboisdequin:diagnostic-cleanups, r=estebank
bors [Fri, 12 Mar 2021 09:05:38 +0000 (09:05 +0000)]
Auto merge of #82935 - henryboisdequin:diagnostic-cleanups, r=estebank

Diagnostic cleanups

Follow up to #81503
Helps with #82916 (don't show note if `span` is `DUMMY_SP`)

3 years agoDon't show note if `span` is `DUMMY_SP`
Henry Boisdequin [Tue, 9 Mar 2021 14:42:47 +0000 (20:12 +0530)]
Don't show note if `span` is `DUMMY_SP`

3 years agoAuto merge of #83042 - JohnTitor:rollup-s8efv94, r=JohnTitor
bors [Fri, 12 Mar 2021 00:23:05 +0000 (00:23 +0000)]
Auto merge of #83042 - JohnTitor:rollup-s8efv94, r=JohnTitor

Rollup of 11 pull requests

Successful merges:

 - #80385 (Clarify what `Cell::replace` returns)
 - #82571 (Rustdoc Json: Add tests for Reexports, and improve jsondocck)
 - #82860 (Add `-Z unpretty` flag for the THIR)
 - #82950 (convert slice doc link to intra-doc links)
 - #82965 (Add spirv extension handling in compiletest)
 - #82966 (update MSYS2 link in README)
 - #82979 (Fix "run" button position in error index)
 - #83001 (Ignore Vim swap files)
 - #83003 (rustdoc: tweak the search index format)
 - #83013 (Adjust some `#[cfg]`s to take non-Unix non-Windows operating systems into account)
 - #83018 (Reintroduce accidentally deleted assertions.)

Failed merges:

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

3 years agoRollup merge of #83018 - oli-obk:float_check, r=davidtwco
Yuki Okushi [Thu, 11 Mar 2021 23:55:22 +0000 (08:55 +0900)]
Rollup merge of #83018 - oli-obk:float_check, r=davidtwco

Reintroduce accidentally deleted assertions.

These were removed in https://github.com/rust-lang/rust/pull/50198

3 years agoRollup merge of #83013 - hyd-dev:cfg-unix-windows, r=bjorn3
Yuki Okushi [Thu, 11 Mar 2021 23:55:21 +0000 (08:55 +0900)]
Rollup merge of #83013 - hyd-dev:cfg-unix-windows, r=bjorn3

Adjust some `#[cfg]`s to take non-Unix non-Windows operating systems into account

This makes compilation to such targets (e.g. `wasm32-wasi`) easier.

cc rust-lang/miri#722 https://github.com/rust-lang/rust/commit/bb6d1d0a0966c04a75389348642e11ae44c86514#r48100619

3 years agoRollup merge of #83003 - notriddle:rustdoc-index-v3, r=GuillaumeGomez
Yuki Okushi [Thu, 11 Mar 2021 23:55:20 +0000 (08:55 +0900)]
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.

3 years agoRollup merge of #83001 - camelid:gitignore-vim-swap, r=Mark-Simulacrum
Yuki Okushi [Thu, 11 Mar 2021 23:55:19 +0000 (08:55 +0900)]
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

3 years agoRollup merge of #82979 - GuillaumeGomez:run-button-pos, r=Nemo157
Yuki Okushi [Thu, 11 Mar 2021 23:55:18 +0000 (08:55 +0900)]
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````

3 years agoRollup merge of #82966 - tspiteri:msys2-link, r=Mark-Simulacrum
Yuki Okushi [Thu, 11 Mar 2021 23:55:17 +0000 (08:55 +0900)]
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.

3 years agoRollup merge of #82965 - XAMPPRocky:spv-ext, r=nagisa
Yuki Okushi [Thu, 11 Mar 2021 23:55:16 +0000 (08:55 +0900)]
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.

3 years agoRollup merge of #82950 - mockersf:slice-intra-doc-link, r=jyn514
Yuki Okushi [Thu, 11 Mar 2021 23:55:15 +0000 (08:55 +0900)]
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...

3 years agoRollup merge of #82860 - LeSeulArtichaut:unpretty-thir, r=spastorino
Yuki Okushi [Thu, 11 Mar 2021 23:55:14 +0000 (08:55 +0900)]
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```

3 years agoRollup merge of #82571 - aDotInTheVoid:reexport-tests, r=CraftSpider
Yuki Okushi [Thu, 11 Mar 2021 23:55:13 +0000 (08:55 +0900)]
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

3 years agoRollup merge of #80385 - camelid:clarify-cell-replace-docs, r=Mark-Simulacrum
Yuki Okushi [Thu, 11 Mar 2021 23:55:09 +0000 (08:55 +0900)]
Rollup merge of #80385 - camelid:clarify-cell-replace-docs, r=Mark-Simulacrum

Clarify what `Cell::replace` returns

3 years agoAuto merge of #82417 - the8472:fix-copy_file_range-append, r=m-ou-se
bors [Thu, 11 Mar 2021 21:41:01 +0000 (21:41 +0000)]
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.

3 years agoAdd `-Z unpretty` flag for the THIR
LeSeulArtichaut [Sun, 7 Mar 2021 14:09:39 +0000 (15:09 +0100)]
Add `-Z unpretty` flag for the THIR

3 years agoMake THIR data structures public
LeSeulArtichaut [Sun, 7 Mar 2021 14:09:00 +0000 (15:09 +0100)]
Make THIR data structures public

3 years agoAuto merge of #82806 - nikic:memcpyopt-mssa, r=nagisa
bors [Thu, 11 Mar 2021 18:14:59 +0000 (18:14 +0000)]
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.

3 years agoAuto merge of #82495 - LeSeulArtichaut:eager-thir, r=oli-obk
bors [Thu, 11 Mar 2021 15:34:01 +0000 (15:34 +0000)]
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`

3 years agoReintroduce accidentally deleted assertions.
Oli Scherer [Thu, 11 Mar 2021 14:56:03 +0000 (14:56 +0000)]
Reintroduce accidentally deleted assertions.

These were removed in https://github.com/rust-lang/rust/pull/50198

3 years agoEnable MemorySSA-based MemCpyOpt
Nikita Popov [Mon, 8 Mar 2021 15:22:36 +0000 (16:22 +0100)]
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.

3 years agoAuto merge of #83009 - RalfJung:miri, r=RalfJung
bors [Thu, 11 Mar 2021 11:37:36 +0000 (11:37 +0000)]
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`

3 years agoAdjust some `#[cfg]`s to take non-Unix non-Windows operating systems into account
hyd-dev [Thu, 11 Mar 2021 10:03:32 +0000 (18:03 +0800)]
Adjust some `#[cfg]`s to take non-Unix non-Windows operating systems into account

3 years agoAuto merge of #82947 - GuillaumeGomez:fix-nojs-style-issues, r=Nemo157
bors [Thu, 11 Mar 2021 09:08:57 +0000 (09:08 +0000)]
Auto merge of #82947 - GuillaumeGomez:fix-nojs-style-issues, r=Nemo157

Fix nojs style issues

There are two issues fixed here:
 1. The position of "{version}" and "[src]" spans.
 2. The position of attributes (on top of functions)

Please note that these issues only happen if you have disabled javascript.

Before:

![Screenshot from 2021-03-09 20-45-54](https://user-images.githubusercontent.com/3050060/110534652-9e048e00-811f-11eb-979e-6d85545edd65.png)

After:

![Screenshot from 2021-03-09 21-01-32](https://user-images.githubusercontent.com/3050060/110534667-a1981500-811f-11eb-8a19-32f4d5381a2b.png)

In the last commit, I added a test to enforce the attributes position. I need to think how to enforce it for the spans but that can comes later on.

r? `@Nemo157`

3 years agobump Miri
Ralf Jung [Thu, 11 Mar 2021 08:29:12 +0000 (09:29 +0100)]
bump Miri

3 years agoAuto merge of #82641 - camelid:lang-item-docs, r=jyn514
bors [Thu, 11 Mar 2021 06:38:22 +0000 (06:38 +0000)]
Auto merge of #82641 - camelid:lang-item-docs, r=jyn514

Improve lang item generated docs

cc https://rust-lang.zulipchat.com/#narrow/stream/146229-wg-secure-code/topic/Is.20.60core.60.20part.20of.20the.20compiler.3F/near/226738260

r? `@jyn514`

3 years agoAuto merge of #82964 - Nicholas-Baron:shorten_middle_ty, r=jackh726
bors [Thu, 11 Mar 2021 04:09:44 +0000 (04:09 +0000)]
Auto merge of #82964 - Nicholas-Baron:shorten_middle_ty, r=jackh726

Shorten `rustc_middle::ty::mod`

Related to #60302.

This PR moves all `Adt*`, `Assoc*`, `Generic*`, and `UpVar*` types to separate files.
This, alongside some `use` reordering, puts `mod.rs` at ~2,200 lines, thus removing the `// ignore-tidy-filelength`.

The particular groups were chosen as they had 4 or more "substantive" members.

3 years agorustdoc: tweak the search index format
Michael Howell [Thu, 11 Mar 2021 02:31:49 +0000 (19:31 -0700)]
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
    notriddle:rust$

That's a 4% improvement on the uncompressed version (fewer `[]`),
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.

3 years agoIgnore Vim swap files
Camelid [Thu, 11 Mar 2021 02:28:05 +0000 (18:28 -0800)]
Ignore Vim swap files

3 years agoMoved more of the capture related types into closure.rs
Nicholas-Baron [Wed, 10 Mar 2021 22:23:37 +0000 (14:23 -0800)]
Moved more of the capture related types into closure.rs

3 years agoMoved more types into upvar.rs (now named closure.rs)
Nicholas-Baron [Wed, 10 Mar 2021 20:55:00 +0000 (12:55 -0800)]
Moved more types into upvar.rs (now named closure.rs)

3 years agoMoved all Adt* types to adt.rs
Nicholas-Baron [Wed, 10 Mar 2021 05:47:12 +0000 (21:47 -0800)]
Moved all Adt* types to adt.rs

3 years agoMoved all Assoc* types to assoc.rs.
Nicholas-Baron [Wed, 10 Mar 2021 05:27:03 +0000 (21:27 -0800)]
Moved all Assoc* types to assoc.rs.

3 years agoMoved types starting with 'Generic' into generics.rs.
Nicholas-Baron [Wed, 10 Mar 2021 05:10:07 +0000 (21:10 -0800)]
Moved types starting with 'Generic' into generics.rs.

3 years agoMoved UpVar* types to a separate file.
Nicholas-Baron [Wed, 10 Mar 2021 04:47:03 +0000 (20:47 -0800)]
Moved UpVar* types to a separate file.

3 years agoGrouped some ungrouped use and mod lines.
Nicholas-Baron [Wed, 10 Mar 2021 04:53:48 +0000 (20:53 -0800)]
Grouped some ungrouped use and mod lines.

3 years agoImprove some jsondocck errors
Nixon Enraght-Moony [Fri, 26 Feb 2021 22:55:28 +0000 (22:55 +0000)]
Improve some jsondocck errors

3 years agoAdd reexport tests
Nixon Enraght-Moony [Fri, 26 Feb 2021 22:55:08 +0000 (22:55 +0000)]
Add reexport tests

3 years agoAuto merge of #82960 - camelid:masked_crates, r=jyn514
bors [Wed, 10 Mar 2021 21:54:06 +0000 (21:54 +0000)]
Auto merge of #82960 - camelid:masked_crates, r=jyn514

Remove `masked_crates` from `clean::Crate`

Previously, `masked_crates` existed both on `Cache` and on
`clean::Crate`. During cache population, the `clean::Crate` version was
`take`n and moved to `Cache`.

This change removes the version on `clean::Crate` and instead directly
mutates `Cache.masked_crates` to initialize it. This has the advantage
of avoiding duplication and avoiding unnecessary allocation, as well as
making the flow of information through rustdoc less confusing.

The one downside I see is that `clean::utils::krate()` now uses the side
effect of mutating `DocContext.cache` instead of returning the data
directly, but it already mutated the `Cache` for other things (e.g.,
`deref_trait_did`) so it's not really new behavior. Also,
`clean::utils::krate()` is only called once (and is meant to only be
called once since it performs expensive and potentially destructive
operations) so the mutation shouldn't be an issue.

Follow-up to https://github.com/rust-lang/rust/pull/82018#discussion_r584197747.

cc `@jyn514`

3 years agoAuto merge of #82982 - Dylan-DPC:rollup-mt497z7, r=Dylan-DPC
bors [Wed, 10 Mar 2021 19:12:53 +0000 (19:12 +0000)]
Auto merge of #82982 - Dylan-DPC:rollup-mt497z7, r=Dylan-DPC

Rollup of 9 pull requests

Successful merges:

 - #81309 (always eagerly eval consts in Relate)
 - #82217 (Edition-specific preludes)
 - #82807 (rustdoc: Remove redundant enableSearchInput function)
 - #82924 (WASI: Switch to crt1-command.o to enable support for new-style commands)
 - #82949 (Do not attempt to unlock envlock in child process after a fork.)
 - #82955 (fix: wrong word)
 - #82962 (Treat header as first paragraph for shortened markdown descriptions)
 - #82976 (fix error message for copy(_nonoverlapping) overflow)
 - #82977 (Rename `Option::get_or_default` to `get_or_insert_default`)

Failed merges:

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

3 years agoRemove unnecessary `#[allow(dead_code)]`
Camelid [Wed, 10 Mar 2021 18:27:04 +0000 (10:27 -0800)]
Remove unnecessary `#[allow(dead_code)]`

3 years agoapply review
François Mockers [Wed, 10 Mar 2021 17:32:55 +0000 (18:32 +0100)]
apply review

3 years agoClarify docs
Camelid [Wed, 10 Mar 2021 17:20:12 +0000 (09:20 -0800)]
Clarify docs

3 years agoremove slice linkcheck exceptions
François Mockers [Wed, 10 Mar 2021 17:18:56 +0000 (18:18 +0100)]
remove slice linkcheck exceptions

3 years agoadd back sort_by_key link, allow linter and add comment
François Mockers [Wed, 10 Mar 2021 17:18:28 +0000 (18:18 +0100)]
add back sort_by_key link, allow linter and add comment

3 years agoRemove `sym::` and `kw::` from generated docs
Camelid [Wed, 10 Mar 2021 17:05:59 +0000 (09:05 -0800)]
Remove `sym::` and `kw::` from generated docs

3 years agoFix bug
Camelid [Wed, 10 Mar 2021 17:02:40 +0000 (09:02 -0800)]
Fix bug

It needs to be a variable!

Co-authored-by: Joshua Nelson <joshua@yottadb.com>
3 years agoRollup merge of #82977 - camsteffen:opt-get-insert-def, r=m-ou-se
Dylan DPC [Wed, 10 Mar 2021 16:55:47 +0000 (17:55 +0100)]
Rollup merge of #82977 - camsteffen:opt-get-insert-def, r=m-ou-se

Rename `Option::get_or_default` to `get_or_insert_default`

...as [suggested](https://github.com/rust-lang/rust/issues/82901#issuecomment-793548515) by `@m-ou-se.` In hindsight this seems rather obvious, at least to me.

r? `@joshtriplett`

3 years agoRollup merge of #82976 - RalfJung:copy-nonoverlapping, r=oli-obk
Dylan DPC [Wed, 10 Mar 2021 16:55:46 +0000 (17:55 +0100)]
Rollup merge of #82976 - RalfJung:copy-nonoverlapping, r=oli-obk

fix error message for copy(_nonoverlapping) overflow

Fixes an error message regression introduced in https://github.com/rust-lang/rust/pull/77511 (and adds tests).

r? `@oli-obk`

3 years agoRollup merge of #82962 - notriddle:cleanup-index, r=jyn514
Dylan DPC [Wed, 10 Mar 2021 16:55:45 +0000 (17:55 +0100)]
Rollup merge of #82962 - notriddle:cleanup-index, r=jyn514

Treat header as first paragraph for shortened markdown descriptions

"The Rust Standard LibraryThe Rust Standard Library is the …" is an awful description.

3 years agoRollup merge of #82955 - ltoddy:fix/wrong, r=jonas-schievink
Dylan DPC [Wed, 10 Mar 2021 16:55:44 +0000 (17:55 +0100)]
Rollup merge of #82955 - ltoddy:fix/wrong, r=jonas-schievink

fix: wrong word

3 years agoRollup merge of #82949 - the8472:forget-envlock-on-fork, r=joshtriplett
Dylan DPC [Wed, 10 Mar 2021 16:55:43 +0000 (17:55 +0100)]
Rollup merge of #82949 - the8472:forget-envlock-on-fork, r=joshtriplett

Do not attempt to unlock envlock in child process after a fork.

This implements the first two points from https://github.com/rust-lang/rust/issues/64718#issuecomment-793030479

This is a breaking change for cases where the environment is accessed in a Command::pre_exec closure. Except for single-threaded programs these uses were not correct anyway since they aren't async-signal safe.

Note that we had a ui test that explicitly tried `env::set_var` in `pre_exec`. As expected it failed with these changes when I tested locally.

3 years agoRollup merge of #82924 - sunfishcode:wasi-command, r=alexcrichton
Dylan DPC [Wed, 10 Mar 2021 16:55:41 +0000 (17:55 +0100)]
Rollup merge of #82924 - sunfishcode:wasi-command, r=alexcrichton

WASI: Switch to crt1-command.o to enable support for new-style commands

This switches Rust's WASI target to use crt1-command.o instead of
crt1.o, which enables support for new-style commands. By default,
new-style commands work the same way as old-style commands, so nothing
immediately changes here, but this will be needed by later changes to
enable support for typed arguments.

See here for more information on new-style commands:
 - https://github.com/WebAssembly/wasi-libc/pull/203
 - https://reviews.llvm.org/D81689

r? ```@alexcrichton```

3 years agoRollup merge of #82807 - notriddle:cleanup-js, r=jyn514
Dylan DPC [Wed, 10 Mar 2021 16:55:40 +0000 (17:55 +0100)]
Rollup merge of #82807 - notriddle:cleanup-js, r=jyn514

rustdoc: Remove redundant enableSearchInput function

enableSearchInput was called from two places:

- setupSearchLoader
- addSearchOptions, which is itself called from setupSearchLoader only

This commit can safely get rid of the addSearchOptions calls entirely, and since the setupSearchLoader call is immediately preceded by other method calls on search_input, there's no need to check if it's set.

3 years agoRollup merge of #82217 - m-ou-se:edition-prelude, r=nikomatsakis
Dylan DPC [Wed, 10 Mar 2021 16:55:38 +0000 (17:55 +0100)]
Rollup merge of #82217 - m-ou-se:edition-prelude, r=nikomatsakis

Edition-specific preludes

This changes `{std,core}::prelude` to export edition-specific preludes under `rust_2015`, `rust_2018` and `rust_2021`. (As suggested in https://github.com/rust-lang/rust/issues/51418#issuecomment-395630382.) For now they all just re-export `v1::*`, but this allows us to add things to the 2021edition prelude soon.

This also changes the compiler to make the automatically injected prelude import dependent on the selected edition.

cc `@rust-lang/libs` `@djc`

3 years agoRollup merge of #81309 - lcnr:lazy-norm-err-msgh, r=nikomatsakis
Dylan DPC [Wed, 10 Mar 2021 16:55:37 +0000 (17:55 +0100)]
Rollup merge of #81309 - lcnr:lazy-norm-err-msgh, r=nikomatsakis

always eagerly eval consts in Relate

r? ```@nikomatsakis``` cc ```@varkor```

3 years agoAuto merge of #76570 - cratelyn:implement-rfc-2945-c-unwind-abi, r=Amanieu
bors [Wed, 10 Mar 2021 16:44:04 +0000 (16:44 +0000)]
Auto merge of #76570 - cratelyn:implement-rfc-2945-c-unwind-abi, r=Amanieu

Implement RFC 2945: "C-unwind" ABI

## Implement RFC 2945: "C-unwind" ABI

This branch implements [RFC 2945]. The tracking issue for this RFC is #74990.

The feature gate for the issue is `#![feature(c_unwind)]`.

This RFC was created as part of the ffi-unwind project group tracked at rust-lang/lang-team#19.

### Changes

Further details will be provided in commit messages, but a high-level overview
of the changes follows:

* A boolean `unwind` payload is added to the `C`, `System`, `Stdcall`,
and `Thiscall` variants, marking whether unwinding across FFI boundaries is
acceptable. The cases where each of these variants' `unwind` member is true
correspond with the `C-unwind`, `system-unwind`, `stdcall-unwind`, and
`thiscall-unwind` ABI strings introduced in RFC 2945 [3].

* This commit adds a `c_unwind` feature gate for the new ABI strings.
Tests for this feature gate are included in `src/test/ui/c-unwind/`, which
ensure that this feature gate works correctly for each of the new ABIs.
A new language features entry in the unstable book is added as well.

* We adjust the `rustc_middle::ty::layout::fn_can_unwind` function,
used to compute whether or not a `FnAbi` object represents a function that
should be able to unwind when `panic=unwind` is in use.

* Changes are also made to
`rustc_mir_build::build::should_abort_on_panic` so that the function ABI is
used to determind whether it should abort, assuming that the `panic=unwind`
strategy is being used, and no explicit unwind attribute was provided.

[RFC 2945]: https://github.com/rust-lang/rfcs/blob/master/text/2945-c-unwind-abi.md

3 years agoFix "run" button position in error index
Guillaume Gomez [Wed, 10 Mar 2021 15:40:27 +0000 (16:40 +0100)]
Fix "run" button position in error index

3 years agoRename Option::get_or_insert_default
Cameron Steffen [Wed, 10 Mar 2021 14:48:09 +0000 (08:48 -0600)]
Rename Option::get_or_insert_default

3 years agofix error message for copy(_nonoverlapping) overflow
Ralf Jung [Wed, 10 Mar 2021 14:50:44 +0000 (15:50 +0100)]
fix error message for copy(_nonoverlapping) overflow

3 years agoAuto merge of #82884 - nagisa:nagisa/remove-most-of-sideeffect-inserts, r=nikic
bors [Wed, 10 Mar 2021 14:03:00 +0000 (14:03 +0000)]
Auto merge of #82884 - nagisa:nagisa/remove-most-of-sideeffect-inserts, r=nikic

Remove the -Zinsert-sideeffect

This removes all of the code we had in place to work-around LLVM's
handling of forward progress. From this removal excluded is a workaround
where we'd insert a `sideeffect` into clearly infinite loops such as
`loop {}`. This code remains conditionally effective when the LLVM
version is earlier than 12.0, which fixed the forward progress related
miscompilations at their root.

3 years agoAuto merge of #82967 - RalfJung:copy-nonoverlap, r=oli-obk
bors [Wed, 10 Mar 2021 11:21:46 +0000 (11:21 +0000)]
Auto merge of #82967 - RalfJung:copy-nonoverlap, r=oli-obk

fix copy_nonoverlapping

Fixes a bug introduced by https://github.com/rust-lang/rust/pull/77511

r? `@oli-obk`
Fixes https://github.com/rust-lang/rust/issues/82961

3 years agoRemove the -Zinsert-sideeffect
Simonas Kazlauskas [Sun, 7 Mar 2021 23:59:10 +0000 (01:59 +0200)]
Remove the -Zinsert-sideeffect

This removes all of the code we had in place to work-around LLVM's
handling of forward progress. From this removal excluded is a workaround
where we'd insert a `sideeffect` into clearly infinite loops such as
`loop {}`. This code remains conditionally effective when the LLVM
version is earlier than 12.0, which fixed the forward progress related
miscompilations at their root.

3 years agoadd regression test
Ralf Jung [Wed, 10 Mar 2021 09:02:39 +0000 (10:02 +0100)]
add regression test

3 years agoAuto merge of #79519 - cjgillot:noattr, r=wesleywiser
bors [Wed, 10 Mar 2021 08:40:51 +0000 (08:40 +0000)]
Auto merge of #79519 - cjgillot:noattr, r=wesleywiser

Store HIR attributes in a side table

Same idea as #72015 but for attributes.
The objective is to reduce incr-comp invalidations due to modified attributes.
Notably, those due to modified doc comments.

Implementation:
- collect attributes during AST->HIR lowering, in `LocalDefId -> ItemLocalId -> &[Attributes]` nested tables;
- access the attributes through a `hir_owner_attrs` query;
- local refactorings to use this access;
- remove `attrs` from HIR data structures one-by-one.

Change in behaviour:
- the HIR visitor traverses all attributes at once instead of parent-by-parent;
- attribute arrays are sometimes duplicated: for statements and variant constructors;
- as a consequence, attributes are marked as used after unused-attribute lint emission to avoid duplicate lints.

~~Current bug: the lint level is not correctly applied in `std::backtrace_rs`, triggering an unused attribute warning on `#![no_std]`. I welcome suggestions.~~

3 years agofix copy_nonoverlapping
Ralf Jung [Wed, 10 Mar 2021 08:21:18 +0000 (09:21 +0100)]
fix copy_nonoverlapping

3 years agoupdate MSYS2 link in README
Trevor Spiteri [Wed, 10 Mar 2021 07:41:53 +0000 (08:41 +0100)]
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.

3 years agoAdd spirv extension handling in compiletest
Erin Power [Wed, 10 Mar 2021 06:54:26 +0000 (07:54 +0100)]
Add spirv extension handling in compiletest

3 years agoSimplify some of the rendering code in the index
Michael Howell [Wed, 10 Mar 2021 02:16:32 +0000 (19:16 -0700)]
Simplify some of the rendering code in the index

It's kinda silly using serde seq for fixed-length stuff.

3 years agoRemove `masked_crates` from `clean::Crate`
Camelid [Wed, 10 Mar 2021 03:55:35 +0000 (19:55 -0800)]
Remove `masked_crates` from `clean::Crate`

Previously, `masked_crates` existed both on `Cache` and on
`clean::Crate`. During cache population, the `clean::Crate` version was
`take`n and moved to `Cache`.

This change removes the version on `clean::Crate` and instead directly
mutates `Cache.masked_crates` to initialize it. This has the advantage
of avoiding duplication and avoiding unnecessary allocation, as well as
making the flow of information through rustdoc less confusing.

The one downside I see is that `clean::utils::krate()` now uses the side
effect of mutating `DocContext.cache` instead of returning the data
directly, but it already mutated the `Cache` for other things (e.g.,
`deref_trait_did`) so it's not really new behavior. Also,
`clean::utils::krate()` is only called once (and is meant to only be
called once since it performs expensive and potentially destructive
operations) so the mutation shouldn't be an issue.

3 years agoAuto merge of #82953 - JohnTitor:rollup-8rtk5g2, r=JohnTitor
bors [Wed, 10 Mar 2021 01:25:43 +0000 (01:25 +0000)]
Auto merge of #82953 - JohnTitor:rollup-8rtk5g2, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #77511 (Add StatementKind::CopyNonOverlapping)
 - #79208 (Stabilize `unsafe_op_in_unsafe_fn` lint)
 - #82411 (Fixes to ExitStatus and its docs)
 - #82733 (Add powerpc-unknown-openbsd target)
 - #82802 (Build rustdoc for run-make tests, not just run-make-fulldeps)
 - #82849 (Add Option::get_or_default)
 - #82908 (:arrow_up: rust-analyzer)
 - #82937 (Update README.md to use the correct cmake version number)
 - #82938 (Bump tracing-tree dependency)
 - #82942 (Don't hardcode the `v1` prelude in diagnostics, to allow for new preludes.)

Failed merges:

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

3 years agofix: wrong word
ltoddy [Wed, 10 Mar 2021 01:09:37 +0000 (09:09 +0800)]
fix: wrong word

3 years agoTreat header as first paragraph for shortened markdown descriptions
Michael Howell [Wed, 10 Mar 2021 00:48:14 +0000 (17:48 -0700)]
Treat header as first paragraph for shortened markdown descriptions

"The Rust Standard LibraryThe Rust Standard Library is the …" is an awful description.