]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoRemove RefCell around module_trait_cache
Joshua Nelson [Mon, 22 Feb 2021 14:21:47 +0000 (09:21 -0500)]
Remove RefCell around module_trait_cache

3 years agoDon't require a `DocContext` for `report_diagnostic`
Joshua Nelson [Mon, 22 Feb 2021 14:31:41 +0000 (09:31 -0500)]
Don't require a `DocContext` for `report_diagnostic`

This is needed for the next commit, which needs access to the `cx` from
within the `decorate` closure.

- Change `as_local_hir_id` to an associated function, since it only
  needs a `TyCtxt`
- Change `source_span_for_markdown_range` to only take a `TyCtxt`

3 years agoAuto merge of #82756 - JohnTitor:rollup-e4ij7h6, r=JohnTitor
bors [Thu, 4 Mar 2021 11:02:13 +0000 (11:02 +0000)]
Auto merge of #82756 - JohnTitor:rollup-e4ij7h6, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #80527 (Make rustdoc lints a tool lint instead of built-in)
 - #82310 (Load rustdoc's JS search index on-demand.)
 - #82315 (Improve page load performance in rustdoc)
 - #82564 (Revert `Vec::spare_capacity_mut` impl to prevent pointers invalidation)
 - #82697 (Fix stabilization version of move_ref_pattern)
 - #82717 (Account for macros when suggesting adding lifetime)
 - #82740 (Fix commit detected when using `download-rustc`)
 - #82744 (Pass `CrateNum` by value instead of by reference)

Failed merges:

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

3 years agoRollup merge of #82744 - camelid:cratenum-byval, r=GuillaumeGomez
Yuki Okushi [Thu, 4 Mar 2021 11:01:12 +0000 (20:01 +0900)]
Rollup merge of #82744 - camelid:cratenum-byval, r=GuillaumeGomez

Pass `CrateNum` by value instead of by reference

It's more idiomatic to pass a small Copy type by value and `CrateNum` is
half the size of `&CrateNum` on 64-bit systems. The memory use change is
almost certainly insignificant, but why not!

3 years agoRollup merge of #82740 - jyn514:proper-history, r=Mark-Simulacrum
Yuki Okushi [Thu, 4 Mar 2021 11:01:10 +0000 (20:01 +0900)]
Rollup merge of #82740 - jyn514:proper-history, r=Mark-Simulacrum

Fix commit detected when using `download-rustc`

On reflection on the issue in https://github.com/rust-lang/rust/pull/79540#discussion_r572572280, I think the bug was actually using the `compiler/` filter, not using `--author=bors`. https://github.com/rust-lang/rust/commit/9a1d6174c925f54c923599e29b09d6855e6b3a78 has no CI artifacts because it was merged as part of a rollup:
```
$ curl -I https://ci-artifacts.rust-lang.org/rustc-builds/96e843ce6ae42e0aa519ba45e148269de347fd84/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz
HTTP/2 404
```
So 9a1d6174c925f54c923599e29b09d6855e6b3a78 is the correct commit to download, and that's what `--author=bors` does:

$ git log --author=bors 4aec8a5da5547d6e1c24e99dad0003b7cac107f5
commit 9a1d6174c925f54c923599e29b09d6855e6b3a78

Ideally it would look for "the most recent bors commit not followed by a change to `compiler/`", which would exclude things like documentation changes and avoid redownloading more than necessary, but
- Redownloading isn't the end of the world,
- That metric is hard to implement, and
- Documentation-only or library-only changes are very rare anyway since they're usually rolled up with changes to the compiler.

Helps with https://github.com/rust-lang/rust/issues/81930.

r? `@Mark-Simulacrum`

3 years agoRollup merge of #82717 - estebank:issue-70152, r=lcnr
Yuki Okushi [Thu, 4 Mar 2021 11:01:09 +0000 (20:01 +0900)]
Rollup merge of #82717 - estebank:issue-70152, r=lcnr

Account for macros when suggesting adding lifetime

Fix #70152.

3 years agoRollup merge of #82697 - jplatte:patch-1, r=davidtwco
Yuki Okushi [Thu, 4 Mar 2021 11:01:07 +0000 (20:01 +0900)]
Rollup merge of #82697 - jplatte:patch-1, r=davidtwco

Fix stabilization version of move_ref_pattern

Both the [changelog](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-1490-2020-12-31) and the milestone of the [stabilization PR](https://github.com/rust-lang/rust/pull/76119) say 1.49.0, but the source says 1.48.0. I think the former is correct.

3 years agoRollup merge of #82564 - WaffleLapkin:revert_spare_mut, r=RalfJung
Yuki Okushi [Thu, 4 Mar 2021 11:01:06 +0000 (20:01 +0900)]
Rollup merge of #82564 - WaffleLapkin:revert_spare_mut, r=RalfJung

Revert `Vec::spare_capacity_mut` impl to prevent pointers invalidation

The implementation was changed in #79015.

Later it was [pointed out](https://github.com/rust-lang/rust/issues/81944#issuecomment-782849785) that the implementation invalidates pointers to the buffer (initialized elements) by creating a unique reference to the buffer. This PR reverts the implementation.

r? ```@RalfJung```

3 years agoRollup merge of #82315 - jsha:font-display-swap, r=GuillaumeGomez
Yuki Okushi [Thu, 4 Mar 2021 11:01:04 +0000 (20:01 +0900)]
Rollup merge of #82315 - jsha:font-display-swap, r=GuillaumeGomez

Improve page load performance in rustdoc

Add an explicit height to icons (which already had an explicit width) to allow browsers to lay out the page more accurately before the icons have been loaded. https://web.dev/optimize-cls/.

Add min-width: 115px to the crate search dropdown. When the HTML first loads, this dropdown includes only the text "All crates." Later, JS loads the items underneath it, some of which are wider. That causes the dropdown to get wider, causing a distracting reflow. This sets a min-width based on the size that the dropdown eventually becomes based on the crates on doc.rust-lang.org, reducing page movement during load.

Add font-display: swap. Per https://web.dev/font-display/, this prevents "flash of invisible text" during load by using a system font until the custom font is available. I've noticed this flash of invisible text occasionally when reading Rust docs. Note that users without cached fonts will see text, and then see it reflow. For `docs.rust-lang.org`, [setting caching headers will help a lot](https://github.com/rust-lang/simpleinfra/issues/62).

Generated output at https://jacob.hoffman-andrews.com/rust/flow-improvements/std/string/struct.String.html.

3 years agoRollup merge of #82310 - jsha:rustdoc-search-onfocus, r=GuillaumeGomez
Yuki Okushi [Thu, 4 Mar 2021 11:01:03 +0000 (20:01 +0900)]
Rollup merge of #82310 - jsha:rustdoc-search-onfocus, r=GuillaumeGomez

Load rustdoc's JS search index on-demand.

Instead of being loaded on every page, the JS search index is now loaded when either (a) there is a `?search=` param, or (b) the search input is focused.

This saves both CPU and bandwidth. As of Feb 2021, https://doc.rust-lang.org/search-index1.50.0.js is 273,838 bytes gzipped or 2,544,939 bytes uncompressed. Evaluating it takes 445 ms of CPU time in Chrome 88 on a i7-10710U CPU (out of a total ~2,100 ms page reload).

Tested on Firefox and Chrome.

New:
https://jacob.hoffman-andrews.com/rust/search-on-demand/std/primitive.slice.html
https://jacob.hoffman-andrews.com/rust/search-on-demand/std/primitive.slice.html?search=fn

Old:
https://jacob.hoffman-andrews.com/rust/search-on-load/std/primitive.slice.html
https://jacob.hoffman-andrews.com/rust/search-on-load/std/primitive.slice.html?search=fn

3 years agoRollup merge of #80527 - jyn514:rustdoc-lints, r=GuillaumeGomez
Yuki Okushi [Thu, 4 Mar 2021 11:01:01 +0000 (20:01 +0900)]
Rollup merge of #80527 - jyn514:rustdoc-lints, r=GuillaumeGomez

Make rustdoc lints a tool lint instead of built-in

- Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links` (and similar for other rustdoc lints; I don't expect any others to be used frequently, though).
- Ensure that the old lint names still work and give deprecation errors
- Register lints even when running doctests
- Move lint machinery into a separate file
- Add `declare_rustdoc_lint!` macro

Unblocks https://github.com/rust-lang/rust/pull/80300, https://github.com/rust-lang/rust/pull/79816, https://github.com/rust-lang/rust/pull/80965. Makes the strangeness in https://github.com/rust-lang/rust/pull/77364 more apparent to the end user (note that `missing_docs` is *not* moved to rustdoc in this PR). Closes https://github.com/rust-lang/rust/issues/78786.

## Current status

This is blocked on #82620 (see https://github.com/rust-lang/rust/pull/80527#issuecomment-787401519)

3 years agoAuto merge of #82304 - LeSeulArtichaut:unpretty-ast, r=spastorino
bors [Thu, 4 Mar 2021 05:46:43 +0000 (05:46 +0000)]
Auto merge of #82304 - LeSeulArtichaut:unpretty-ast, r=spastorino

Add `-Z unpretty` flags for the AST

Implements rust-lang/compiler-team#408.
Builds on #82269, but if that PR is rejected or stalls out, I can implement this without #82269.
cc rust-lang/rustc-dev-guide#1062

3 years agoPass `CrateNum` by value instead of by reference
Camelid [Thu, 4 Mar 2021 04:04:27 +0000 (20:04 -0800)]
Pass `CrateNum` by value instead of by reference

It's more idiomatic to pass a small Copy type by value and `CrateNum` is
half the size of `&CrateNum` on 64-bit systems. The memory use change is
almost certainly insignificant, but why not!

3 years agoFix commit detected when using `download-rustc`
Joshua Nelson [Thu, 4 Mar 2021 03:11:07 +0000 (22:11 -0500)]
Fix commit detected when using `download-rustc`

On reflection on the issue in https://github.com/rust-lang/rust/pull/79540#discussion_r572572280,  I think the bug was actually using the `compiler/` filter, not using `--author=bors`. https://github.com/rust-lang/rust/commit/9a1d6174c925f54c923599e29b09d6855e6b3a78 has no CI artifacts because it was merged as part of a rollup:
```
$ curl -I https://ci-artifacts.rust-lang.org/rustc-builds/96e843ce6ae42e0aa519ba45e148269de347fd84/rust-std-nightly-x86_64-unknown-linux-gnu.tar.xz
HTTP/2 404
```
So 9a1d6174c925f54c923599e29b09d6855e6b3a78 is the correct commit to download, and that's what `--author=bors` does:

$ git log --author=bors 4aec8a5da5547d6e1c24e99dad0003b7cac107f5
commit 9a1d6174c925f54c923599e29b09d6855e6b3a78

Ideally it would look for "the most recent bors commit not followed by a change to `compiler/`", which would exclude things like documentation changes and avoid redownloading more than necessary, but
- Redownloading isn't the end of the world,
- That metric is hard to implement, and
- Documentation-only or library-only changes are very rare anyway since they're usually rolled up with changes to the compiler.

3 years agoAuto merge of #81114 - bugadani:generator, r=estebank
bors [Thu, 4 Mar 2021 00:23:42 +0000 (00:23 +0000)]
Auto merge of #81114 - bugadani:generator, r=estebank

Box generator-related Body fields

Might save some memory on functions that aren't generators.

3 years agoAuto merge of #82702 - jyn514:downgrade-err, r=Manishearth
bors [Wed, 3 Mar 2021 21:35:32 +0000 (21:35 +0000)]
Auto merge of #82702 - jyn514:downgrade-err, r=Manishearth

Change error about unknown attributes to a warning

Hard errors should go through a future-compatibility phase first, especially since these attributes only have no effect and don't actively cause bugs.

Follow-up to https://github.com/rust-lang/rust/pull/82662. Fixes ecosystem breakage like https://github.com/rust-lang/rust-clippy/issues/6832.

r? `@GuillaumeGomez`

3 years agoreworded message
Esteban Küber [Wed, 3 Mar 2021 20:15:26 +0000 (12:15 -0800)]
reworded message

3 years agoAuto merge of #82553 - tmiasko:update-tracing, r=Mark-Simulacrum
bors [Wed, 3 Mar 2021 18:01:29 +0000 (18:01 +0000)]
Auto merge of #82553 - tmiasko:update-tracing, r=Mark-Simulacrum

Update tracing to 0.1.25

* Update tracing from 0.1.18 to 0.1.25
* Update tracing-subscriber from 0.2.13 to 0.2.16
* Update tracing-tree from 0.1.6 to 0.1.8
* Add pin-project-lite to the list of allowed dependencies (it is now a direct dependency of tracing).

3 years agoUpdate library/alloc/src/vec/mod.rs
Waffle Lapkin [Wed, 3 Mar 2021 17:04:20 +0000 (20:04 +0300)]
Update library/alloc/src/vec/mod.rs

Co-authored-by: Ralf Jung <post@ralfj.de>
3 years agoChange error about unknown doc attributes to a warning
Joshua Nelson [Tue, 2 Mar 2021 14:42:32 +0000 (09:42 -0500)]
Change error about unknown doc attributes to a warning

This prevents breakage across the ecosystem, since the error was just
introduced recently without first having a warning period.

3 years agoAdd `-Z unpretty` flags for the AST
LeSeulArtichaut [Fri, 19 Feb 2021 21:40:28 +0000 (22:40 +0100)]
Add `-Z unpretty` flags for the AST

3 years agoAuto merge of #82704 - RalfJung:miri-atomic-minmax, r=oli-obk
bors [Wed, 3 Mar 2021 11:05:01 +0000 (11:05 +0000)]
Auto merge of #82704 - RalfJung:miri-atomic-minmax, r=oli-obk

enable atomic_min/max tests in Miri

Thanks to `@henryboisdequin` and `@GregBowyer,` Miri now supports these intrinsics. :)
Also includes the necessary Miri update.

3 years agoAuto merge of #82718 - JohnTitor:rollup-vpfx3j2, r=JohnTitor
bors [Wed, 3 Mar 2021 08:36:46 +0000 (08:36 +0000)]
Auto merge of #82718 - JohnTitor:rollup-vpfx3j2, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #81223 ([rustdoc] Generate redirect map file)
 - #82439 (BTree: fix untrue safety)
 - #82469 (Use a crate to produce rustdoc tree comparisons instead of the `diff` command)
 - #82589 (unix: Non-mutable bufs in send_vectored_with_ancillary_to)
 - #82689 (meta: Notify Zulip for rustdoc nominated issues)
 - #82695 (Revert non-power-of-two vector restriction)
 - #82706 (use outer_expn_data() instead of outer_expn().expn_data())
 - #82710 (FloatToInit: Replacing round_unchecked_to --> to_int_unchecked)
 - #82712 (Remove unnecessary conditional `cfg(target_os)` for `redox` and `vxworks`)
 - #82713 (Update cargo)

Failed merges:

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

3 years agoRollup merge of #82713 - ehuss:update-cargo, r=ehuss
Yuki Okushi [Wed, 3 Mar 2021 07:27:48 +0000 (16:27 +0900)]
Rollup merge of #82713 - ehuss:update-cargo, r=ehuss

Update cargo

12 commits in 572e201536dc2e4920346e28037b63c0f4d88b3c..c68432f1e5cbbc09833699a951b1b5b059651dff
2021-02-24 16:51:20 +0000 to 2021-03-02 18:26:29 +0000
- Don't panic when printing JSON with non-utf8 paths (rust-lang/cargo#9226)
- Detect changes for JSON spec targets. (rust-lang/cargo#9223)
- Fix `cargo_target_empty_cfg` test with env var. (rust-lang/cargo#9225)
- Correct default cargo new edition (rust-lang/cargo#9202)
- Update split-debuginfo docs around the default. (rust-lang/cargo#9224)
- Minor update to registry API error messages. (rust-lang/cargo#9213)
- Some minor code cleanup. (rust-lang/cargo#9214)
- doc: Fix spelling worksapce-&gt;workspace (rust-lang/cargo#9212)
- Update SPDX version in docs. (rust-lang/cargo#9209)
- Throw error if CARGO_TARGET_DIR is an empty string (rust-lang/cargo#8939)
- testsuite: Use split debuginfo on macos. (rust-lang/cargo#9207)
- testsuite: Improve performance when using rustup. (rust-lang/cargo#9206)

3 years agoRollup merge of #82712 - CDirkx:cfg-target_os, r=dtolnay
Yuki Okushi [Wed, 3 Mar 2021 07:27:47 +0000 (16:27 +0900)]
Rollup merge of #82712 - CDirkx:cfg-target_os, r=dtolnay

Remove unnecessary conditional `cfg(target_os)` for `redox` and `vxworks`

`redox` and `vxworks` are now part of target_family `unix`, thus `cfg(unix)` already implies `cfg(target_os="redox")` and `cfg(target_os="vxworks")`

https://github.com/rust-lang/rust/blob/35dbef235048f9a2939dc20effe083ca483c37ff/compiler/rustc_target/src/spec/redox_base.rs#L26

https://github.com/rust-lang/rust/blob/35dbef235048f9a2939dc20effe083ca483c37ff/compiler/rustc_target/src/spec/vxworks_base.rs#L27

3 years agoRollup merge of #82710 - peter-kehl:FloatToInit_82709, r=sfackler
Yuki Okushi [Wed, 3 Mar 2021 07:27:46 +0000 (16:27 +0900)]
Rollup merge of #82710 - peter-kehl:FloatToInit_82709, r=sfackler

FloatToInit: Replacing round_unchecked_to --> to_int_unchecked

FloatToInit docs: Replacing round_unchecked_to with
to_int_unchecked. Bug #82709.

3 years agoRollup merge of #82706 - klensy:expn-data, r=petrochenkov
Yuki Okushi [Wed, 3 Mar 2021 07:27:45 +0000 (16:27 +0900)]
Rollup merge of #82706 - klensy:expn-data, r=petrochenkov

use outer_expn_data() instead of outer_expn().expn_data()

From the comment in hygiene.rs, so use it:
https://github.com/rust-lang/rust/blob/master/compiler/rustc_span/src/hygiene.rs#L627-L632

3 years agoRollup merge of #82695 - XAMPPRocky:remove-non-power-of-two-limit, r=nagisa
Yuki Okushi [Wed, 3 Mar 2021 07:27:44 +0000 (16:27 +0900)]
Rollup merge of #82695 - XAMPPRocky:remove-non-power-of-two-limit, r=nagisa

Revert non-power-of-two vector restriction

Removes the power of two restriction from rustc. As discussed in https://github.com/rust-lang/stdsimd/issues/63

r? ```@calebzulawski```

cc ```@workingjubilee``` ```@thomcc```

3 years agoRollup merge of #82689 - camelid:rustdoc-nominated, r=Manishearth
Yuki Okushi [Wed, 3 Mar 2021 07:27:42 +0000 (16:27 +0900)]
Rollup merge of #82689 - camelid:rustdoc-nominated, r=Manishearth

meta: Notify Zulip for rustdoc nominated issues

The rustdoc team does not currently use the `I-nominated` label, unlike
the libs and compiler teams (and maybe others). One reason for this is
that the other teams discuss their nominated issues in meetings, while
rustdoc is an async-only team.

However, it might be helpful to start using the `I-nominated` label for
rustdoc. The team currently uses a `cc ``@rust-lang/rustdoc``` ping as the
equivalent, but it's easier to track issues when they use `I-nominated`.
Also we'd be more consistent with the other teams' procedures.

Since rustdoc doesn't have meetings, I propose we instead use the
triagebot notify Zulip functionality to create a topic in `#rustdoc` on
Zulip and ping the team. So it would look a bit like the procedure for
WG-prioritization when an issue acquires the `I-prioritize` label.

cc ``@rust-lang/rustdoc`` for approval of the change
r? ``@Mark-Simulacrum`` to make sure I configured triagebot correctly

3 years agoRollup merge of #82589 - LinkTed:master, r=joshtriplett
Yuki Okushi [Wed, 3 Mar 2021 07:27:41 +0000 (16:27 +0900)]
Rollup merge of #82589 - LinkTed:master, r=joshtriplett

unix: Non-mutable bufs in send_vectored_with_ancillary_to

This is the same PR as [#79753](https://github.com/rust-lang/rust/pull/79753). It was closed because of inactivity. Therefore, I create a new one. ````@lukaslihotzki````

3 years agoRollup merge of #82469 - notriddle:bring-our-own-diff, r=Mark-Simulacrum
Yuki Okushi [Wed, 3 Mar 2021 07:27:40 +0000 (16:27 +0900)]
Rollup merge of #82469 - notriddle:bring-our-own-diff, r=Mark-Simulacrum

Use a crate to produce rustdoc tree comparisons instead of the `diff` command

It doesn't come with Windows, so bring [our own](https://github.com/notriddle/rust-unified-diff/).

Fixes #82409

![image](https://user-images.githubusercontent.com/1593513/109230755-9a1d5700-7782-11eb-8359-353a506875ab.png)

3 years agoRollup merge of #82439 - ssomers:btree_fix_unsafety, r=Mark-Simulacrum
Yuki Okushi [Wed, 3 Mar 2021 07:27:39 +0000 (16:27 +0900)]
Rollup merge of #82439 - ssomers:btree_fix_unsafety, r=Mark-Simulacrum

BTree: fix untrue safety

Fix needless and missing `unsafe` tags.

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

3 years agoRollup merge of #81223 - GuillaumeGomez:generate-redirect-map, r=jyn514
Yuki Okushi [Wed, 3 Mar 2021 07:27:38 +0000 (16:27 +0900)]
Rollup merge of #81223 - GuillaumeGomez:generate-redirect-map, r=jyn514

[rustdoc] Generate redirect map file

Fixes #81134.

So with this code:

```rust
#![crate_name = "foo"]

pub use private::Quz;
pub use hidden::Bar;

mod private {
    pub struct Quz;
}

#[doc(hidden)]
pub mod hidden {
    pub struct Bar;
}

#[macro_export]
macro_rules! foo {
() => {}
}
```

It generates:

```json
{
  "foo/macro.foo!.html": "foo/macro.foo.html",
  "foo/private/struct.Quz.html": "foo/struct.Quz.html",
  "foo/hidden/struct.Bar.html": "foo/struct.Bar.html"
}
```

Do the pathes look as you expected ````@pietroalbini?````

r? ````@jyn514````

3 years agoAuto merge of #76345 - okready:sgx-mem-range-overflow-checks, r=joshtriplett
bors [Wed, 3 Mar 2021 05:45:50 +0000 (05:45 +0000)]
Auto merge of #76345 - okready:sgx-mem-range-overflow-checks, r=joshtriplett

Add is_enclave_range/is_user_range overflow checks

Fixes #76343.

This adds overflow checking to `is_enclave_range` and `is_user_range` in `sgx::os::fortanix_sgx::mem` in order to mitigate possible security issues with enclave code. It also accounts for an edge case where the memory range provided ends exactly at the end of the address space, where calculating `p + len` would overflow back to zero despite the range potentially being valid.

3 years agoUse Arial as fallback font instead of sans-serif.
Jacob Hoffman-Andrews [Wed, 3 Mar 2021 02:27:34 +0000 (18:27 -0800)]
Use Arial as fallback font instead of sans-serif.

On most platforms and browsers, `sans-serif` is equivalent to Arial.
However, on Firefox on Ubuntu (and possibly other Linuxes), `sans-serif`
is DejaVu Sans, a much wider font. This creates a larger shift in text
when the custom fonts finally load. Arial is a web-safe font, and
specifying it explicitly gives us more cross-platform consistency, as
well as reducing the layout shift that happens when fonts load.

3 years agoAccount for macros when suggesting adding lifetime
Esteban Küber [Wed, 3 Mar 2021 02:24:13 +0000 (18:24 -0800)]
Account for macros when suggesting adding lifetime

Fix #70152.

3 years agoImprove page load performance in rustdoc.
Jacob Hoffman-Andrews [Sat, 20 Feb 2021 01:54:41 +0000 (17:54 -0800)]
Improve page load performance in rustdoc.

Add font-display: swap. Per https://web.dev/font-display/, this prevents
"flash of invisible text" during load by using a system font until the
custom font is available. I've noticed this flash of invisible text
occasionally when reading Rust docs.

Add an explicit height to icons (which already had an explicit width)
to allow browsers to lay out the page more accurately before the icons
have been loaded. https://web.dev/optimize-cls/.

Add min-width: 115px to the crate search dropdown. When the HTML first
loads, this dropdown includes only the text "All crates." Later, JS
loads the items underneath it, some of which are wider. That causes
the dropdown to get wider, causing a distracting reflow. This sets a
min-width based on the size that the dropdown eventually becomes based
on the crates on doc.rust-lang.org, reducing page movement during load.

3 years agoUpdate cargo
Eric Huss [Wed, 3 Mar 2021 00:24:14 +0000 (16:24 -0800)]
Update cargo

3 years agoRemove unnecessary conditional `cfg(target_os)` for `redox` and `vxworks`
Christiaan Dirkx [Wed, 3 Mar 2021 00:14:17 +0000 (01:14 +0100)]
Remove unnecessary conditional `cfg(target_os)` for `redox` and `vxworks`

`redox` and `vxworks` are part of target_family `unix`, thus `cfg(unix)` already implies `cfg(target_os="redox")` and `(target_os="vxworks")`

3 years agoMake Vec::split_at_spare_mut impl safer & simplier
Waffle [Tue, 2 Mar 2021 22:04:20 +0000 (01:04 +0300)]
Make Vec::split_at_spare_mut impl safer & simplier

3 years agoAdd test that Vec::spare_capacity_mut doesn't invalidate pointers
Waffle [Tue, 2 Mar 2021 22:00:59 +0000 (01:00 +0300)]
Add test that Vec::spare_capacity_mut doesn't invalidate pointers

3 years agoLoad rustdoc's JS search index on-demand.
Jacob Hoffman-Andrews [Sat, 20 Feb 2021 01:22:30 +0000 (17:22 -0800)]
Load rustdoc's JS search index on-demand.

Instead of being loaded on every page, the JS search index is now
loaded when either (a) there is a `?search=` param, or (b) the search
input is focused.

This saves both CPU and bandwidth. As of Feb 2021,
https://doc.rust-lang.org/search-index1.50.0.js is 273,838 bytes
gzipped or 2,544,939 bytes uncompressed. Evaluating it takes 445 ms
of CPU time in Chrome 88 on a i7-10710U CPU (out of a total ~2,100
ms page reload).

Generate separate JS file with crate names.

This is much smaller than the full search index, and is used in the "hot
path" to draw the page. In particular it's used to crate the dropdown
for the search bar, and to append a list of crates to the sidebar (on
some pages).

Skip early search that can bypass 500ms timeout.

This was occurring when someone had typed some text during the load of
search-index.js. Their query was usually not ready to execute, and the
search itself is fairly expensive, delaying the overall load, which
delayed the input / keyup events, which delayed eventually executing the
query.

3 years agoAuto merge of #82562 - llogiq:one-up-82248, r=oli-obk
bors [Tue, 2 Mar 2021 21:01:47 +0000 (21:01 +0000)]
Auto merge of #82562 - llogiq:one-up-82248, r=oli-obk

Optimize counting digits in line numbers during error reporting further

This one-ups #82248 by switching the strategy: Instead of dividing the value by 10 repeatedly, we compare with a limit that we multiply by 10 repeatedly. In my benchmarks, this took between 50% and 25% of the original time. The reasons for being faster are:

1. While LLVM is able to replace a division by constant with a multiply + shift, a plain multiplication is still faster. However, this doesn't even factor, because
2. Multiplication, unlike division, is const. We also use a simple for-loop instead of a more complex loop + break, which allows
3. rustc to const-fold the whole loop, and indeed the assembly output simply shows a series of comparisons.

3 years agoFloatToInit: Replacing round_unchecked_to --> to_int_unchecked
Peter Kehl [Tue, 2 Mar 2021 20:38:22 +0000 (12:38 -0800)]
FloatToInit: Replacing round_unchecked_to --> to_int_unchecked

FloatToInit docs: Replacing round_unchecked_to with
to_int_unchecked. Bug #82709.

3 years agouse outer_expn_data() instead of outer_expn().expn_data()
klensy [Tue, 2 Mar 2021 19:01:29 +0000 (22:01 +0300)]
use outer_expn_data() instead of outer_expn().expn_data()

3 years agoupdate Miri
Ralf Jung [Tue, 2 Mar 2021 19:01:25 +0000 (20:01 +0100)]
update Miri

3 years agoenable atomic_min/max tests in Miri
Ralf Jung [Tue, 2 Mar 2021 18:58:55 +0000 (19:58 +0100)]
enable atomic_min/max tests in Miri

3 years agoAuto merge of #82043 - tmiasko:may-have-side-effect, r=kennytm
bors [Tue, 2 Mar 2021 16:08:32 +0000 (16:08 +0000)]
Auto merge of #82043 - tmiasko:may-have-side-effect, r=kennytm

Turn may_have_side_effect into an associated constant

The `may_have_side_effect` is an implementation detail of `TrustedRandomAccess`
trait. It describes if obtaining an iterator element may have side effects. It
is currently implemented as an associated function.

Turn `may_have_side_effect` into an associated constant. This makes the
value immediately available to the optimizer.

3 years agoAuto merge of #82698 - JohnTitor:rollup-htd533c, r=JohnTitor
bors [Tue, 2 Mar 2021 12:57:06 +0000 (12:57 +0000)]
Auto merge of #82698 - JohnTitor:rollup-htd533c, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #80189 (Convert primitives in the standard library to intra-doc links)
 - #80874 (Update intra-doc link documentation to match the implementation)
 - #82376 (Add option to enable MIR inlining independently of mir-opt-level)
 - #82516 (Add incomplete feature gate for inherent associate types.)
 - #82579 (Fix turbofish recovery with multiple generic args)
 - #82593 (Teach rustdoc how to display WASI.)
 - #82597 (Get TyCtxt from self instead of passing as argument in AutoTraitFinder)
 - #82627 (Erase late bound regions to avoid ICE)
 - #82661 (:arrow_up: rust-analyzer)
 - #82691 (Update books)

Failed merges:

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

3 years agoRollup merge of #82691 - ehuss:update-books, r=ehuss
Yuki Okushi [Tue, 2 Mar 2021 12:23:22 +0000 (21:23 +0900)]
Rollup merge of #82691 - ehuss:update-books, r=ehuss

Update books

## reference

2 commits in 361367c126290ac17cb4089f8d38fd8b2ac43f98..3b6fe80c205d2a2b5dc8a276192bbce9eeb9e9cf
2021-02-15 09:58:13 -0800 to 2021-02-22 22:09:17 -0800
- Add an extra fn() entry to the variance table in the subtyping chapter (rust-lang-nursery/reference#874)
- Turbofish: Explain what the example is of. (rust-lang-nursery/reference#966)

## book

28 commits in db5e8a5105aa22979490dce30e33b68d8645761d..0f87daf683ae3de3cb725faecb11b7e7e89f0e5a
2021-02-12 16:58:20 -0500 to 2021-03-01 08:54:04 -0500
- Ohhh the should_panic was for mdbook test. Oops
- Fix bad regex in the update rustc script and regenerate broken output
- Clarify that we only mentioned unwrap_or_else, but haven't explained it
- Add ferris to some listings that don't compile. Fixes rust-lang/book#2598
- Remove fancy quote from a code comment
- Panic now points at our code, not stdlib slice code
- Disable playground on thread::sleep examples
- Disable playground button on listings in ch 12 that use CLI args
- Reword ambiguous sentence. Fixes rust-lang/book#2317.
- Rename shoes_in_my_size to shoes_in_size to be a better example
- Fix visible "ANCHOR: here" in listing 13-21 (rust-lang/book#2628)
- minor clarification about deriving Copy and Clone (rust-lang/book#2627)
- Clarify relationship of trait to mock object
- Fix "message" that should be "method"
- Fix rust-lang/book#2625 (rust-lang/book#2626)
- fix misleading hash claim (rust-lang/book#2621)
- Make link syntax consistent and word wrap
- Added hyperlinks to Appendices
- Use console syntax highlighting in some more places
- Merge remote-tracking branch 'origin/pr/2615'
- Fix broken blockquote
- Update one more bit of output caught by the update rust script
- Update and clarify some text affected by the rand update
- Update lock files and output
- Update error output for changes to chapter 10 listings
- Merge remote-tracking branch 'origin/pr/2542'
- Tweak wording in for loop explanation
- Merge remote-tracking branch 'origin/pr/2460'

## rust-by-example

1 commits in 551cc4bc8394feccea6acd21f86d9a4e1d2271a0..3e0d98790c9126517fa1c604dc3678f396e92a27
2021-02-03 17:12:37 -0300 to 2021-02-25 08:23:10 -0300
- Make flow_control/for/.into_iter() example run (rust-lang/rust-by-example#1415)

## rustc-dev-guide

530 commits in 7adfab42bab045a848126895c2f1e09927c1331a..c431f8c29a41413dddcb3bfa0d71c9cabe366317
2020-04-08 08:52:05 +0200 to 2021-02-28 16:35:20 -0500

... Many updates.

## embedded-book

1 commits in 4cf7981696a85c3e633076c6401611bd3f6346c4..a96d096cffe5fa2c84af1b4b61e1492f839bb2e1
2021-02-11 10:55:22 +0000 to 2021-02-17 08:08:52 +0000
- Add note about using more recent openocd interface file. Closes rust-embedded/book#277 and rust-embedded/book#263  (rust-embedded/book#284)

3 years agoRollup merge of #82661 - lnicola:rust-analyzer-2021-03-01, r=jonas-schievink
Yuki Okushi [Tue, 2 Mar 2021 12:23:21 +0000 (21:23 +0900)]
Rollup merge of #82661 - lnicola:rust-analyzer-2021-03-01, r=jonas-schievink

:arrow_up: rust-analyzer

3 years agoRollup merge of #82627 - JohnTitor:issue-82612, r=estebank
Yuki Okushi [Tue, 2 Mar 2021 12:23:20 +0000 (21:23 +0900)]
Rollup merge of #82627 - JohnTitor:issue-82612, r=estebank

Erase late bound regions to avoid ICE

Fixes #82612, which is caused by #81769.

r? `@estebank`

3 years agoRollup merge of #82597 - noslaver:fix-82137, r=nagisa
Yuki Okushi [Tue, 2 Mar 2021 12:23:19 +0000 (21:23 +0900)]
Rollup merge of #82597 - noslaver:fix-82137, r=nagisa

Get TyCtxt from self instead of passing as argument in AutoTraitFinder

First contribution :crab:, let me know if anything is amiss.

Fix #82137.

3 years agoRollup merge of #82593 - sunfishcode:wasi-docs, r=alexcrichton
Yuki Okushi [Tue, 2 Mar 2021 12:23:18 +0000 (21:23 +0900)]
Rollup merge of #82593 - sunfishcode:wasi-docs, r=alexcrichton

Teach rustdoc how to display WASI.

As a followup to [this comment] in #82420, this patch teaches rustdoc
how to display WASI.

[this comment]: https://github.com/rust-lang/rust/pull/82420#issuecomment-784523826

r? `@alexcrichton`

3 years agoRollup merge of #82579 - osa1:issue82566, r=estebank
Yuki Okushi [Tue, 2 Mar 2021 12:23:17 +0000 (21:23 +0900)]
Rollup merge of #82579 - osa1:issue82566, r=estebank

Fix turbofish recovery with multiple generic args

This consists of two commits, each can be individually reviewed.

- First commit fixes the issue in [this comment](https://github.com/rust-lang/rust/issues/82566#issuecomment-786924466).
- Second commit fixes #82566

---

r? ````@estebank````

3 years agoRollup merge of #82516 - PoignardAzur:inherent-impl-ty, r=oli-obk
Yuki Okushi [Tue, 2 Mar 2021 12:23:15 +0000 (21:23 +0900)]
Rollup merge of #82516 - PoignardAzur:inherent-impl-ty, r=oli-obk

Add incomplete feature gate for inherent associate types.

Mentored by ``````@oli-obk``````

So far the only change is that instead of giving an automatic error, the following code compiles:

```rust
struct Foo;

impl Foo {
    type Bar = isize;
}
```

The backend work to make it actually usable isn't there yet. In particular, this:

```rust
let x : Foo::Bar;
```

will give you:

```sh
error[E0223]: ambiguous associated type
  --> /$RUSTC_DIR/src/test/ui/assoc-inherent.rs:15:13
   |
LL |     let x : Foo::Bar;
   |             ^^^^^^^^ help: use fully-qualified syntax: `<Foo as Trait>::Bar`
```

3 years agoRollup merge of #82376 - tmiasko:inline-options, r=oli-obk
Yuki Okushi [Tue, 2 Mar 2021 12:23:14 +0000 (21:23 +0900)]
Rollup merge of #82376 - tmiasko:inline-options, r=oli-obk

Add option to enable MIR inlining independently of mir-opt-level

Add `-Zinline-mir` option that enables MIR inlining independently of the
current MIR opt level. The primary use-case is enabling MIR inlining on the
default MIR opt level.

Turn inlining thresholds into optional values to make it possible to configure
different defaults depending on the current mir-opt-level (although thresholds
are yet to be used in such a manner).

3 years agoRollup merge of #80874 - jyn514:intra-doc-docs, r=Manishearth
Yuki Okushi [Tue, 2 Mar 2021 12:23:13 +0000 (21:23 +0900)]
Rollup merge of #80874 - jyn514:intra-doc-docs, r=Manishearth

Update intra-doc link documentation to match the implementation

r? `@Manishearth`
cc `@camelid` `@m-ou-se`

Relevant PRs:
- https://github.com/rust-lang/rust/pull/74489
- https://github.com/rust-lang/rust/pull/80181
- https://github.com/rust-lang/rust/pull/76078
- https://github.com/rust-lang/rust/pull/77519
- https://github.com/rust-lang/rust/pull/73101

Relevant issues:
- https://github.com/rust-lang/rust/issues/78800
- https://github.com/rust-lang/rust/issues/77200
- https://github.com/rust-lang/rust/issues/77199 / https://github.com/rust-lang/rust/issues/54191/

I haven't documented things that I consider 'just bugs', like https://github.com/rust-lang/rust/issues/77732, but I have documented features that aren't implemented, like https://github.com/rust-lang/rust/issues/78800.

3 years agoRollup merge of #80189 - jyn514:convert-primitives, r=poliorcetics
Yuki Okushi [Tue, 2 Mar 2021 12:23:12 +0000 (21:23 +0900)]
Rollup merge of #80189 - jyn514:convert-primitives, r=poliorcetics

Convert primitives in the standard library to intra-doc links

Blocked on https://github.com/rust-lang/rust/pull/80181. I forgot that this needs to wait for the beta bump so the standard library can be documented with `doc --stage 0`.

Notably I didn't convert `core::slice` because it's like 50 links and I got scared :fearful:

3 years agoFix stabilization version of move_ref_pattern
Jonas Platte [Tue, 2 Mar 2021 11:54:25 +0000 (12:54 +0100)]
Fix stabilization version of move_ref_pattern

3 years agoFix UI errors
Erin Power [Tue, 2 Mar 2021 11:18:46 +0000 (12:18 +0100)]
Fix UI errors

3 years agoAuto merge of #82634 - osa1:osa1/remove_old_fixme, r=Mark-Simulacrum
bors [Tue, 2 Mar 2021 10:15:34 +0000 (10:15 +0000)]
Auto merge of #82634 - osa1:osa1/remove_old_fixme, r=Mark-Simulacrum

Remove an old FIXME comment and inline attribute

Apparently #35870 caused a problem in this code (which originally
returned an impl trait) and `#[inline]` was added as a workaround, in
ade79d76090.

The issue is now fixed and the comment and `#[inline]` can now be
removed.

3 years agoRevert non-power-of-two vector restriction
Erin Power [Tue, 2 Mar 2021 08:41:41 +0000 (09:41 +0100)]
Revert non-power-of-two vector restriction

3 years agoAuto merge of #82688 - GuillaumeGomez:rollup-b754t11, r=GuillaumeGomez
bors [Tue, 2 Mar 2021 05:21:25 +0000 (05:21 +0000)]
Auto merge of #82688 - GuillaumeGomez:rollup-b754t11, r=GuillaumeGomez

Rollup of 7 pull requests

Successful merges:

 - #80734 (check that first arg to `panic!()` in const is `&str`)
 - #81932 (Always compile rustdoc with debug logging enabled when `download-rustc` is set)
 - #82018 (Remove the dummy cache in `DocContext`; delete RenderInfo)
 - #82598 (Check stability and feature attributes in rustdoc)
 - #82655 (Highlight identifier span instead of whole pattern span in `unused` lint)
 - #82662 (Warn about unknown doc attributes)
 - #82676 (Change twice used large const table to static)

Failed merges:

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

3 years agometa: Notify Zulip for rustdoc nominated issues
Camelid [Tue, 2 Mar 2021 00:33:47 +0000 (16:33 -0800)]
meta: Notify Zulip for rustdoc nominated issues

The rustdoc team does not currently use the `I-nominated` label, unlike
the libs and compiler teams (and maybe others). One reason for this is
that the other teams discuss their nominated issues in meetings, while
rustdoc is an async-only team.

However, it might be helpful to start using the `I-nominated` label for
rustdoc. The team currently uses a `cc @rust-lang/rustdoc` ping as the
equivalent, but it's easier to track issues when they use `I-nominated`.
Also we'd be more consistent with the other teams' procedures.

Since rustdoc doesn't have meetings, I propose we instead use the
triagebot notify Zulip functionality to create a topic in `#rustdoc` on
Zulip and ping the team. So it would look a bit like the procedure for
WG-prioritization when an issue acquires the `I-prioritize` label.

3 years agoUpdate books
Eric Huss [Tue, 2 Mar 2021 02:00:56 +0000 (18:00 -0800)]
Update books

3 years agoTest that using the previous lint names still applies the lint
Joshua Nelson [Sun, 28 Feb 2021 05:49:15 +0000 (00:49 -0500)]
Test that using the previous lint names still applies the lint

3 years agoUpdate comments
Joshua Nelson [Tue, 19 Jan 2021 03:24:16 +0000 (22:24 -0500)]
Update comments

Note that the FIXME was removed because this can't be fixed,
`register_renamed` calls LintId::of and there's no LintId for rustdoc
lints when rustc is running.

3 years agoAddress review comments
Joshua Nelson [Mon, 18 Jan 2021 06:14:01 +0000 (01:14 -0500)]
Address review comments

- Move MISSING_CRATE_LEVEL_DOCS to rustdoc directly
- Update documentation

This also takes the opportunity to make the `no-crate-level-doc-lint`
test more specific.

3 years agoImprove error messages
Joshua Nelson [Sun, 17 Jan 2021 23:52:19 +0000 (18:52 -0500)]
Improve error messages

- Use `register_renamed` when rustdoc is running so the lint will still
  be active and use a structured suggestion
- Test the behavior for rustc, not just for rustdoc (because it differs)

3 years agoAdd `declare_rustdoc_lint!` macro
Joshua Nelson [Wed, 30 Dec 2020 19:17:18 +0000 (14:17 -0500)]
Add `declare_rustdoc_lint!` macro

3 years agoMove lint machinery into a separate file
Joshua Nelson [Wed, 30 Dec 2020 19:11:15 +0000 (14:11 -0500)]
Move lint machinery into a separate file

3 years agoRename rustdoc lints to be a tool lint instead of built-in.
Joshua Nelson [Wed, 30 Dec 2020 04:16:16 +0000 (23:16 -0500)]
Rename rustdoc lints to be a tool lint instead of built-in.

- Rename `broken_intra_doc_links` to `rustdoc::broken_intra_doc_links`
- Ensure that the old lint names still work and give deprecation errors
- Register lints even when running doctests

  Otherwise, all `rustdoc::` lints would be ignored.

- Register all existing lints as removed

  This unfortunately doesn't work with `register_renamed` because tool
  lints have not yet been registered when rustc is running. For similar
  reasons, `check_backwards_compat` doesn't work either. Call
  `register_removed` directly instead.

- Fix fallout

  + Rustdoc lints for compiler/
  + Rustdoc lints for library/

Note that this does *not* suggest `rustdoc::broken_intra_doc_links` for
`rustdoc::intra_doc_link_resolution_failure`, since there was no time
when the latter was valid.

3 years agoRollup merge of #82676 - dtolnay:powers, r=Mark-Simulacrum
Guillaume Gomez [Mon, 1 Mar 2021 23:50:11 +0000 (00:50 +0100)]
Rollup merge of #82676 - dtolnay:powers, r=Mark-Simulacrum

Change twice used large const table to static

This table is used twice in core::num::dec2flt::algorithm::power_of_ten. According to the semantics of const, a separate huge definition of the table is inlined at both places.

https://github.com/rust-lang/rust/blob/5233edcf1c7ee70ac25e4ec1115c3546f53d8a2d/library/core/src/num/dec2flt/algorithm.rs#L16-L22

Theoretically this gets cleaned up by optimization passes, but in practice I am experiencing a miscompile from LTO on this code. Making the table a static, which would only be defined a single time and not require attention from LTO, eliminates the miscompile and seems semantically more appropriate anyway. A separate bug report on the LTO bug is forthcoming.

Original addition of `const` is from #27307.

3 years agoRollup merge of #82662 - GuillaumeGomez:doc-attr-check, r=jyn514
Guillaume Gomez [Mon, 1 Mar 2021 23:50:10 +0000 (00:50 +0100)]
Rollup merge of #82662 - GuillaumeGomez:doc-attr-check, r=jyn514

Warn about unknown doc attributes

Fixes #82652.

For the text error, I decided to go for "invalid" instead of "unknown". What do you think?

r? `@jyn514`

3 years agoRollup merge of #82655 - SkiFire13:fix-issue-81314, r=estebank
Guillaume Gomez [Mon, 1 Mar 2021 23:50:09 +0000 (00:50 +0100)]
Rollup merge of #82655 - SkiFire13:fix-issue-81314, r=estebank

Highlight identifier span instead of whole pattern span in `unused` lint

Fixes #81314

This pretty much just changes the span highlighted in the lint from `pat_sp` to `ident.span`. There's however an exception, which is in patterns with shorthands like `Point { y, ref mut x }`, where a suggestion to change just `x` would be invalid; in those cases I had to keep the pattern span. Another option would be suggesting something like `Point { y, x: ref mut _x }`.

I also added a new test since there weren't any test that checked the `unused` lint with optional patterns.

3 years agoRollup merge of #82598 - GuillaumeGomez:rustdoc-rustc-pass, r=jyn514
Guillaume Gomez [Mon, 1 Mar 2021 23:50:08 +0000 (00:50 +0100)]
Rollup merge of #82598 - GuillaumeGomez:rustdoc-rustc-pass, r=jyn514

Check stability and feature attributes in rustdoc

Fixes #82588.

cc `@Nemo157` `@camelid`
r? `@jyn514`

3 years agoRollup merge of #82018 - jyn514:no-dummy-cache, r=camelid,GuillaumeGomez
Guillaume Gomez [Mon, 1 Mar 2021 23:50:07 +0000 (00:50 +0100)]
Rollup merge of #82018 - jyn514:no-dummy-cache, r=camelid,GuillaumeGomez

Remove the dummy cache in `DocContext`; delete RenderInfo

The same information is available everywhere; the only reason the dummy
cache was needed is because it was previously stored in three different
places. This consolidates the info a bit so the cache in `DocContext` is
used throughout. As a bonus, it also completely removes `RenderInfo`.

- Return a `Cache` from `run_global_ctxt`, not `RenderInfo`
- Remove the unused `render_info` from `run_renderer`
- Remove RenderInfo altogether

Helps with https://github.com/rust-lang/rust/pull/82014. The next step is to move the `populate()` call before the `collect_intra_doc_links` pass, which currently breaks because a) lots of the cache is populated in early passes, and b) intra_doc_links itself sets some info with `register_res`. I'm working on separate PR for that to avoid making too many big changes at once.

r? `@GuillaumeGomez`

3 years agoRollup merge of #81932 - jyn514:rustdoc-logging, r=Mark-Simulacrum
Guillaume Gomez [Mon, 1 Mar 2021 23:50:06 +0000 (00:50 +0100)]
Rollup merge of #81932 - jyn514:rustdoc-logging, r=Mark-Simulacrum

Always compile rustdoc with debug logging enabled when `download-rustc` is set

Previously, logging at DEBUG or below would always be silenced, because
rustc compiles tracing with the `static_max_level_info` feature. That
makes sense for release artifacts, but not for developing rustdoc.

Instead, this compiles two different versions of tracing: one in the
release artifacts, distributed in the sysroot, and a new version
compiled by rustdoc. Since `rustc_driver` is always linked to the
version of sysroot, this copy/pastes `init_env_logging` into rustdoc.

To avoid compiling an unnecessary version of tracing when
`download-rustc` isn't set, this adds a new `using-ci-artifacts`
feature for rustdoc and passes that feature in bootstrap.

Addresses https://github.com/rust-lang/rust/issues/81930. This builds on https://github.com/rust-lang/rust/pull/79540.

r? `@Mark-Simulacrum`

3 years agoRollup merge of #80734 - abonander:ab/issue-66693, r=oli-obk
Guillaume Gomez [Mon, 1 Mar 2021 23:50:04 +0000 (00:50 +0100)]
Rollup merge of #80734 - abonander:ab/issue-66693, r=oli-obk

check that first arg to `panic!()` in const is `&str`

closes #66693

~~TODO: regression test~~

cc `@RalfJung` for error message wording

3 years agoGet TyCtxt from self instead of passing as argument in AutoTraitFinder
Noam Koren [Sat, 27 Feb 2021 17:13:10 +0000 (19:13 +0200)]
Get TyCtxt from self instead of passing as argument in AutoTraitFinder
methods

3 years agoAuto merge of #82663 - jyn514:rollup-xh3cb0c, r=jyn514
bors [Mon, 1 Mar 2021 20:52:47 +0000 (20:52 +0000)]
Auto merge of #82663 - jyn514:rollup-xh3cb0c, r=jyn514

Rollup of 8 pull requests

Successful merges:

 - #81210 (BTreeMap: correct node size test case for choices of B)
 - #82360 (config.toml parsing error improvements)
 - #82428 (Update mdbook)
 - #82480 (Remove `ENABLE_DOWNLOAD_RUSTC` constant)
 - #82578 (Add some diagnostic items for Clippy)
 - #82620 (Apply lint restrictions from renamed lints)
 - #82635 (Fix typos in rustc_infer::infer::nll_relate)
 - #82645 (Clarify that SyncOnceCell::set blocks.)

Failed merges:

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

3 years agoAdd missing stability attributes in libstd
Guillaume Gomez [Sat, 27 Feb 2021 23:48:22 +0000 (00:48 +0100)]
Add missing stability attributes in libstd

3 years agoAdd tests for doc attribute check
Guillaume Gomez [Mon, 1 Mar 2021 16:13:06 +0000 (17:13 +0100)]
Add tests for doc attribute check

3 years agoValidate meta items used in \#\[doc(...)\]
Guillaume Gomez [Mon, 1 Mar 2021 16:12:39 +0000 (17:12 +0100)]
Validate meta items used in \#\[doc(...)\]

3 years agoChange twice used large const table to static
David Tolnay [Mon, 1 Mar 2021 07:51:30 +0000 (23:51 -0800)]
Change twice used large const table to static

This table is used twice in core::num::dec2flt::algorithm::power_of_ten.
According to the semantics of const, a separate huge definition of the
table is inlined at both places.

    fn power_of_ten(e: i16) -> Fp {
        assert!(e >= table::MIN_E);
        let i = e - table::MIN_E;
        let sig = table::POWERS.0[i as usize];
        let exp = table::POWERS.1[i as usize];
        Fp { f: sig, e: exp }
    }

Theoretically this gets cleaned up by optimization passes, but in
practice I am experiencing a miscompile from LTO on this code. Making
the table a static, which would only be defined a single time and not
require attention from LTO, eliminates the miscompile and seems
semantically more appropriate anyway. A separate bug report on the LTO
bug is forthcoming.

3 years agoAuto merge of #82587 - taiki-e:unaligned_references, r=oli-obk
bors [Mon, 1 Mar 2021 18:10:38 +0000 (18:10 +0000)]
Auto merge of #82587 - taiki-e:unaligned_references, r=oli-obk

Enable report_in_external_macro in unaligned_references

Fixes an issue where `unaligned_references` is not triggered in external macros, unlike `safe_packed_borrows`.
Also, given that this lint is planned to eventually change to hard error (#82525), it would make sense for this lint to be triggered for external macros as well.

See https://github.com/taiki-e/pin-project-lite/pull/55#issuecomment-787038676 and https://github.com/taiki-e/pin-project-lite/pull/55#issuecomment-787052874 for more.

r? `@RalfJung`

3 years agocheck that first arg to `panic!()` in const is `&str`
Austin Bonander [Tue, 5 Jan 2021 21:54:28 +0000 (13:54 -0800)]
check that first arg to `panic!()` in const is `&str`

3 years agoRollup merge of #82645 - rkjnsn:patch-3, r=Mark-Simulacrum
Joshua Nelson [Mon, 1 Mar 2021 16:25:11 +0000 (11:25 -0500)]
Rollup merge of #82645 - rkjnsn:patch-3, r=Mark-Simulacrum

Clarify that SyncOnceCell::set blocks.

Reading the discussion of this feature, I gained the mistaken impression that neither `set` nor `get` blocked, and thus calling `get` immediately after `set` was not guaranteed to succeed. It turns out that `set` *does* block, guaranteeing that the cell contains a value once `set` returns. This change updates the documentation to state that explicitly.

Happy to adjust the wording as desired.

3 years agoRollup merge of #82635 - pierwill:edit-infer, r=oli-obk
Joshua Nelson [Mon, 1 Mar 2021 16:25:10 +0000 (11:25 -0500)]
Rollup merge of #82635 - pierwill:edit-infer, r=oli-obk

Fix typos in rustc_infer::infer::nll_relate

3 years agoRollup merge of #82620 - jyn514:apply-renamed-lints, r=Manishearth
Joshua Nelson [Mon, 1 Mar 2021 16:25:08 +0000 (11:25 -0500)]
Rollup merge of #82620 - jyn514:apply-renamed-lints, r=Manishearth

Apply lint restrictions from renamed lints

Previously, if you denied the old name of a renamed lint, it would warn
about using the new name, but otherwise do nothing. Now, it will behave
the same as if you'd used the new name.

Fixes https://github.com/rust-lang/rust/issues/82615.

r? `@ehuss`

3 years agoRollup merge of #82578 - camsteffen:diag-items, r=oli-obk
Joshua Nelson [Mon, 1 Mar 2021 16:25:07 +0000 (11:25 -0500)]
Rollup merge of #82578 - camsteffen:diag-items, r=oli-obk

Add some diagnostic items for Clippy

3 years agoRollup merge of #82480 - jyn514:no-enable-constant, r=Mark-Simulacrum
Joshua Nelson [Mon, 1 Mar 2021 16:25:06 +0000 (11:25 -0500)]
Rollup merge of #82480 - jyn514:no-enable-constant, r=Mark-Simulacrum

Remove `ENABLE_DOWNLOAD_RUSTC` constant

`ENABLE_DOWNLOAD_RUSTC` was introduced as part of the MVP for `download-rustc` as a way not to rebuild artifacts that have already been downloaded. Unfortunately, it doesn't work very well:

- Steps are ignored by default, which makes it easy to leave out a step
that should be built. For example, the MVP forgot to enable any tests,
so it was only possible to *build* locally.
- It didn't work correctly even when it was enabled: calling
  `builder.ensure()` would completely ignore the constant and rebuild the
  step anyway. This has no obvious fix since `ensure()` has to return a
  `Step::Output`.

Instead, this handles `download-rustc` in `impl Step for Rustc` and
`impl Step for Std`, which to my knowledge are the only build steps that
don't first go through `impl Step for Sysroot` (`Rustc` is used for
the `rustc-dev` component).

See https://github.com/rust-lang/rust/pull/79540#discussion_r563350075 and https://github.com/rust-lang/rust/issues/81930 for further context.

Here are some example runs with these changes and `download-rustc`
enabled:

```
$ x.py build src/tools/clippy
Building stage1 tool clippy-driver (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 1m 09s
Building stage1 tool cargo-clippy (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.11s
$ x.py test src/tools/clippy
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
Building stage1 tool clippy-driver (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.09s
Building rustdoc for stage1 (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.28s
    Finished release [optimized] target(s) in 15.26s
     Running build/x86_64-unknown-linux-gnu/stage1-tools/x86_64-unknown-linux-gnu/release/deps/clippy_driver-8b407b140e0aa91c
test result: ok. 592 passed; 0 failed; 3 ignored; 0 measured; 0 filtered out
$ x.py build src/tools/rustdoc
Building rustdoc for stage1 (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 41.28s
Build completed successfully in 0:00:41
$ x.py test src/test/rustdoc-ui
Building stage0 tool compiletest (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.12s
Building rustdoc for stage1 (x86_64-unknown-linux-gnu)
    Finished release [optimized] target(s) in 0.10s
test result: ok. 105 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 8.15s
$ x.py build compiler/rustc
    Finished dev [unoptimized + debuginfo] target(s) in 0.09s
Build completed successfully in 0:00:00
```

Note a few things:

- Clippy depends on stage1 rustc-dev artifacts, but rustc didn't have to
  be recompiled. Instead, the artifacts were copied automatically.
- All steps are always enabled. There is no danger of forgetting a step,
  since only the entrypoints have to handle `download-rustc`.
- Building the compiler (`compiler/rustc`) automatically does no work.

Helps with https://github.com/rust-lang/rust/issues/81930.

r? `@Mark-Simulacrum`

3 years agoRollup merge of #82428 - ehuss:update-mdbook, r=Mark-Simulacrum
Joshua Nelson [Mon, 1 Mar 2021 16:25:05 +0000 (11:25 -0500)]
Rollup merge of #82428 - ehuss:update-mdbook, r=Mark-Simulacrum

Update mdbook

Changelog is here: https://github.com/rust-lang/mdBook/blob/master/CHANGELOG.md#mdbook-047

3 years agoRollup merge of #82360 - osa1:issue82317, r=Mark-Simulacrum
Joshua Nelson [Mon, 1 Mar 2021 16:25:03 +0000 (11:25 -0500)]
Rollup merge of #82360 - osa1:issue82317, r=Mark-Simulacrum

config.toml parsing error improvements

Improve error messages for musl-libdir and wasi-root keys. Previously
the parser would panic with `unwrap()`. Now it prints

      Target "wasm32-wasi" does not have a "wasi-root" key

(and similar for the `musl-libdir` field, which is used in target that
use musl)

Also update comments around wasi-root field to make it clear that the
field is only valid in wasm32-wasi target and needs to be moved to a
`[target.wasm32-wasi]` section to be valid.

Fixes #82317

---

r? `@Mark-Simulacrum`

3 years agoRollup merge of #81210 - ssomers:btree_fix_node_size_test, r=Mark-Simulacrum
Joshua Nelson [Mon, 1 Mar 2021 16:24:58 +0000 (11:24 -0500)]
Rollup merge of #81210 - ssomers:btree_fix_node_size_test, r=Mark-Simulacrum

BTreeMap: correct node size test case for choices of B

r? `@Mark-Simulacrum`

3 years ago:arrow_up: rust-analyzer
Laurențiu Nicola [Mon, 1 Mar 2021 16:04:48 +0000 (18:04 +0200)]
:arrow_up: rust-analyzer

3 years agoUse a crate to produce rustdoc tree comparisons instead of the `diff` command
Michael Howell [Wed, 24 Feb 2021 06:42:42 +0000 (23:42 -0700)]
Use a crate to produce rustdoc tree comparisons instead of the `diff` command

It doesn't exist on Windows, so we bring our own unified diff implementation.

Fixes #82409

3 years agoUse diagnostic items in into_iter_collections
Cameron Steffen [Sat, 27 Feb 2021 03:17:29 +0000 (21:17 -0600)]
Use diagnostic items in into_iter_collections

3 years agoAdd diagnostic items
Cameron Steffen [Sat, 27 Feb 2021 03:23:42 +0000 (21:23 -0600)]
Add diagnostic items