]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #75879 - pietroalbini:update-relnotes, r=Mark-Simulacrum
bors [Thu, 27 Aug 2020 05:29:43 +0000 (05:29 +0000)]
Auto merge of #75879 - pietroalbini:update-relnotes, r=Mark-Simulacrum

Include last-minute compatibility notes for 1.46.0

This cherry-picks the relnotes update of https://github.com/rust-lang/rust/pull/75878 on master.

r? @Mark-Simulacrum

3 years agoAuto merge of #75842 - camelid:highlight-crate-links, r=jyn514
bors [Thu, 27 Aug 2020 02:51:01 +0000 (02:51 +0000)]
Auto merge of #75842 - camelid:highlight-crate-links, r=jyn514

Highlight crate links like normal links

Fixes #75823.

Cc @jyn514

3 years agoAuto merge of #75966 - Dylan-DPC:rollup-srfpces, r=Dylan-DPC
bors [Thu, 27 Aug 2020 00:25:52 +0000 (00:25 +0000)]
Auto merge of #75966 - Dylan-DPC:rollup-srfpces, r=Dylan-DPC

Rollup of 10 pull requests

Successful merges:

 - #74730 (Hexagon libstd: update type defs)
 - #75758 (Fixes for VxWorks)
 - #75780 (Unconfuse Unpin docs a bit)
 - #75806 (Prevent automatic page change when using history)
 - #75818 (Update docs for SystemTime Windows implementation)
 - #75837 (Fix font color for help button in ayu and dark themes)
 - #75870 (Unify theme choices border color in ayu theme)
 - #75875 (Shorten liballoc vec resize intra-doc link)
 - #75953 (Fix swapped stability attributes for rustdoc lints)
 - #75958 (Avoid function-scoping global variables)

Failed merges:

r? @ghost

3 years agoRollup merge of #75958 - Mark-Simulacrum:fix-toolstate, r=kennytm
Dylan DPC [Wed, 26 Aug 2020 23:14:20 +0000 (01:14 +0200)]
Rollup merge of #75958 - Mark-Simulacrum:fix-toolstate, r=kennytm

Avoid function-scoping global variables

In 2e6f2e885506ee4, we added a main function to the publish_toolstate.py script.
Unfortunately, we missed that the Python program implicitly declares global
variables in that code, which means that adding a function changes variable
scoping and breaks other code.

This commit avoids introducing that function and adds a warning to future
editors of the code.

3 years agoRollup merge of #75953 - jyn514:missing-lints, r=Manishearth
Dylan DPC [Wed, 26 Aug 2020 23:14:18 +0000 (01:14 +0200)]
Rollup merge of #75953 - jyn514:missing-lints, r=Manishearth

Fix swapped stability attributes for rustdoc lints

This fixes a regression introduced in https://github.com/rust-lang/rust/pull/74855. Previously, `missing_doc_code_examples` would be run on stable and `private_doc_tests` would only be run on nightly. Now, it correctly does the reverse.
Closes https://github.com/rust-lang/rust/issues/75951.
r? @ehuss

3 years agoRollup merge of #75875 - pickfire:patch-4, r=jyn514
Dylan DPC [Wed, 26 Aug 2020 23:14:17 +0000 (01:14 +0200)]
Rollup merge of #75875 - pickfire:patch-4, r=jyn514

Shorten liballoc vec resize intra-doc link

r? @jyn514

3 years agoRollup merge of #75870 - GuillaumeGomez:unify-border-color-theme-ayu, r=pickfire
Dylan DPC [Wed, 26 Aug 2020 23:14:15 +0000 (01:14 +0200)]
Rollup merge of #75870 - GuillaumeGomez:unify-border-color-theme-ayu, r=pickfire

Unify theme choices border color in ayu theme

There was a slight color difference in the theme choice menu borders:

![Screenshot from 2020-08-24 10-37-05](https://user-images.githubusercontent.com/3050060/91022913-22654880-e5f6-11ea-8165-302b2d4e701e.png)
![Screenshot from 2020-08-24 10-37-58](https://user-images.githubusercontent.com/3050060/91022918-242f0c00-e5f6-11ea-989a-e26a28196d09.png)

r? @Cldfire

3 years agoRollup merge of #75837 - GuillaumeGomez:fix-font-color-help-button, r=Cldfire
Dylan DPC [Wed, 26 Aug 2020 23:14:13 +0000 (01:14 +0200)]
Rollup merge of #75837 - GuillaumeGomez:fix-font-color-help-button, r=Cldfire

Fix font color for help button in ayu and dark themes

A nice before/after:

![Screenshot from 2020-08-23 14-47-07](https://user-images.githubusercontent.com/3050060/90979230-0dd07400-e554-11ea-85f7-046dfca65e8e.png)

![Screenshot from 2020-08-23 14-47-03](https://user-images.githubusercontent.com/3050060/90979233-145eeb80-e554-11ea-8e63-1864c3f2699b.png)

For the ayu theme, the change is very "light", the font color was already close to white, so I unified the color with the pictures of the other buttons:

![Screenshot from 2020-08-23 15-20-45](https://user-images.githubusercontent.com/3050060/90979281-5e47d180-e554-11ea-9993-8595057481ab.png)
![Screenshot from 2020-08-23 15-20-50](https://user-images.githubusercontent.com/3050060/90979279-5daf3b00-e554-11ea-8d39-beb57091aba7.png)

3 years agoRollup merge of #75818 - ollie27:doc_systemtime_windows, r=retep998
Dylan DPC [Wed, 26 Aug 2020 23:14:11 +0000 (01:14 +0200)]
Rollup merge of #75818 - ollie27:doc_systemtime_windows, r=retep998

Update docs for SystemTime Windows implementation

Windows now uses `GetSystemTimePreciseAsFileTime` (since #69858) on versions of Windows that support it.

3 years agoRollup merge of #75806 - GuillaumeGomez:prevent-automatic-page-change-history, r...
Dylan DPC [Wed, 26 Aug 2020 23:14:08 +0000 (01:14 +0200)]
Rollup merge of #75806 - GuillaumeGomez:prevent-automatic-page-change-history, r=pickfire

Prevent automatic page change when using history

Fixes #75774.

3 years agoRollup merge of #75780 - matklad:unconfuseunpindocs, r=KodrAus
Dylan DPC [Wed, 26 Aug 2020 23:14:06 +0000 (01:14 +0200)]
Rollup merge of #75780 - matklad:unconfuseunpindocs, r=KodrAus

Unconfuse Unpin docs a bit

* Don't say that Unpin is used to prevent moves, because it is used
  to *allow* moves
* Be more precise about kindedness of things, it is
  `Pin<Pointer<Data>>`, rather than just `Pin<Pointer>`.

3 years agoRollup merge of #75758 - bpangWR:master, r=Mark-Simulacrum
Dylan DPC [Wed, 26 Aug 2020 23:14:04 +0000 (01:14 +0200)]
Rollup merge of #75758 - bpangWR:master, r=Mark-Simulacrum

Fixes for VxWorks

r? @alexcrichton

3 years agoRollup merge of #74730 - androm3da:fix_libstd_hexlinux_01, r=dtolnay
Dylan DPC [Wed, 26 Aug 2020 23:14:02 +0000 (01:14 +0200)]
Rollup merge of #74730 - androm3da:fix_libstd_hexlinux_01, r=dtolnay

Hexagon libstd: update type defs

3 years agoAuto merge of #75898 - lcnr:variant-def-recovered, r=petrochenkov
bors [Wed, 26 Aug 2020 22:28:48 +0000 (22:28 +0000)]
Auto merge of #75898 - lcnr:variant-def-recovered, r=petrochenkov

VariantDef: move `recovered` into `VariantFlags`

3 years agoAvoid function-scoping global variables
Mark Rousskov [Wed, 26 Aug 2020 21:22:13 +0000 (17:22 -0400)]
Avoid function-scoping global variables

In 2e6f2e885506ee4, we added a main function to the publish_toolstate.py script.
Unfortunately, we missed that the Python program implicitly declares global
variables in that code, which means that adding a function changes variable
scoping and breaks other code.

This commit avoids introducing that function and adds a warning to future
editors of the code.

3 years agoAuto merge of #75944 - jumbatm:issue-75924-clashing-extern-decl-ice, r=spastorino
bors [Wed, 26 Aug 2020 20:31:44 +0000 (20:31 +0000)]
Auto merge of #75944 - jumbatm:issue-75924-clashing-extern-decl-ice, r=spastorino

Fix ICE on unwrap of unknown layout in ClashingExternDeclarations.

Fixes #75924.

3 years agoFix swapped stability attributes
Joshua Nelson [Wed, 26 Aug 2020 19:13:57 +0000 (15:13 -0400)]
Fix swapped stability attributes

This fixes a regression introduced in
https://github.com/rust-lang/rust/pull/74855.

3 years agoAuto merge of #75912 - scottmcm:manuallydrop-vs-forget, r=Mark-Simulacrum
bors [Wed, 26 Aug 2020 18:40:51 +0000 (18:40 +0000)]
Auto merge of #75912 - scottmcm:manuallydrop-vs-forget, r=Mark-Simulacrum

Suggest `mem::forget` if `mem::ManuallyDrop::new` isn't used

I think this communicates the intent more idiomatically, and is shorter anyway.

Inspired because [it came up on URLO](https://users.rust-lang.org/t/validity-of-memory-area-after-std-forget/47730/7?u=scottmcm), and it turns out that std had done it too in one spot:
![image](https://user-images.githubusercontent.com/18526288/91203819-e19f2980-e6f2-11ea-9112-835f3b22ce05.png)

3 years agoAuto merge of #75903 - jyn514:lint-refactor, r=GuillaumeGomez
bors [Wed, 26 Aug 2020 16:38:58 +0000 (16:38 +0000)]
Auto merge of #75903 - jyn514:lint-refactor, r=GuillaumeGomez

Warn about unknown or renamed lints in rustdoc

Fixes https://github.com/rust-lang/rust/issues/75884.
This is best reviewed one commit at a time.
r? @GuillaumeGomez

Originally I tried to do a much broader refactoring that got rid of `init_lints` altogether. My reasoning is that now the lints aren't being run anymore (after https://github.com/rust-lang/rust/pull/73566), there's no need to ignore them explicitly. But it seems there are still some lints that aren't affected by setting `lint_mod` to a no-op:

```
deny(pub_use_of_private_extern_crate)
deny(const_err)
warn(unused_imports)
```

(there are possibly more, these are just the ones that failed in the rustdoc test suite).

Some of these seem like we really should be warning about, but that's a much larger change and I don't propose to make it here. So for the time being, this just adds the `unknown_lints` and `renamed_or_removed_lints` passes to the list of lints rustdoc warns about.

3 years agoFix ICE on unwrap of unknown layout.
jumbatm [Wed, 26 Aug 2020 13:32:57 +0000 (23:32 +1000)]
Fix ICE on unwrap of unknown layout.

3 years agoAuto merge of #75893 - Dylan-DPC:fix/offset-to-u64, r=oli-obk
bors [Wed, 26 Aug 2020 13:10:42 +0000 (13:10 +0000)]
Auto merge of #75893 - Dylan-DPC:fix/offset-to-u64, r=oli-obk

change offset from u32 to u64

References #71696

r? @oli-obk

(closed the earlier pr because the rebase got messed up)

3 years agoAuto merge of #75687 - TimDiekmann:realloc-align, r=Amanieu
bors [Wed, 26 Aug 2020 10:44:28 +0000 (10:44 +0000)]
Auto merge of #75687 - TimDiekmann:realloc-align, r=Amanieu

Allow reallocation to different alignment in `AllocRef`

The allocator-wg [has decided](https://github.com/rust-lang/wg-allocators/issues/5#issuecomment-672591112) to support reallocating to a different alignment in `AllocRef`. For more details please see the linked issue.

r? @Amanieu

closes https://github.com/rust-lang/wg-allocators/issues/5

3 years agoAuto merge of #75843 - hermitcore:devel, r=nagisa
bors [Wed, 26 Aug 2020 03:47:07 +0000 (03:47 +0000)]
Auto merge of #75843 - hermitcore:devel, r=nagisa

HermitCore switchs to relocatable binaries

- switch to relocatbale binaries to realize ASLR
- remove all dependencies to gcc

3 years agoAuto merge of #75811 - ecstatic-morse:better-dlerror, r=nagisa
bors [Wed, 26 Aug 2020 01:40:26 +0000 (01:40 +0000)]
Auto merge of #75811 - ecstatic-morse:better-dlerror, r=nagisa

Refactor dynamic library error checking on *nix

The old code was checking `dlerror` more often than necessary, since (unlike `dlsym`) checking the return value of [`dlopen`](https://www.man7.org/linux/man-pages/man3/dlopen.3.html) is enough to indicate whether an error occurred. In the first commit, I've refactored the code to minimize the number of system calls needed. It should be strictly better than the old version.

The second commit is an optional addendum which fixes the issue observed on illumos in #74469, a PR I reviewed that was ultimately closed due to inactivity. I'm not sure how hard we try to work around platform-specific bugs like this, and I believe that, due to the way that `dlerror` is specified in the POSIX standard, libc implementations that want to run on conforming systems cannot call `dlsym` in multi-threaded programs.

3 years agoAuto merge of #75302 - Aaron1011:feature/partial-move-diag, r=estebank
bors [Tue, 25 Aug 2020 20:54:59 +0000 (20:54 +0000)]
Auto merge of #75302 - Aaron1011:feature/partial-move-diag, r=estebank

Be consistent when describing a move as a 'partial' in diagnostics

When an error occurs due to a partial move, we would use the world
"partial" in some parts of the error message, but not in others. This
commit ensures that we use the word 'partial' in either all or none of
the diagnostic messages.

Additionally, we no longer describe a move out of a `Box` via `*` as
a 'partial move'. This was a pre-existing issue, but became more
noticable when the word 'partial' is used in more places.

3 years agoExplicitly pass `RTLD_LOCAL` to `dlopen`
Dylan MacKenzie [Tue, 25 Aug 2020 19:11:30 +0000 (12:11 -0700)]
Explicitly pass `RTLD_LOCAL` to `dlopen`

This happens to be the default on Linux, but the default is unspecified
in the POSIX standard. Also switches to `cast` to keep line lengths in
check.

3 years agoFor VxWorks:
Pang, Baoshan [Fri, 7 Aug 2020 23:55:15 +0000 (16:55 -0700)]
For VxWorks:
fix building errors
use wr-c++ as linker

3 years agoAlways treat `dlsym` returning NULL as an error
Dylan MacKenzie [Tue, 25 Aug 2020 19:02:21 +0000 (12:02 -0700)]
Always treat `dlsym` returning NULL as an error

This simplifies the code somewhat. Also updates comments to reflect
notes from reviw about thread-safety of `dlerror`.

3 years agoAuto merge of #74275 - wesleywiser:break_up_partitioning_rs, r=pnkfelix
bors [Tue, 25 Aug 2020 18:52:11 +0000 (18:52 +0000)]
Auto merge of #74275 - wesleywiser:break_up_partitioning_rs, r=pnkfelix

Refactor the partitioning module to make it easier to introduce new algorithms

I've split the `librustc_mir::monomorphize::partitioning` module into a few files and introduced a `Partitioner` trait which allows us to decouple the partitioning algorithm from the code which integrates it into the query system. This should allow us to introduce new partitioning algorithms much more easily. I've also gone ahead and added a `-Z` flag to control which algorithm is used (currently there is only the `default`).

I left a few comments in places where things might be improved further.

r? @pnkfelix cc @rust-lang/wg-incr-comp

3 years agoSuggest `mem::forget` if `mem::ManuallyDrop::new` isn't used
Scott McMurray [Tue, 25 Aug 2020 16:40:53 +0000 (09:40 -0700)]
Suggest `mem::forget` if `mem::ManuallyDrop::new` isn't used

I think this communicates the intent better, and is shorter anyway.

3 years agoAuto merge of #75908 - pietroalbini:ci-bump-llvm, r=Mark-Simulacrum
bors [Tue, 25 Aug 2020 15:44:03 +0000 (15:44 +0000)]
Auto merge of #75908 - pietroalbini:ci-bump-llvm, r=Mark-Simulacrum

Bump LLVM on CI to 10.0.0

This PR bumps the LLVM version we use on our macOS and Windows CI to 10.0.0, fixing a breakage we noticed today:

```
2020-08-25T14:24:28.5939568Z FAILED: lib/Support/CMakeFiles/LLVMSupport.dir/AMDGPUMetadata.cpp.obj
2020-08-25T14:24:28.5940317Z D:\a\rust\rust\build\bootstrap\debug\sccache-plus-cl.exe  /nologo -TP -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib\Support -ID:\a\rust\rust\src\llvm-project\llvm\lib\Support -Iinclude -ID:\a\rust\rust\src\llvm-project\llvm\include -nologo -MT -Brepro --target=x86_64-pc-windows-msvc /Zc:inline /Zc:strictStrings /Oi /Zc:rvalueCast /Brepro /W4  -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wno-noexcept-type -Wno-comment /Gw /MT /O2 /Ob2 -UNDEBUG -std:c++14  /EHs-c- /GR- /showIncludes /Folib\Support\CMakeFiles\LLVMSupport.dir\AMDGPUMetadata.cpp.obj /Fdlib\Support\CMakeFiles\LLVMSupport.dir\LLVMSupport.pdb -c D:\a\rust\rust\src\llvm-project\llvm\lib\Support\AMDGPUMetadata.cpp
2020-08-25T14:24:28.5940861Z clang-cl: warning: argument unused during compilation: '-Brepro' [-Wunused-command-line-argument]
2020-08-25T14:24:28.5941076Z clang-cl: warning: argument unused during compilation: '-Brepro' [-Wunused-command-line-argument]
2020-08-25T14:24:28.5941321Z In file included from D:\a\rust\rust\src\llvm-project\llvm\lib\Support\AMDGPUMetadata.cpp:15:
2020-08-25T14:24:28.5941545Z In file included from D:\a\rust\rust\src\llvm-project\llvm\include\llvm/ADT/Twine.h:12:
2020-08-25T14:24:28.5941774Z In file included from D:\a\rust\rust\src\llvm-project\llvm\include\llvm/ADT/SmallVector.h:16:
2020-08-25T14:24:28.5942016Z In file included from D:\a\rust\rust\src\llvm-project\llvm\include\llvm/ADT/iterator_range.h:21:
2020-08-25T14:24:28.5942257Z In file included from C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.27.29110\include\iterator:9:
2020-08-25T14:24:28.5942542Z C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.27.29110\include\yvals_core.h(494,2): error: STL1000: Unexpected compiler version, expected Clang 10.0.0 or newer.
```

I uploaded both the new tarballs to our mirrors bucket.

3 years agoci: fix macOS target name for LLVM 10
Pietro Albini [Tue, 25 Aug 2020 15:41:50 +0000 (17:41 +0200)]
ci: fix macOS target name for LLVM 10

3 years agoci: bump LLVM source tarball on Linux to 10.0.0
Pietro Albini [Tue, 25 Aug 2020 15:27:43 +0000 (17:27 +0200)]
ci: bump LLVM source tarball on Linux to 10.0.0

3 years agoci: bump prebuilt LLVM on macOS and Windows to 10.0.0
Pietro Albini [Tue, 25 Aug 2020 15:19:41 +0000 (17:19 +0200)]
ci: bump prebuilt LLVM on macOS and Windows to 10.0.0

3 years agoDon't special case `warnings`
Joshua Nelson [Tue, 25 Aug 2020 14:42:24 +0000 (10:42 -0400)]
Don't special case `warnings`

3 years agoWarn about unknown or renamed lints
Joshua Nelson [Tue, 25 Aug 2020 14:02:16 +0000 (10:02 -0400)]
Warn about unknown or renamed lints

Originally I tried to do a much broader refactoring that got rid of `init_lints` altogether. My reasoning is that now the lints aren't being run anymore (after https://github.com/rust-lang/rust/pull/73566), there's no need to ignore them explicitly. But it seems there are still some lints that aren't affected by setting `lint_mod` to a no-op:

```
deny(pub_use_of_private_extern_crate)
deny(const_err)
warn(unused_imports)
```

(there are possibly more, these are just the ones that failed in the rustdoc test suite).

Some of these seem like we really should be warning about, but that's a much larger change and I don't propose to make it here. So for the time being, this just adds the `unknown_lints` and `renamed_or_removed_lints` passes to the list of lints rustdoc warns about.

3 years agoRename debugging_options -> debugging_opts to match rustc
Joshua Nelson [Tue, 25 Aug 2020 13:22:26 +0000 (09:22 -0400)]
Rename debugging_options -> debugging_opts to match rustc

This way the rustdoc field names are the same as the rustc field names.

3 years agoMinor refactors
Joshua Nelson [Tue, 25 Aug 2020 13:18:57 +0000 (09:18 -0400)]
Minor refactors

3 years agoAuto merge of #75838 - mati865:profiler-atomics, r=Amanieu
bors [Tue, 25 Aug 2020 11:53:07 +0000 (11:53 +0000)]
Auto merge of #75838 - mati865:profiler-atomics, r=Amanieu

Profiler: reenable atomics after #65214

3 years agoVariantDef: move recovered into VariantFlags
Bastian Kauschke [Tue, 25 Aug 2020 09:50:36 +0000 (11:50 +0200)]
VariantDef: move recovered into VariantFlags

3 years agoAuto merge of #75773 - matklad:snapshot-tests, r=Mark-Simulacrum
bors [Tue, 25 Aug 2020 09:36:23 +0000 (09:36 +0000)]
Auto merge of #75773 - matklad:snapshot-tests, r=Mark-Simulacrum

Introduce expect snapshot testing library into rustc

Snapshot testing is a technique for writing maintainable unit tests.
Unlike usual `assert_eq!` tests, snapshot tests allow
to *automatically* upgrade expected values on test failure.
In a sense, snapshot tests are inline-version of our beloved
UI-tests.

Example:

![expect](https://user-images.githubusercontent.com/1711539/90888810-3bcc8180-e3b7-11ea-9626-d06e89e1a0bb.gif)

A particular library we use, `expect_test` provides an `expect!`
macro, which creates a sort of self-updating string literal (by using
`file!` macro). Self-update is triggered by setting `UPDATE_EXPECT`
environmental variable (this info is printed during the test failure).
This library was extracted from rust-analyzer, where we use it for
most of our tests.

There are some other, more popular snapshot testing libraries:

* https://github.com/mitsuhiko/insta
* https://github.com/aaronabramov/k9

The main differences of `expect` are:

* first-class snapshot objects (so, tests can be written as functions,
  rather than as macros)
* focus on inline-snapshots (but file snapshots are also supported)
* restricted feature set (only `assert_eq` and `assert_debug_eq`)
* no extra runtime (ie, no `cargo insta`)

See rust-analyzer/rust-analyzer#5101 for a
an extended comparison.

It is unclear if this testing style will stick with rustc in the long
run. At the moment, rustc is mainly tested via integrated UI tests.
But in the library-ified world, unit-tests will become somewhat more
important (that's why use use `rustc_lexer` library-ified library as
an example in this PR). Given that the cost of removal shouldn't be
too high, it probably makes sense to just see if this flies!

3 years agoAuto merge of #75364 - rylev:libpanic-abort-failfast, r=alexcrichton
bors [Tue, 25 Aug 2020 07:36:52 +0000 (07:36 +0000)]
Auto merge of #75364 - rylev:libpanic-abort-failfast, r=alexcrichton

Call into fastfail on abort in libpanic_abort on Windows x86(_64)

This partially resolves #73215 though this is only for x86 targets. This code is directly lifted from [libstd](https://github.com/rust-lang/rust/blob/13290e83a6e20f3b408d177a9d64d8cf98fe4615/library/std/src/sys/windows/mod.rs#L315). `__fastfail` is the preferred way to abort a process on Windows as it will hook into debugger toolchains.

Other platforms expose a `_rust_abort` symbol which wraps `std::sys::abort_internal`. This would also work on Windows, but is a slightly largely change as we'd need to make sure that the symbol is properly exposed to the linker. I'm inlining the call to the `__fastfail`, but the indirection through `rust_abort` might be a cleaner approach.

 A different instruction must be used on ARM architectures. I'd like to verify this works first before tackling ARM.

3 years agoAuto merge of #75132 - scottmcm:stabilize-range-is-empty, r=dtolnay
bors [Tue, 25 Aug 2020 05:24:30 +0000 (05:24 +0000)]
Auto merge of #75132 - scottmcm:stabilize-range-is-empty, r=dtolnay

Stabilize Range[Inclusive]::is_empty

I would like to propose these two simple methods for stabilization:
- Knowing that a range is exhausted isn't otherwise trivial
- Clippy would like to suggest them, but had to do extra work to disable that path <https://github.com/rust-lang/rust-clippy/issues/3807> because they're unstable
- These work on `PartialOrd`, consistently with the stable `contains` method, and are thus more general than iterator-based approaches that need `Step`
- They've been unchanged for some time, and have picked up uses in the compiler
- Stabilizing them doesn't block any future iterator-based `is_empty` plans, as these inherent ones are preferred in name resolution

https://doc.rust-lang.org/nightly/std/ops/struct.Range.html#method.is_empty
https://doc.rust-lang.org/nightly/std/ops/struct.RangeInclusive.html#method.is_empty

Closes #48111

3 years agoAuto merge of #75764 - workingjubilee:tidy-up-cargo-metadata, r=Mark-Simulacrum
bors [Tue, 25 Aug 2020 03:33:10 +0000 (03:33 +0000)]
Auto merge of #75764 - workingjubilee:tidy-up-cargo-metadata, r=Mark-Simulacrum

bump tidy to cargo_metadata 0.11

Updates cargo_metadata in tidy's Cargo.toml from 0.9.1 to 0.11
Real version change 0.9.11 -> 0.11.1
https://github.com/oli-obk/cargo_metadata/compare/v0.9.1...v0.11.1

3 years agotidy
DPC [Tue, 25 Aug 2020 01:21:31 +0000 (03:21 +0200)]
tidy

3 years agoAuto merge of #75666 - davidtwco:tidy-lang-items, r=varkor
bors [Tue, 25 Aug 2020 01:06:16 +0000 (01:06 +0000)]
Auto merge of #75666 - davidtwco:tidy-lang-items, r=varkor

hir: consistent use and naming of lang items

This PR adjusts the naming of various lang items so that they are consistent and don't include prefixes containing the target or "LangItem". In addition, lang item variants are no longer exported from the `lang_items` module.

This is certainly subjective and while I think this is an improvement, if many in the team don't then we can just close this.

3 years agocleanup
DPC [Tue, 25 Aug 2020 01:00:27 +0000 (03:00 +0200)]
cleanup

3 years agoUnbreak the clippy test
Scott McMurray [Mon, 24 Aug 2020 21:28:01 +0000 (14:28 -0700)]
Unbreak the clippy test

3 years agoAuto merge of #75625 - mati865:mingw-cross-compile, r=Mark-Simulacrum
bors [Mon, 24 Aug 2020 23:07:41 +0000 (23:07 +0000)]
Auto merge of #75625 - mati865:mingw-cross-compile, r=Mark-Simulacrum

Fix windows-gnu host cross-compilation

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

Also turns out it's faster to run Linux virtual machine on Windows and cross-compile `./x.py dist` than doing it on Windows directly...

3 years agoremoved not-needed conversion
DPC [Mon, 24 Aug 2020 22:59:07 +0000 (00:59 +0200)]
removed not-needed conversion

3 years agoStabilize Range[Inclusive]::is_empty
Scott McMurray [Tue, 4 Aug 2020 06:18:34 +0000 (23:18 -0700)]
Stabilize Range[Inclusive]::is_empty

I would like to propose these two simple methods for stabilization:
- Knowing that a range is exhaused isn't otherwise trivial
- Clippy would like to suggest them, but had to do extra work to disable that path <https://github.com/rust-lang/rust-clippy/issues/3807> because they're unstable
- These work on `PartialOrd`, consistently with now-stable `contains`, and are thus more general than iterator-based approaches that need `Step`
- They've been unchanged for some time, and have picked up uses in the compiler
- Stabilizing them doesn't block any future iterator-based is_empty plans, as the inherent ones are preferred in name resolution

3 years agoAuto merge of #75110 - lzutao:ip-endianness, r=Mark-Simulacrum
bors [Mon, 24 Aug 2020 20:05:32 +0000 (20:05 +0000)]
Auto merge of #75110 - lzutao:ip-endianness, r=Mark-Simulacrum

Minor changes to Ipv4Addr

Minor changes to Ipv4Addr

* Impl IntoInner rather than AsInner for Ipv4Addr
* Add some comments
* Add test to show endiannes of Ipv4Addr display

3 years agoAuto merge of #75876 - matklad:rust-analyzer-2020-08-24, r=matklad
bors [Mon, 24 Aug 2020 17:11:50 +0000 (17:11 +0000)]
Auto merge of #75876 - matklad:rust-analyzer-2020-08-24, r=matklad

:arrow_up: rust-analyzer

r? @ghost

3 years agoreleases: include last-minute compatibility notes for 1.46.0
Pietro Albini [Mon, 24 Aug 2020 13:57:21 +0000 (15:57 +0200)]
releases: include last-minute compatibility notes for 1.46.0

3 years agoIntroduce expect snapshot testing library into rustc
Aleksey Kladov [Fri, 21 Aug 2020 12:03:50 +0000 (14:03 +0200)]
Introduce expect snapshot testing library into rustc

Snapshot testing is a technique for writing maintainable unit tests.
Unlike usual `assert_eq!` tests, snapshot tests allow
to *automatically* upgrade expected values on test failure.
In a sense, snapshot tests are inline-version of our beloved
UI-tests.

Example:

![expect](https://user-images.githubusercontent.com/1711539/90888810-3bcc8180-e3b7-11ea-9626-d06e89e1a0bb.gif)

A particular library we use, `expect_test` provides an `expect!`
macro, which creates a sort of self-updating string literal (by using
`file!` macro). Self-update is triggered by setting `UPDATE_EXPECT`
environmental variable (this info is printed during the test failure).
This library was extracted from rust-analyzer, where we use it for
most of our tests.

There are some other, more popular snapshot testing libraries:

* https://github.com/mitsuhiko/insta
* https://github.com/aaronabramov/k9

The main differences of `expect` are:

* first-class snapshot objects (so, tests can be written as functions,
  rather than as macros)
* focus on inline-snapshots (but file snapshots are also supported)
* restricted feature set (only `assert_eq` and `assert_debug_eq`)
* no extra runtime (ie, no `cargo insta`)

See https://github.com/rust-analyzer/rust-analyzer/pull/5101 for a
an extended comparison.

It is unclear if this testing style will stick with rustc in the long
run. At the moment, rustc is mainly tested via integrated UI tests.
But in the library-ified world, unit-tests will become somewhat more
important (that's why use use `rustc_lexer` library-ified library as
an example in this PR). Given that the cost of removal shouldn't be
too high, it probably makes sense to just see if this flies!

3 years ago:arrow_up: rust-analyzer
Aleksey Kladov [Mon, 24 Aug 2020 13:11:47 +0000 (15:11 +0200)]
:arrow_up: rust-analyzer

3 years agoAuto merge of #74590 - jyn514:timing, r=Mark-Simulacrum
bors [Mon, 24 Aug 2020 12:54:39 +0000 (12:54 +0000)]
Auto merge of #74590 - jyn514:timing, r=Mark-Simulacrum

Add some timing info to rustdoc

There are various improvements, but the main one is to time each pass
that rustdoc performs (`rustdoc::passes`).

Before, these were the top five timings for `cargo doc` on the cargo
repository:

```
+---------------------------------+-----------+-----------------+----------+------------+
| Item                            | Self time | % of total time | Time     | Item count |
+---------------------------------+-----------+-----------------+----------+------------+
| <unknown>                       | 854.70ms  | 20.888          | 2.47s    | 744823     |
+---------------------------------+-----------+-----------------+----------+------------+
| expand_crate                    | 795.29ms  | 19.436          | 848.00ms | 1          |
+---------------------------------+-----------+-----------------+----------+------------+
| metadata_decode_entry           | 256.73ms  | 6.274           | 279.49ms | 518344     |
+---------------------------------+-----------+-----------------+----------+------------+
| resolve_crate                   | 240.56ms  | 5.879           | 242.86ms | 1          |
+---------------------------------+-----------+-----------------+----------+------------+
| hir_lowering                    | 146.79ms  | 3.587           | 146.79ms | 1          |
+---------------------------------+-----------+-----------------+----------+------------+
```

Now the timings are:

```
+---------------------------------+-----------+-----------------+----------+------------+
| Item                            | Self time | % of total time | Time     | Item count |
+---------------------------------+-----------+-----------------+----------+------------+
| <unknown>                       | 1.40s     | 22.662          | 3.73s    | 771430     |
+---------------------------------+-----------+-----------------+----------+------------+
| collect-trait-impls             | 1.34s     | 21.672          | 2.87s    | 1          |
+---------------------------------+-----------+-----------------+----------+------------+
| expand_crate                    | 1.21s     | 19.577          | 1.28s    | 1          |
+---------------------------------+-----------+-----------------+----------+------------+
| build extern trait impl         | 704.66ms  | 11.427          | 1.07s    | 21893      |
+---------------------------------+-----------+-----------------+----------+------------+
| metadata_decode_entry           | 354.84ms  | 5.754           | 391.81ms | 544919     |
+---------------------------------+-----------+-----------------+----------+------------+
```

The goal is to help me debug regressions like https://github.com/rust-lang/rust/pull/74518#issuecomment-661498214 (currently I have _no_ idea what could have gone wrong).

r? @eddyb or @Mark-Simulacrum

3 years agoShorten liballoc vec resize intra-doc link
Ivan Tham [Mon, 24 Aug 2020 12:52:41 +0000 (20:52 +0800)]
Shorten liballoc vec resize intra-doc link

3 years agoUnconfuse Unpin docs a bit
Aleksey Kladov [Fri, 21 Aug 2020 17:48:29 +0000 (19:48 +0200)]
Unconfuse Unpin docs a bit

* Don't say that Unpin is used to prevent moves, because it is used
  to *allow* moves
* Be more precise about kindedness of things, it is
  `Pin<Pointer<Data>>`, rather than just `Pin<Pointer>`.

3 years agohir: consistent use and naming of lang items
David Wood [Tue, 18 Aug 2020 10:47:27 +0000 (11:47 +0100)]
hir: consistent use and naming of lang items

This commit adjusts the naming of various lang items so that they are
consistent and don't include prefixes containing the target or
"LangItem". In addition, lang item variants are no longer exported from
the `lang_items` module.

Signed-off-by: David Wood <david@davidtw.co>
3 years agoAdd explanations on the results search element check
Guillaume Gomez [Mon, 24 Aug 2020 10:59:16 +0000 (12:59 +0200)]
Add explanations on the results search element check

3 years agoAuto merge of #75815 - jyn514:ambiguous-primitives, r=guillaumegomez
bors [Mon, 24 Aug 2020 10:29:29 +0000 (10:29 +0000)]
Auto merge of #75815 - jyn514:ambiguous-primitives, r=guillaumegomez

Report an ambiguity if both modules and primitives are in scope for intra-doc links

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

- Add a new `prim@` disambiguator, since both modules and primitives are in the same namespace
- Refactor `report_ambiguity` into a closure

Additionally, I noticed that rustdoc would previously allow `[struct@char]` if `char` resolved to a primitive (not if it had a DefId). I fixed that and added a test case.

I also need to update libstd to use `prim@char` instead of `type@char`. If possible I would also like to refactor `ambiguity_error` to use `Disambiguator` instead of its own hand-rolled match - that ran into issues with `prim@` (I updated one and not the other) and it would be better for them to be in sync.

3 years agoUnify theme choices border color in ayu theme
Guillaume Gomez [Mon, 24 Aug 2020 08:38:28 +0000 (10:38 +0200)]
Unify theme choices border color in ayu theme

3 years agoAuto merge of #75505 - Dylan-DPC:feature/arc_new, r=KodrAus
bors [Mon, 24 Aug 2020 08:26:59 +0000 (08:26 +0000)]
Auto merge of #75505 - Dylan-DPC:feature/arc_new, r=KodrAus

Add Arc::new_cyclic

Rework of #72443

References #75861

cc @Diggsey @RalfJung

r? @KodrAus

3 years agoAuto merge of #75855 - jyn514:no-cfg-doc, r=ollie27
bors [Mon, 24 Aug 2020 06:05:00 +0000 (06:05 +0000)]
Auto merge of #75855 - jyn514:no-cfg-doc, r=ollie27

Use allow(unused_imports) instead of cfg(doc) for imports used only for intra-doc links

This prevents links from breaking when items are re-exported in a
different crate and the original isn't being documented.

Spotted in https://github.com/rust-lang/rust/pull/75832#discussion_r475275837 (thanks ollie!)

r? @ollie27

3 years agoAuto merge of #75865 - JohnTitor:rollup-yxia6d2, r=JohnTitor
bors [Mon, 24 Aug 2020 04:10:54 +0000 (04:10 +0000)]
Auto merge of #75865 - JohnTitor:rollup-yxia6d2, r=JohnTitor

Rollup of 10 pull requests

Successful merges:

 - #75819 (Use intra-doc-links in `core::{char, macros, fmt}`)
 - #75821 (Switch to intra-doc links in `std::macros`)
 - #75825 (Fix typo in documentation of i32 wrapping_abs())
 - #75826 (Corrected Misleading documentation for derived Ord/PartialOrd implementation )
 - #75831 (doc: Prefer https link for wikipedia URLs)
 - #75844 (publish-toolstate: show more context on HTTP error)
 - #75847 (Switch to intra-doc links in `std::collections`)
 - #75851 (Switch to intra-doc links in `core::array`)
 - #75856 (more tool clippy fixes)
 - #75859 (doc: Fix typo in std::process::Child documentation)

Failed merges:

r? @ghost

3 years agoDon't import atomics unless supported by the platform
Joshua Nelson [Mon, 24 Aug 2020 03:11:47 +0000 (23:11 -0400)]
Don't import atomics unless supported by the platform

3 years agoFix bad rebase
Joshua Nelson [Mon, 24 Aug 2020 02:57:47 +0000 (22:57 -0400)]
Fix bad rebase

Had to use -Xignore-whitespace-conflicts to avoid awful conflicts, but
that threw off the indentation

3 years agoUse underscores instead of spaces
Joshua Nelson [Tue, 18 Aug 2020 20:49:37 +0000 (16:49 -0400)]
Use underscores instead of spaces

3 years agoTime how long it takes to render HTML
Joshua Nelson [Sun, 16 Aug 2020 22:41:13 +0000 (18:41 -0400)]
Time how long it takes to render HTML

3 years agoxpy fmt
Joshua Nelson [Sun, 16 Aug 2020 21:56:02 +0000 (17:56 -0400)]
xpy fmt

3 years agoTime running the global context
Joshua Nelson [Sun, 16 Aug 2020 21:41:25 +0000 (17:41 -0400)]
Time running the global context

3 years agoSeparate `run_global_ctxt` into a separate function
Joshua Nelson [Sun, 16 Aug 2020 21:40:47 +0000 (17:40 -0400)]
Separate `run_global_ctxt` into a separate function

3 years agoRemove redundant timing for query
Joshua Nelson [Sun, 16 Aug 2020 21:30:27 +0000 (17:30 -0400)]
Remove redundant timing for query

3 years agoTime loading all crates, not each individual crate
Joshua Nelson [Sun, 16 Aug 2020 21:29:53 +0000 (17:29 -0400)]
Time loading all crates, not each individual crate

3 years agoAdd some timing info to rustdoc
Joshua Nelson [Thu, 16 Jul 2020 13:02:41 +0000 (09:02 -0400)]
Add some timing info to rustdoc

There are various improvements, but the main one is to time each pass
that rustdoc performs (`rustdoc::passes`).

Before, these were the top five timings for `cargo doc` on the cargo
repository:

```
+---------------------------------+-----------+-----------------+----------+------------+
| Item                            | Self time | % of total time | Time     | Item count |
+---------------------------------+-----------+-----------------+----------+------------+
| <unknown>                       | 854.70ms  | 20.888          | 2.47s    | 744823     |
+---------------------------------+-----------+-----------------+----------+------------+
| expand_crate                    | 795.29ms  | 19.436          | 848.00ms | 1          |
+---------------------------------+-----------+-----------------+----------+------------+
| metadata_decode_entry           | 256.73ms  | 6.274           | 279.49ms | 518344     |
+---------------------------------+-----------+-----------------+----------+------------+
| resolve_crate                   | 240.56ms  | 5.879           | 242.86ms | 1          |
+---------------------------------+-----------+-----------------+----------+------------+
| hir_lowering                    | 146.79ms  | 3.587           | 146.79ms | 1          |
+---------------------------------+-----------+-----------------+----------+------------+
```

Now the timings are:

```
+---------------------------------+-----------+-----------------+----------+------------+
| Item                            | Self time | % of total time | Time     | Item count |
+---------------------------------+-----------+-----------------+----------+------------+
| <unknown>                       | 1.40s     | 22.662          | 3.73s    | 771430     |
+---------------------------------+-----------+-----------------+----------+------------+
| collect-trait-impls             | 1.34s     | 21.672          | 2.87s    | 1          |
+---------------------------------+-----------+-----------------+----------+------------+
| expand_crate                    | 1.21s     | 19.577          | 1.28s    | 1          |
+---------------------------------+-----------+-----------------+----------+------------+
| build extern trait impl         | 704.66ms  | 11.427          | 1.07s    | 21893      |
+---------------------------------+-----------+-----------------+----------+------------+
| metadata_decode_entry           | 354.84ms  | 5.754           | 391.81ms | 544919     |
+---------------------------------+-----------+-----------------+----------+------------+
```

3 years agoRollup merge of #75859 - jrheard:patch-2, r=jonas-schievink
Yuki Okushi [Mon, 24 Aug 2020 02:48:55 +0000 (11:48 +0900)]
Rollup merge of #75859 - jrheard:patch-2, r=jonas-schievink

doc: Fix typo in std::process::Child documentation

Nearly done reading stdlib docs, found another small typo, here's a PR!

r? @steveklabnik

3 years agoRollup merge of #75856 - matthiaskrgr:more_clippy, r=Dylan-DPC
Yuki Okushi [Mon, 24 Aug 2020 02:48:53 +0000 (11:48 +0900)]
Rollup merge of #75856 - matthiaskrgr:more_clippy, r=Dylan-DPC

more tool clippy fixes

r? @Dylan-DPC

3 years agoRollup merge of #75851 - camelid:patch-2, r=jyn514
Yuki Okushi [Mon, 24 Aug 2020 02:48:52 +0000 (11:48 +0900)]
Rollup merge of #75851 - camelid:patch-2, r=jyn514

Switch to intra-doc links in `core::array`

Part of #75080.

@rustbot modify labels: A-intra-doc-links T-doc T-rustdoc

3 years agoRollup merge of #75847 - camelid:patch-1, r=dtolnay
Yuki Okushi [Mon, 24 Aug 2020 02:48:50 +0000 (11:48 +0900)]
Rollup merge of #75847 - camelid:patch-1, r=dtolnay

Switch to intra-doc links in `std::collections`

Part of #75080.

@rustbot modify labels: A-intra-doc-links T-doc T-rustdoc

3 years agoRollup merge of #75844 - ehuss:publish-toolstate-httperror, r=Mark-Simulacrum
Yuki Okushi [Mon, 24 Aug 2020 02:48:49 +0000 (11:48 +0900)]
Rollup merge of #75844 - ehuss:publish-toolstate-httperror, r=Mark-Simulacrum

publish-toolstate: show more context on HTTP error

The default display for HTTPError in Python does not include the request body. For GitHub API, the body includes more details about the error (like rate limiting). This could help diagnosing errors like this: https://github.com/rust-lang/rust/pull/75815#issuecomment-678798158

3 years agoRollup merge of #75831 - lzutao:https, r=Dylan-DPC
Yuki Okushi [Mon, 24 Aug 2020 02:48:47 +0000 (11:48 +0900)]
Rollup merge of #75831 - lzutao:https, r=Dylan-DPC

doc: Prefer https link for wikipedia URLs

A tiny changes.

3 years agoRollup merge of #75826 - ayushmishra2005:misleading_documentation_for_derived_Ord_Par...
Yuki Okushi [Mon, 24 Aug 2020 02:48:46 +0000 (11:48 +0900)]
Rollup merge of #75826 - ayushmishra2005:misleading_documentation_for_derived_Ord_PartialOrd, r=KodrAus

Corrected Misleading documentation for derived Ord/PartialOrd implementation

Corrected Misleading documentation for derived Ord/PartialOrd implementation

Fixes #75620

3 years agoRollup merge of #75825 - jrheard:patch-1, r=steveklabnik
Yuki Okushi [Mon, 24 Aug 2020 02:48:44 +0000 (11:48 +0900)]
Rollup merge of #75825 - jrheard:patch-1, r=steveklabnik

Fix typo in documentation of i32 wrapping_abs()

Hi!

I was reading through the std library docs and noticed that this section flowed a bit oddly; comparing it against https://doc.rust-lang.org/std/primitive.i32.html#method.wrapping_div and https://doc.rust-lang.org/std/primitive.i32.html#method.wrapping_neg , I noticed that those two pieces of documentation used a semicolon here.

This is my first time submitting a PR to this repo. Am I doing this right? Are tiny typo-fix PRs like this worth submitting, or are they not a good use of time?

Thank you!

3 years agoRollup merge of #75821 - camelid:intra-doc-links-for-std-macros, r=jyn514
Yuki Okushi [Mon, 24 Aug 2020 02:48:42 +0000 (11:48 +0900)]
Rollup merge of #75821 - camelid:intra-doc-links-for-std-macros, r=jyn514

Switch to intra-doc links in `std::macros`

Part of #75080.

---

* Switch to intra-doc links in `std::macros`
* Fix typo in module docs
* Link to `std::io::stderr` instead of `std::io::Stderr` to match the
  link text
* Link to `std::io::stdout`

---

@rustbot modify labels: A-intra-doc-links T-doc T-rustdoc

3 years agoRollup merge of #75819 - LeSeulArtichaut:core-intra-docs-2, r=jyn514
Yuki Okushi [Mon, 24 Aug 2020 02:48:41 +0000 (11:48 +0900)]
Rollup merge of #75819 - LeSeulArtichaut:core-intra-docs-2, r=jyn514

Use intra-doc-links in `core::{char, macros, fmt}`

Helps with #75080.
r? @jyn514

3 years agoxpy fmt
Joshua Nelson [Mon, 24 Aug 2020 02:41:45 +0000 (22:41 -0400)]
xpy fmt

3 years agoDocument prim@ and primitive@
Joshua Nelson [Sat, 22 Aug 2020 21:13:33 +0000 (17:13 -0400)]
Document prim@ and primitive@

3 years agoUpdate primitive test to match the new behavior
Joshua Nelson [Sat, 22 Aug 2020 21:12:32 +0000 (17:12 -0400)]
Update primitive test to match the new behavior

3 years agoConvert str -> prim@str in `std`
Joshua Nelson [Sat, 22 Aug 2020 20:29:55 +0000 (16:29 -0400)]
Convert str -> prim@str in `std`

3 years agoConvert from str -> prim@str for `alloc`
Joshua Nelson [Sat, 22 Aug 2020 20:26:01 +0000 (16:26 -0400)]
Convert from str -> prim@str for `alloc`

3 years agoDisambiguate char -> prim@char for `core`
Joshua Nelson [Sat, 22 Aug 2020 20:23:01 +0000 (16:23 -0400)]
Disambiguate char -> prim@char for `core`

This also changes human intuition -> intuition. 'human intuition' sounds
vaguely menacing.

3 years agoReport an ambiguity if both modules and primitives are in scope
Joshua Nelson [Sat, 22 Aug 2020 19:00:19 +0000 (15:00 -0400)]
Report an ambiguity if both modules and primitives are in scope

- Add a new `prim@` disambiguator, since both modules and primitives are
in the same namespace
- Refactor `report_ambiguity` into a closure

Additionally, I noticed that rustdoc would previously allow
`[struct@char]` if `char` resolved to a primitive (not if it had a
DefId). I fixed that and added a test case.

3 years agoAuto merge of #75817 - LeSeulArtichaut:proc_macro-docs, r=jyn514
bors [Mon, 24 Aug 2020 02:18:09 +0000 (02:18 +0000)]
Auto merge of #75817 - LeSeulArtichaut:proc_macro-docs, r=jyn514

Use intra-doc link in `proc_macro`

Yep. One link.

Helps with #75080.
r? @jyn514

3 years agoadd issue number
Dylan DPC [Mon, 24 Aug 2020 00:34:52 +0000 (02:34 +0200)]
add issue number

3 years agodoc: Fix typo in std::process::Child documentation
JR Heard [Sun, 23 Aug 2020 23:38:23 +0000 (16:38 -0700)]
doc: Fix typo in std::process::Child documentation

3 years agoAuto merge of #74489 - jyn514:assoc-items, r=manishearth,petrochenkov
bors [Sun, 23 Aug 2020 23:10:33 +0000 (23:10 +0000)]
Auto merge of #74489 - jyn514:assoc-items, r=manishearth,petrochenkov

Fix intra-doc links for associated items

@Manishearth and I found that links of the following sort are broken:
```rust
$ cat str_from.rs
/// [`String::from`]
pub fn foo() {}
$ rustdoc str_from.rs
warning: `[String::from]` cannot be resolved, ignoring it.
 --> str_from.rs:4:6
  |
4 | /// [`String::from`]
  |      ^^^^^^^^^^^^^^ cannot be resolved, ignoring
```
It turns out this is because the current implementation only looks at inherent impls (`impl Bar {}`) and traits _for the item being documented_. Note that this is not the same as the item being _linked_ to. So this code would work:

```rust
pub trait T1 {
    fn method();
}

pub struct S;
impl T1 for S {
    /// [S::method] on method
    fn method() {}
}
```

but putting the documentation on `trait T1` would not.

~~I realized that writing it up that my fix is only partially correct: It removes the inherent impls code when it should instead remove the `trait_item` code.~~ Fixed.

Additionally, I discovered while writing this there is some ambiguity: you could have multiple methods with the same name, but for different traits:

```rust
pub trait T1 {
    fn method();
}

pub trait T2 {
    fn method();
}

/// See [S::method]
pub struct S;
```

Rustdoc should give an ambiguity error here, but since there is currently no way to disambiguate the traits (https://github.com/rust-lang/rust/issues/74563) it does not (https://github.com/rust-lang/rust/pull/74489#issuecomment-673878404).

There is a _third_ ambiguity that pops up: What if the trait is generic and is implemented multiple times with different generic parameters? In this case, my fix does not do very well: it thinks there is only one trait instantiated and links to that trait:

```
/// [`String::from`] -- this resolves to https://doc.rust-lang.org/nightly/alloc/string/struct.String.html#method.from
pub fn foo() {}
```

However, every `From` implementation has a method called `from`! So the browser picks a random one. This is not the desired behavior, but it's not clear how to avoid it.

To be consistent with the rest of intra-doc links, this only resolves associated items from traits that are in scope. This required changes to rustc_resolve to work cross-crate; the relevant commits are prefixed with `resolve: `. As a bonus, considering only traits in scope is slightly faster. To avoid re-calculating the traits over and over, rustdoc uses a cache to store the traits in scope for a given module.

3 years agounstable-book-gen: fix clippy::single_char_pattern and clippy::iter_skip_next
Matthias Krüger [Sun, 23 Aug 2020 22:47:38 +0000 (00:47 +0200)]
unstable-book-gen: fix clippy::single_char_pattern and clippy::iter_skip_next

3 years agoUse allow(unused_imports) instead of cfg(doc)
Joshua Nelson [Sun, 23 Aug 2020 22:45:57 +0000 (18:45 -0400)]
Use allow(unused_imports) instead of cfg(doc)

This prevents links from breaking when items are re-exported in a
different crate and the original isn't being documented.

3 years agounicode_table_generator: fix clippy::writeln_empty_string, clippy::useless_format...
Matthias Krüger [Sun, 23 Aug 2020 22:43:50 +0000 (00:43 +0200)]
unicode_table_generator: fix clippy::writeln_empty_string, clippy::useless_format, clippy:::for_kv_map