]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoRollup merge of #88896 - GuillaumeGomez:flakyness, r=camelid
Guillaume Gomez [Mon, 13 Sep 2021 19:20:43 +0000 (21:20 +0200)]
Rollup merge of #88896 - GuillaumeGomez:flakyness, r=camelid

Reduce possibility of flaky tests

As asked in https://github.com/rust-lang/rust/pull/88885.

r? ``@camelid``

2 years agoRollup merge of #88894 - FabianWolff:issue-88818, r=estebank
Guillaume Gomez [Mon, 13 Sep 2021 19:20:42 +0000 (21:20 +0200)]
Rollup merge of #88894 - FabianWolff:issue-88818, r=estebank

Improve error message for missing trait in trait impl

Fixes #88818. For the following example:
```rust
struct S { }
impl for S { }
```
the current output is:
```
error: missing trait in a trait impl
 --> t1.rs:2:5
  |
2 | impl for S { }
  |     ^
```
With my changes, I get:
```
error: missing trait in a trait impl
 --> t1.rs:2:5
  |
2 | impl for S { }
  |     ^
  |
help: add a trait here
  |
2 | impl Trait for S { }
  |      +++++
help: for an inherent impl, drop this `for`
  |
2 - impl for S { }
2 + impl S { }
  |
```

2 years agoRollup merge of #88885 - GuillaumeGomez:fix-jump-def-background, r=camelid
Guillaume Gomez [Mon, 13 Sep 2021 19:20:41 +0000 (21:20 +0200)]
Rollup merge of #88885 - GuillaumeGomez:fix-jump-def-background, r=camelid

Fix jump def background

Fixes #88870.

I somehow badly wrote the color in #88111.

r? ``@camelid``

2 years agoRollup merge of #88859 - RalfJung:size-helpers, r=oli-obk
Guillaume Gomez [Mon, 13 Sep 2021 19:20:40 +0000 (21:20 +0200)]
Rollup merge of #88859 - RalfJung:size-helpers, r=oli-obk

interpreter PointerArithmetic: use new Size helper methods

2 years agoRollup merge of #88851 - fee1-dead:dup-bound, r=oli-obk
Guillaume Gomez [Mon, 13 Sep 2021 19:20:39 +0000 (21:20 +0200)]
Rollup merge of #88851 - fee1-dead:dup-bound, r=oli-obk

Fix duplicate bounds for const_trait_impl

Fixes #88383.

Compare the constness of the candidates before winnowing and removing a `~const` `BoundCandidate`.

2 years agoRollup merge of #88722 - WaffleLapkin:unsafe_cell_const_get_mut, r=dtolnay
Guillaume Gomez [Mon, 13 Sep 2021 19:20:39 +0000 (21:20 +0200)]
Rollup merge of #88722 - WaffleLapkin:unsafe_cell_const_get_mut, r=dtolnay

Make `UnsafeCell::get_mut` const

2 years agoRollup merge of #88033 - GuillaumeGomez:jump-to-def-primitive, r=jyn514
Guillaume Gomez [Mon, 13 Sep 2021 19:20:38 +0000 (21:20 +0200)]
Rollup merge of #88033 - GuillaumeGomez:jump-to-def-primitive, r=jyn514

Add links for primitives in "jump to definition" feature

Follow-up of #84176.

I created a function `primitive_from_str` which is code that was originally in `collect_intra_doc_links::resolve_primitive` to prevent code duplication.

I also created the `primitive_link_url` function which is somewhat similar to `primitive_link` but too much different to merge both of them.

r? ``@jyn514``

2 years ago * Enable generate-link-to-def feature on a rustdoc GUI test
Guillaume Gomez [Sun, 12 Sep 2021 13:43:30 +0000 (15:43 +0200)]
 * Enable generate-link-to-def feature on a rustdoc GUI test
 * Add test for jump-to-def links background color

2 years agoAdd test for primitive in "jump to definition" feature
Guillaume Gomez [Sat, 14 Aug 2021 18:17:43 +0000 (20:17 +0200)]
Add test for primitive in "jump to definition" feature

2 years agoAdd support for primitives in "jump to definition" feature
Guillaume Gomez [Sat, 14 Aug 2021 18:17:28 +0000 (20:17 +0200)]
Add support for primitives in "jump to definition" feature

2 years agoAuto merge of #88766 - ehuss:update-cargo, r=ehuss
bors [Mon, 13 Sep 2021 13:12:34 +0000 (13:12 +0000)]
Auto merge of #88766 - ehuss:update-cargo, r=ehuss

Update cargo

6 commits in 18751dd3f238d94d384a7fe967abfac06cbfe0b9..e515c3277bf0681bfc79a9e763861bfe26bb05db
2021-09-01 14:26:00 +0000 to 2021-09-08 14:32:15 +0000
- Remove log output that may leak tokens (rust-lang/cargo#9873)
- rev = "refs/pull/đ‘‘›/head" (rust-lang/cargo#9859)
- Update suggestion message on bad project name error (rust-lang/cargo#9877)
- clarify what goes into "*-sys" crates (rust-lang/cargo#9871)
- Improve error message when unable to initialize git index repo (rust-lang/cargo#9869)
- Use serde_json to generate cargo_vcs_info.json (rust-lang/cargo#9865)

2 years agoAuto merge of #88745 - hnj2:allow-trait-impl-missing-code, r=GuillaumeGomez
bors [Mon, 13 Sep 2021 09:41:22 +0000 (09:41 +0000)]
Auto merge of #88745 - hnj2:allow-trait-impl-missing-code, r=GuillaumeGomez

Allow missing code examples in trait impls.

Excludes Trait implementations from the items that need to have doc code examples when using the `rustdoc::missing_doc_code_examples` lint.

For details see #88741

fixes #88741

r? `@jyn514`

2 years agoAuto merge of #88529 - Meziu:master, r=nagisa
bors [Mon, 13 Sep 2021 05:48:03 +0000 (05:48 +0000)]
Auto merge of #88529 - Meziu:master, r=nagisa

ARMv6K Nintendo 3DS Tier 3 target added

Addition of the target specifications to build .elf files for Nintendo 3DS (ARMv6K, Horizon). Requires devkitARM 3DS toolkit for system libraries and arm-none-eabi-gcc linker.

2 years agoAuto merge of #88517 - smoelius:without-patch-versions, r=flip1995
bors [Mon, 13 Sep 2021 02:45:18 +0000 (02:45 +0000)]
Auto merge of #88517 - smoelius:without-patch-versions, r=flip1995

Update Clippy dependencies without patch versions

Trial run for https://github.com/rust-lang/rust-clippy/pull/7606

2 years agoAuto merge of #88839 - nbdd0121:alignof, r=nagisa
bors [Sun, 12 Sep 2021 23:49:24 +0000 (23:49 +0000)]
Auto merge of #88839 - nbdd0121:alignof, r=nagisa

Introduce NullOp::AlignOf

This PR introduces `Rvalue::NullaryOp(NullOp::AlignOf, ty)`, which will be lowered from `align_of`, similar to `size_of` lowering to `Rvalue::NullaryOp(NullOp::SizeOf, ty)`.

The changes are originally part of #88700 but since it's not dependent on other changes and could have performance impact on its own, it's separated into its own PR.

2 years agoAdd mir opt test for min_align_of -> AlignOf lowering
Gary Guo [Fri, 10 Sep 2021 23:54:10 +0000 (00:54 +0100)]
Add mir opt test for min_align_of -> AlignOf lowering

2 years agoIntroduce NullOp::AlignOf
Gary Guo [Tue, 7 Sep 2021 15:06:07 +0000 (16:06 +0100)]
Introduce NullOp::AlignOf

2 years agoAuto merge of #88759 - Amanieu:panic_in_drop, r=nagisa,eddyb
bors [Sun, 12 Sep 2021 20:48:09 +0000 (20:48 +0000)]
Auto merge of #88759 - Amanieu:panic_in_drop, r=nagisa,eddyb

Add -Z panic-in-drop={unwind,abort} command-line option

This PR changes `Drop` to abort if an unwinding panic attempts to escape it, making the process abort instead. This has several benefits:
- The current behavior when unwinding out of `Drop` is very unintuitive and easy to miss: unwinding continues, but the remaining drops in scope are simply leaked.
- A lot of unsafe code doesn't expect drops to unwind, which can lead to unsoundness:
  - https://github.com/servo/rust-smallvec/issues/14
  - https://github.com/bluss/arrayvec/issues/3
- There is a code size and compilation time cost to this: LLVM needs to generate extra landing pads out of all calls in a drop implementation. This can compound when functions are inlined since unwinding will then continue on to process drops in the callee, which can itself unwind, etc.
  - Initial measurements show a 3% size reduction and up to 10% compilation time reduction on some crates (`syn`).

One thing to note about `-Z panic-in-drop=abort` is that *all* crates must be built with this option for it to be sound since it makes the compiler assume that dropping `Box<dyn Any>` will never unwind.

cc https://github.com/rust-lang/lang-team/issues/97

2 years agoReduce possibility of flaky tests
Guillaume Gomez [Sun, 12 Sep 2021 14:34:18 +0000 (16:34 +0200)]
Reduce possibility of flaky tests

2 years agoImprove error message for missing trait in trait impl
Fabian Wolff [Sun, 12 Sep 2021 20:05:52 +0000 (22:05 +0200)]
Improve error message for missing trait in trait impl

2 years agoAuto merge of #88811 - jackh726:issue-88446, r=nikomatsakis
bors [Sun, 12 Sep 2021 17:04:10 +0000 (17:04 +0000)]
Auto merge of #88811 - jackh726:issue-88446, r=nikomatsakis

Use a HashMap for UniverseInfo in mir borrowck

Fixes #88446

r? `@nikomatsakis`

2 years agoFix invalid background for jump-to-def links in source code pages
Guillaume Gomez [Sun, 12 Sep 2021 14:33:57 +0000 (16:33 +0200)]
Fix invalid background for jump-to-def links in source code pages

2 years agoAuto merge of #88881 - Manishearth:rollup-alohfwx, r=Manishearth
bors [Sun, 12 Sep 2021 13:29:56 +0000 (13:29 +0000)]
Auto merge of #88881 - Manishearth:rollup-alohfwx, r=Manishearth

Rollup of 7 pull requests

Successful merges:

 - #88336 ( Detect stricter constraints on gats where clauses in impls vs trait)
 - #88677 (rustc: Remove local variable IDs from `Export`s)
 - #88699 (Remove extra unshallow from cherry-pick checker)
 - #88709 (generic_const_exprs: use thir for abstract consts instead of mir)
 - #88711 (Rework DepthFirstSearch API)
 - #88810 (rustdoc: Cleanup `clean` part 1)
 - #88813 (explicitly link to external `ena` docs)

Failed merges:

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

2 years agoRollup merge of #88813 - lcnr:ena-docs, r=jyn514
Manish Goregaokar [Sun, 12 Sep 2021 10:44:59 +0000 (03:44 -0700)]
Rollup merge of #88813 - lcnr:ena-docs, r=jyn514

explicitly link to external `ena` docs

we currently do not link to the docs of `ena`: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_infer/infer/struct.InferCtxtInner.html#method.const_unification_table

2 years agoRollup merge of #88810 - camelid:cleanup-pt1, r=jyn514
Manish Goregaokar [Sun, 12 Sep 2021 10:44:58 +0000 (03:44 -0700)]
Rollup merge of #88810 - camelid:cleanup-pt1, r=jyn514

rustdoc: Cleanup `clean` part 1

Split out from #88379.

These commits are completely independent of each other, and each is a fairly
small change (the last few are new commits; they are not from #88379):

- Remove unnecessary `Cache.*_did` fields
- rustdoc: Get symbol for `TyParam` directly
- Create a valid `Res` in `external_path()`
- Remove unused `hir_id` parameter from `resolve_type`
- Fix redundant arguments in `external_path()`
- Remove unnecessary `is_trait` argument
- rustdoc: Cleanup a pattern match in `external_generic_args()`

r? ``@jyn514``

2 years agoRollup merge of #88711 - Mark-Simulacrum:fix-dfs-bug, r=jackh726
Manish Goregaokar [Sun, 12 Sep 2021 10:44:57 +0000 (03:44 -0700)]
Rollup merge of #88711 - Mark-Simulacrum:fix-dfs-bug, r=jackh726

Rework DepthFirstSearch API

This expands the API to be more flexible, allowing for more visitation patterns
on graphs. This will be useful to avoid extra datasets (and allocations) in
cases where the expanded DFS API is sufficient.

This also fixes a bug with the previous DFS constructor, which left the start
node not marked as visited (even though it was immediately returned).

Commit written by ```@nikomatsakis``` originally, cherry picked from several commits in work on never type stabilization, but stands alone.

2 years agoRollup merge of #88709 - BoxyUwU:thir-abstract-const, r=lcnr
Manish Goregaokar [Sun, 12 Sep 2021 10:44:56 +0000 (03:44 -0700)]
Rollup merge of #88709 - BoxyUwU:thir-abstract-const, r=lcnr

generic_const_exprs: use thir for abstract consts instead of mir

Changes `AbstractConst` building to use `thir` instead of `mir` so that there's less chance of consts unifying when they shouldn't because lowering to mir dropped information (see `abstract-consts-as-cast-5.rs` test)

r? `@lcnr`

2 years agoRollup merge of #88699 - Mark-Simulacrum:fixes-cherry-picker, r=pietroalbini
Manish Goregaokar [Sun, 12 Sep 2021 10:44:55 +0000 (03:44 -0700)]
Rollup merge of #88699 - Mark-Simulacrum:fixes-cherry-picker, r=pietroalbini

Remove extra unshallow from cherry-pick checker

This is already done by https://github.com/rust-lang/rust/blob/13db8440bbbe42870bc828d4ec3e965b38670277/src/ci/init_repo.sh#L32-L36 on the beta channel, and git throws an error if you attempt to unshallow an already non-shallow repository.

r? ```@pietroalbini```

2 years agoRollup merge of #88677 - petrochenkov:exportid, r=davidtwco
Manish Goregaokar [Sun, 12 Sep 2021 10:44:53 +0000 (03:44 -0700)]
Rollup merge of #88677 - petrochenkov:exportid, r=davidtwco

rustc: Remove local variable IDs from `Export`s

Local variables can never be exported.

2 years agoRollup merge of #88336 - jackh726:gats-where-constraints, r=estebank
Manish Goregaokar [Sun, 12 Sep 2021 10:44:53 +0000 (03:44 -0700)]
Rollup merge of #88336 - jackh726:gats-where-constraints, r=estebank

 Detect stricter constraints on gats where clauses in impls vs trait

I might try to see if I can do a bit more to improve these diagnostics, but any initial feedback is appreciated. I can also do any additional work in a followup PR.

r? `@estebank`

2 years agoAuto merge of #88771 - jackh726:wf_tys_set, r=nikomatsakis
bors [Sun, 12 Sep 2021 10:32:55 +0000 (10:32 +0000)]
Auto merge of #88771 - jackh726:wf_tys_set, r=nikomatsakis

Use FxHashSet instead of Vec for well formed tys

Trying to recover perf from #88312

r? `@ghost`

2 years agoAuto merge of #88765 - mk12:update-llvm, r=cuviper
bors [Sun, 12 Sep 2021 06:43:01 +0000 (06:43 +0000)]
Auto merge of #88765 - mk12:update-llvm, r=cuviper

Update LLVM submodule

This merges upstream `release/13.x` changes to our fork. In particular,
this includes the bugfix https://reviews.llvm.org/D108608 (see also
https://bugs.llvm.org/show_bug.cgi?id=51637).

The motivation for this is fixing Rust coverage in Fuchsia: https://fxbug.dev/77427.

2 years agoAuto merge of #87073 - jyn514:primitive-docs, r=GuillaumeGomez,jyn514
bors [Sun, 12 Sep 2021 02:36:01 +0000 (02:36 +0000)]
Auto merge of #87073 - jyn514:primitive-docs, r=GuillaumeGomez,jyn514

Fix rustdoc handling of primitive items

This is a complicated PR and does a lot of things. I'm willing to split it up a little more if it would help reviewing, but it would be tricky and I'd rather not unless it's necessary.

 ## What does this do?

- Fixes https://github.com/rust-lang/rust/issues/73423.
- Fixes https://github.com/rust-lang/rust/issues/79630. I'm not sure how to test this for the standard library explicitly, but you can see from some of the diffs from the `no_std` tests. I also tested it locally and it works correctly: ![image](https://user-images.githubusercontent.com/23638587/125214383-e1fdd000-e284-11eb-8048-76b5df958aad.png)
- Fixes https://github.com/rust-lang/rust/issues/83083.

## Why are these changes interconnected?

- Allowing anchors (https://github.com/rust-lang/rust/issues/83083) without fixing the online/offline problem (https://github.com/rust-lang/rust/issues/79630) will actually just silently discard the anchors, that's not a fix. The online/offline problem is directly related to the fragment hack; links need to go through `fn href()` to be fixed.
- Technically I could fix the online/offline problem without removing the error on anchors; I am willing to separate that out if it would be helpful for reviewing. However I can't fix the anchor problem without adding docs to core, since rustdoc needs all those primitives to have docs to avoid a fallback, and currently `#![no_std]` crates don't have docs for primitives. I also can't fix the online/offline problem without removing the fragment hack, since otherwise diffs like this will be wrong for some primitives but not others:
```diff
`@@` -385,7 +381,7 `@@` fn resolve_primitive_associated_item(
                         ty::AssocKind::Const => "associatedconstant",
                         ty::AssocKind::Type => "associatedtype",
                     };
-                    let fragment = format!("{}#{}.{}", prim_ty.as_sym(), out, item_name);
+                    let fragment = format!("{}.{}", out, item_name);
                     (Res::Primitive(prim_ty), fragment, Some((kind.as_def_kind(), item.def_id)))
                 })
         })
```
- Adding primitive docs to core without making any other change will cause links to go to `core` instead of `std`, even for crates with `extern crate std`. See "Breaking changes to doc(primitive)" below for why this is the case. That said, I could add some special casing to rustdoc at the same time that would let me separate this change from the others (it would fix https://github.com/rust-lang/rust/issues/73423 but still special-case intra-doc links). I'm willing to separate that out if helpful for reviewing.

### Add primitive documentation to libcore

This works by reusing the same `include!("primitive_docs.rs")` file in both core and std, and then special-casing links in core to use relative links instead of intra-doc links. This doesn't use purely intra-doc links because some of the primitive docs links to items only in std; this doesn't use purely relative links because that introduces new broken links when the docs are re-exported (e.g. String's `&str` deref impl, or Vec's slice deref impl).

Note that this copies the whole file to core, to avoid anyone compiling core to have to set `CARGO_PKG_NAME`. See https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Who.20should.20review.20changes.20to.20linkchecker.3F/near/249939598 for more context. It also adds a tidy check to make sure the two files are kept in sync.

### Fix inconsistent online/offline primitive docs

This does four things:
- Records modules with `doc(primitive)` in `cache.external_paths`. This is necessary for `href()` to find them later.
- Makes `cache.primitive_locations` available to the intra-doc link pass, by refactoring out a `PrimitiveType::primitive_locations` function that only uses `TyCtxt`.
- Special cases modules with `doc(primitive)` to be treated as always public for the purpose of links.
- Removes the fragment hack. cc `@notriddle,` I know you added some comments about this in the code (thank you for that!)

### Breaking changes to `doc(primitive)`

"Breaking" is a little misleading here - these are changes in behavior, none of them will cause code to fail to compile.

Let me preface this by saying I think stabilizing `doc(primitive)` was a uniquely terrible idea. As far as I can tell, it was stabilized by oversight; it's been stable since 1.0. No one should have need to use it except the standard library, and a crater run shows that in fact no one is using it: https://github.com/rust-lang/rust/pull/87050#issuecomment-886166706. I hope to actually make `doc(primitive)` a no-op unless you opt-in with a nightly feature, which will keep crates compiling without forcing rustdoc into trying to keep somewhat arbitrary behavior guarantees; but for now, this just subtly changes some of the behavior if you use `doc(primitive)` in a dependency.

That said, here are the changes:
-  Refactoring out `primitive_locations()` is technically a change in behavior, since it no longer looks for primitives in crates that were passed through `--extern`, but not used by the crate; however, that seems like such an unlikely edge case it's not worth dealing with.
- The precedence given to primitive locations is no longer just arbitrary, it can also be inconsistent from run to run. Let me explain that more: previously, primitive locations were sorted by the `CrateNum`; the comment on that sort said "Favor linking to as local extern as possible, so iterate all crates in reverse topological order." Unfortunately, that's not actually what CrateNum tracks: it measures the order crates are loaded, not the number of intermediate crates between that dependency and the root crate. It happened to work as intended before because the compiler injects `extern crate std;` at the top of every crate, which ensured it would have the first CrateNum other than the current, but every other CrateNum was completely arbitrary (for example, `core` often had a later CrateNum than `std`). This now removes the sort on CrateNum completely and special-cases core instead. In particular, if you depend on both `std` and a crate which defines a `doc(primitive)` module, it's arbitrary whether rustdoc will use the docs from std or the ones from the other crate. cc `@alexcrichton,` you wrote this originally.

cc `@rust-lang/rustdoc`
cc `@rust-lang/libs` for the addition to `core` (the commit you're interested in is https://github.com/rust-lang/rust/pull/87073/commits/91346c8293bb5f41d8e1d2ec9336433664652c53)

2 years agoFix `no_core` and `no_std` rustdoc tests on Windows
Guillaume Gomez [Wed, 25 Aug 2021 15:57:06 +0000 (17:57 +0200)]
Fix `no_core` and `no_std` rustdoc tests on Windows

This prevents the following (very strange) errors:

```
error: linking with `link.exe` failed: exit code: 1120
  |
  = note: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.29.30133\\bin\\HostX64\\x86\\link.exe" "/DEF:C:\\Users\\runneradmin\\AppData\\Local\\Temp\\rustcJih4fa\\lib.def" "/NOLOGO" "/LARGEADDRESSAWARE" "/SAFESEH" "D:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\test\\rustdoc\\issue-15318-2\\auxiliary\\issue-15318.issue_15318.0a2a8554-cgu.0.rcgu.o" "D:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\test\\rustdoc\\issue-15318-2\\auxiliary\\issue-15318.1na9aylmt25n6w3f.rcgu.o" "/LIBPATH:D:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\native\\rust-test-helpers" "/LIBPATH:D:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\test\\rustdoc\\issue-15318-2\\auxiliary" "/LIBPATH:D:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\stage2\\lib\\rustlib\\i686-pc-windows-msvc\\lib" "vcruntime.lib" "ucrt.lib" "/WHOLEARCHIVE:D:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\stage2\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\librustc_std_workspace_core-78744e1360284b1e.rlib" "/WHOLEARCHIVE:D:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\stage2\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\libcore-a900fa3d16956226.rlib" "D:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\stage2\\lib\\rustlib\\i686-pc-windows-msvc\\lib\\libcompiler_builtins-eb97e6b4dfd2f421.rlib" "/NXCOMPAT" "/LIBPATH:D:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\stage2\\lib\\rustlib\\i686-pc-windows-msvc\\lib" "/OUT:D:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\test\\rustdoc\\issue-15318-2\\auxiliary\\issue_15318.dll" "/OPT:REF,ICF" "/DLL" "/IMPLIB:D:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\test\\rustdoc\\issue-15318-2\\auxiliary\\issue_15318.dll.lib" "/DEBUG" "/NATVIS:D:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\stage2\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:D:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\stage2\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:D:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\stage2\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:D:\\a\\rust\\rust\\build\\i686-pc-windows-msvc\\stage2\\lib\\rustlib\\etc\\libstd.natvis"
  = note: LINK : warning LNK4216: Exported entry point __DllMainCRTStartup@12
             Creating library D:\a\rust\rust\build\i686-pc-windows-msvc\test\rustdoc\issue-15318-2\auxiliary\issue_15318.dll.lib and object D:\a\rust\rust\build\i686-pc-windows-msvc\test\rustdoc\issue-15318-2\auxiliary\issue_15318.dll.exp
          libcore-a900fa3d16956226.rlib(core-a900fa3d16956226.core.95dedc69-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __aulldiv referenced in function __ZN4core3num7dec2flt7decimal7Decimal10left_shift17hfb9b6c23d6ff0383E
          libcompiler_builtins-eb97e6b4dfd2f421.rlib(compiler_builtins-eb97e6b4dfd2f421.compiler_builtins.a5ef280a-cgu.51.rcgu.o) : error LNK2001: unresolved external symbol __aulldiv
          libcore-a900fa3d16956226.rlib(core-a900fa3d16956226.core.95dedc69-cgu.0.rcgu.o) : error LNK2019: unresolved external symbol __aullrem referenced in function __ZN4core3fmt3num14parse_u64_into17h90eb20517ec3bd86E
          D:\a\rust\rust\build\i686-pc-windows-msvc\test\rustdoc\issue-15318-2\auxiliary\issue_15318.dll : fatal error LNK1120: 2 unresolved externals

```

2 years agoFix linkcheck issues
Joshua Nelson [Tue, 13 Jul 2021 21:41:03 +0000 (17:41 -0400)]
Fix linkcheck issues

Most of these are because alloc uses `#[lang_item]` to define methods,
but core documents primitives before those methods are available.

- Fix rustdoc-js-std test

  For some reason this change made CStr not show up in the results for
  `str,u8`. Since it still shows up for str, and since it wasn't a great
  match for that query anyway, I think this is ok to let slide.

- Add test that all primitives can be linked to
- Enable `doc(primitive)` in `core` as well
- Add linkcheck exception specifically for Windows

  Ideally this would be done automatically by the linkchecker by
  replacing `\\` with forward slashes, but this PR is already a ton of
  work ...

- Don't forcibly fail linkchecking if there's a broken intra-doc link on Windows

  Previously, it would exit with a hard error if a missing file had `::`
  in it. This changes it to report a missing file instead, which allows
  adding an exception.

2 years agoFix broken handling of primitive items
Joshua Nelson [Sun, 11 Jul 2021 02:25:36 +0000 (22:25 -0400)]
Fix broken handling of primitive items

- Fix broken handling of primitive associated items
- Remove fragment hack

  Fixes 83083

- more logging
- Update CrateNum hacks

  The CrateNum has no relation to where in the dependency tree the crate
  is, only when it's loaded. Explicitly special-case core instead of
  assuming it will be the first DefId.

- Update and add tests
- Cache calculation of primitive locations

  This could possibly be avoided by passing a Cache into
  collect_intra_doc_links; but that's a much larger change, and doesn't
  seem valuable other than for this.

2 years agodowngrade some logging
Joshua Nelson [Sun, 11 Jul 2021 03:02:10 +0000 (23:02 -0400)]
downgrade some logging

2 years agoAdd primitive documentation to libcore
Joshua Nelson [Tue, 6 Jul 2021 02:50:26 +0000 (22:50 -0400)]
Add primitive documentation to libcore

This works by doing two things:
- Adding links that are specific to the crate. Since not all primitive
  items are defined in `core` (due to lang_items), these need to use
  relative links and not intra-doc links.
- Duplicating `primitive_docs` in both core and std. This allows not needing CARGO_PKG_NAME to build the standard library. It also adds a tidy check to make sure they stay the same.

2 years agoAuto merge of #84373 - cjgillot:resolve-span, r=michaelwoerister,petrochenkov
bors [Sat, 11 Sep 2021 23:35:28 +0000 (23:35 +0000)]
Auto merge of #84373 - cjgillot:resolve-span, r=michaelwoerister,petrochenkov

Encode spans relative to the enclosing item

The aim of this PR is to avoid recomputing queries when code is moved without modification.

MCP at https://github.com/rust-lang/compiler-team/issues/443

This is achieved by :
1. storing the HIR owner LocalDefId information inside the span;
2. encoding and decoding spans relative to the enclosing item in the incremental on-disk cache;
3. marking a dependency to the `source_span(LocalDefId)` query when we translate a span from the short (`Span`) representation to its explicit (`SpanData`) representation.

Since all client code uses `Span`, step 3 ensures that all manipulations
of span byte positions actually create the dependency edge between
the caller and the `source_span(LocalDefId)`.
This query return the actual absolute span of the parent item.
As a consequence, any source code motion that changes the absolute byte position of a node will either:
- modify the distance to the parent's beginning, so change the relative span's hash;
- dirty `source_span`, and trigger the incremental recomputation of all code that
  depends on the span's absolute byte position.

With this scheme, I believe the dependency tracking to be accurate.

For the moment, the spans are marked during lowering.
I'd rather do this during def-collection,
but the AST MutVisitor is not practical enough just yet.
The only difference is that we attach macro-expanded spans
to their expansion point instead of the macro itself.

2 years agorustdoc: Cleanup a pattern match in `external_generic_args()`
Noah Lev [Sat, 11 Sep 2021 23:01:49 +0000 (16:01 -0700)]
rustdoc: Cleanup a pattern match in `external_generic_args()`

2 years agoRemove unnecessary `is_trait` argument
Noah Lev [Sat, 11 Sep 2021 22:55:21 +0000 (15:55 -0700)]
Remove unnecessary `is_trait` argument

It was only used for sugaring `Fn` trait bounds, and rustdoc already
checks that the `did` is for a `Fn` (or `FnMut`, `FnOnce`) lang item,
so it's not necessary to also check that the `did` belongs to a trait.

2 years agoFix redundant arguments in `external_path()`
Noah Lev [Sat, 11 Sep 2021 22:43:44 +0000 (15:43 -0700)]
Fix redundant arguments in `external_path()`

If the path is for a trait, it is always true that `trait_did ==
Some(did)`, so instead, `external_path()` now takes an `is_trait`
boolean.

2 years agoAuto merge of #78780 - cjgillot:req, r=Mark-Simulacrum
bors [Sat, 11 Sep 2021 20:39:47 +0000 (20:39 +0000)]
Auto merge of #78780 - cjgillot:req, r=Mark-Simulacrum

Refactor query forcing

The control flow in those functions was very complex, with several layers of continuations.

I tried to simplify the implementation, while keeping essentially the same logic.
Now, all code paths go through `try_execute_query` for the actual query execution.
Communication with the `dep_graph` and the live caches are the only difference between query getting/ensuring/forcing.

2 years agoRemove unused `hir_id` parameter from `resolve_type`
Noah Lev [Fri, 27 Aug 2021 00:47:29 +0000 (17:47 -0700)]
Remove unused `hir_id` parameter from `resolve_type`

2 years agoCreate a valid `Res` in `external_path()`
Noah Lev [Tue, 24 Aug 2021 17:33:41 +0000 (10:33 -0700)]
Create a valid `Res` in `external_path()`

The order of the `where` bounds on auto trait impls changed because
rustdoc currently sorts auto trait `where` bounds based on the `Debug`
output for the bound. Now that the bounds have an actual `Res`, they are
being unintentionally sorted by their `DefId` rather than their path.
So, I had to update a test for the change in ordering of the rendered
bounds.

2 years agorustdoc: Get symbol for `TyParam` directly
Noah Lev [Mon, 23 Aug 2021 01:53:00 +0000 (18:53 -0700)]
rustdoc: Get symbol for `TyParam` directly

2 years agoOnly take `tcx` when it's all that's needed
Noah Lev [Fri, 27 Aug 2021 23:49:14 +0000 (16:49 -0700)]
Only take `tcx` when it's all that's needed

2 years agoexplicitly link to external `ena` docs
lcnr [Sat, 11 Sep 2021 18:24:46 +0000 (20:24 +0200)]
explicitly link to external `ena` docs

2 years agoAuto merge of #88857 - workingjubilee:rollup-zrtvspt, r=workingjubilee
bors [Sat, 11 Sep 2021 17:48:48 +0000 (17:48 +0000)]
Auto merge of #88857 - workingjubilee:rollup-zrtvspt, r=workingjubilee

Rollup of 10 pull requests

Successful merges:

 - #87904 (Reword description of automatic impls of `Unsize`.)
 - #88147 (Fix non-capturing closure return type coercion)
 - #88209 (Improve error message when _ is used for in/inout asm operands)
 - #88668 (Change more x64 size checks to not apply to x32.)
 - #88733 (Fix ICE for functions with more than 65535 arguments)
 - #88757 (Suggest wapping expr in parentheses on invalid unary negation)
 - #88779 (Use more accurate spans for "unused delimiter" lint)
 - #88830 (Add help for E0463)
 - #88849 (don't clone types that are Copy (clippy::clone_on_copy))
 - #88850 (don't convert types into identical types)

Failed merges:

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

2 years agointerpreter PointerArithmetic: use new Size helper methods
Ralf Jung [Sat, 11 Sep 2021 15:58:08 +0000 (11:58 -0400)]
interpreter PointerArithmetic: use new Size helper methods

2 years agoRebase fallout.
Camille GILLOT [Fri, 10 Sep 2021 17:57:06 +0000 (19:57 +0200)]
Rebase fallout.

2 years agoRollup merge of #88850 - matthiaskrgr:identical_conv, r=jackh726
Jubilee [Sat, 11 Sep 2021 15:23:46 +0000 (08:23 -0700)]
Rollup merge of #88850 - matthiaskrgr:identical_conv, r=jackh726

don't convert types into identical types

example: let x: String = String::new().into();

2 years agoRollup merge of #88849 - matthiaskrgr:clony_on_copy, r=petrochenkov
Jubilee [Sat, 11 Sep 2021 15:23:45 +0000 (08:23 -0700)]
Rollup merge of #88849 - matthiaskrgr:clony_on_copy, r=petrochenkov

don't clone types that are Copy (clippy::clone_on_copy)

2 years agoRollup merge of #88830 - GuillaumeGomez:help-e0463, r=estebank
Jubilee [Sat, 11 Sep 2021 15:23:44 +0000 (08:23 -0700)]
Rollup merge of #88830 - GuillaumeGomez:help-e0463, r=estebank

Add help for E0463

Fixes #87871.

r? ```@estebank```

2 years agoRollup merge of #88779 - estebank:unused-delims, r=davidtwco
Jubilee [Sat, 11 Sep 2021 15:23:43 +0000 (08:23 -0700)]
Rollup merge of #88779 - estebank:unused-delims, r=davidtwco

Use more accurate spans for "unused delimiter" lint

2 years agoRollup merge of #88757 - andrewhickman:master, r=jackh726
Jubilee [Sat, 11 Sep 2021 15:23:42 +0000 (08:23 -0700)]
Rollup merge of #88757 - andrewhickman:master, r=jackh726

Suggest wapping expr in parentheses on invalid unary negation

Fixes #88701

2 years agoRollup merge of #88733 - Noble-Mushtak:88577, r=estebank
Jubilee [Sat, 11 Sep 2021 15:23:41 +0000 (08:23 -0700)]
Rollup merge of #88733 - Noble-Mushtak:88577, r=estebank

Fix ICE for functions with more than 65535 arguments

This pull request fixes #88577 by changing the `param_idx` field in the `Param` variant of `WellFormedLoc` from `u16` to `u32`, thus allowing for more than 65,535 arguments in a function. Note that I also added a regression test, but needed to add `// ignore-tidy-filelength` because the test is more than 8000 lines long.

2 years agoRollup merge of #88668 - hvdijk:x32, r=joshtriplett
Jubilee [Sat, 11 Sep 2021 15:23:41 +0000 (08:23 -0700)]
Rollup merge of #88668 - hvdijk:x32, r=joshtriplett

Change more x64 size checks to not apply to x32.

Commit 95e096d6 changed a bunch of size checks already, but more have
been added, so this fixes the new ones the same way: the various size
checks that are conditional on target_arch = "x86_64" were not intended
to apply to x86_64-unknown-linux-gnux32, so add
target_pointer_width = "64" to the conditions.

2 years agoRollup merge of #88209 - Amanieu:asm_in_underscore, r=nagisa
Jubilee [Sat, 11 Sep 2021 15:23:40 +0000 (08:23 -0700)]
Rollup merge of #88209 - Amanieu:asm_in_underscore, r=nagisa

Improve error message when _ is used for in/inout asm operands

As suggested by ```@Commeownist``` in https://github.com/rust-lang/rust/issues/72016#issuecomment-903102415.

2 years agoRollup merge of #88147 - FabianWolff:issue-88097, r=jackh726
Jubilee [Sat, 11 Sep 2021 15:23:39 +0000 (08:23 -0700)]
Rollup merge of #88147 - FabianWolff:issue-88097, r=jackh726

Fix non-capturing closure return type coercion

Fixes #88097. For the example given there:
```rust
fn peculiar() -> impl Fn(u8) -> u8 {
    return |x| x + 1
}
```
which incorrectly reports an error, I noticed something weird in the debug log:
```
DEBUG rustc_typeck::check::coercion coercion::try_find_coercion_lub([closure@test.rs:2:12: 2:21], [closure@test.rs:2:12: 2:21], exprs=1 exprs)
```
Apparently, `try_find_coercion_lub()` thinks that the LUB for two closure types always has to be a function pointer (which explains the `expected closure, found fn pointer` error in #88097). There is one corner case where that isn't true, though â€” namely, when the two closure types are equal, in which case the trivial LUB is the type itself. This PR fixes this by inserting an explicit check for type equality in `try_find_coercion_lub()`.

2 years agoRollup merge of #87904 - kpreid:unsize, r=jyn514
Jubilee [Sat, 11 Sep 2021 15:23:38 +0000 (08:23 -0700)]
Rollup merge of #87904 - kpreid:unsize, r=jyn514

Reword description of automatic impls of `Unsize`.

The existing documentation felt a little unhelpfully concise, so this change tries to improve it by using longer sentences, each of which specifies which kinds of types it applies to as early as possible. In particular, the third item starts with â€śStructs ...” instead of saying â€śFoo is a struct” later.

Also, the previous list items â€śOnly the last field has a type involving `T`” and â€ś`T` is not part of the type of any other fields” are, as far as I see, redundant with each other, so I removed the latter.

I have no particular knowledge of `Unsize`; I have attempted to leave the meaning entirely unchanged but may have missed a nuance.

Markdown preview of the edited documentation:

> All implementations of `Unsize` are provided automatically by the compiler.
> Those implementations are:
>
> - Arrays `[T; N]` implement `Unsize<[T]>`.
> - Types implementing a trait `Trait` also implement `Unsize<dyn Trait>`.
> - Structs `Foo<..., T, ...>` implement `Unsize<Foo<..., U, ...>>` if all of these conditions
>   are met:
>   - `T: Unsize<U>`.
>   - Only the last field of `Foo` has a type involving `T`.
>   - `Bar<T>: Unsize<Bar<U>>`, where `Bar<T>` stands for the actual type of that last field.

2 years agoAdd test for -Z panic-in-drop=abort
Amanieu d'Antras [Fri, 10 Sep 2021 18:42:32 +0000 (19:42 +0100)]
Add test for -Z panic-in-drop=abort

2 years agoEnsure that crates are linked with compatible panic-in-drop settings
Amanieu d'Antras [Thu, 9 Sep 2021 12:31:19 +0000 (13:31 +0100)]
Ensure that crates are linked with compatible panic-in-drop settings

2 years agoApply noreturn and nounwind LLVM attributes to callsites
Amanieu d'Antras [Mon, 6 Sep 2021 11:10:11 +0000 (13:10 +0200)]
Apply noreturn and nounwind LLVM attributes to callsites

2 years agoAuto merge of #88327 - bonega:scalar_refactor, r=eddyb
bors [Sat, 11 Sep 2021 10:18:05 +0000 (10:18 +0000)]
Auto merge of #88327 - bonega:scalar_refactor, r=eddyb

`WrappingRange` (#88242) follow-up (`is_full_for`, `Scalar: Copy`, etc.)

Some changes related to feedback during #88242
r? `@RalfJung`

2 years agoFix duplicate bounds for const_trait_impl
Deadbeef [Sat, 11 Sep 2021 09:40:19 +0000 (09:40 +0000)]
Fix duplicate bounds for const_trait_impl

2 years agoAdd comment pointing to test
Andrew Hickman [Sat, 11 Sep 2021 09:08:11 +0000 (10:08 +0100)]
Add comment pointing to test

2 years agodon't convert types into identical types
Matthias KrĂĽger [Sat, 11 Sep 2021 08:31:56 +0000 (10:31 +0200)]
don't convert types into identical types

example: let x: String = String::new().into();

2 years agodon't clone types that are Copy (clippy::clone_on_copy)
Matthias KrĂĽger [Sat, 11 Sep 2021 08:18:56 +0000 (10:18 +0200)]
don't clone types that are Copy (clippy::clone_on_copy)

2 years agoAuto merge of #88214 - notriddle:notriddle/for-loop-span-drop-temps-mut, r=nagisa
bors [Sat, 11 Sep 2021 07:11:01 +0000 (07:11 +0000)]
Auto merge of #88214 - notriddle:notriddle/for-loop-span-drop-temps-mut, r=nagisa

rustc: use more correct span data in for loop desugaring

Fixes #82462

Before:

      help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
         |
      LL |     for x in DroppingSlice(&*v).iter(); {
         |                                       +

After:

      help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
         |
      LL |     };
         |      +

This seems like a reasonable fix: since the desugared "expr_drop_temps_mut" contains the entire desugared loop construct, its span should contain the entire loop construct as well.

2 years agoAuto merge of #88824 - Manishearth:rollup-7bzk9h6, r=Manishearth
bors [Sat, 11 Sep 2021 03:30:55 +0000 (03:30 +0000)]
Auto merge of #88824 - Manishearth:rollup-7bzk9h6, r=Manishearth

Rollup of 15 pull requests

Successful merges:

 - #85200 (Ignore derived Clone and Debug implementations during dead code analysis)
 - #86165 (Add proc_macro::Span::{before, after}.)
 - #87088 (Fix stray notes when the source code is not available)
 - #87441 (Emit suggestion when passing byte literal to format macro)
 - #88546 (Emit proper errors when on missing closure braces)
 - #88578 (fix(rustc): suggest `items` be borrowed in `for i in items[x..]`)
 - #88632 (Fix issues with Markdown summary options)
 - #88639 (rustdoc: Fix ICE with `doc(hidden)` on tuple variant fields)
 - #88667 (Tweak `write_fmt` doc.)
 - #88720 (Rustdoc coverage fields count)
 - #88732 (RustWrapper: avoid deleted unclear attribute methods)
 - #88742 (Fix table in docblocks)
 - #88776 (Workaround blink/chromium grid layout limitation of 1000 rows)
 - #88807 (Fix typo in docs for iterators)
 - #88812 (Fix typo `option` -> `options`.)

Failed merges:

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

2 years agoUpdate LLVM submodule
Mitchell Kember [Wed, 8 Sep 2021 22:02:06 +0000 (15:02 -0700)]
Update LLVM submodule

This merges upstream `release/13.x` changes to our fork. In particular,
this includes the bugfix https://reviews.llvm.org/D108608 (see also
https://bugs.llvm.org/show_bug.cgi?id=51637).

2 years agoFill in the tracking issue for `#![feature(const_unsafecell_get_mut)]`
Waffle Lapkin [Fri, 10 Sep 2021 21:07:14 +0000 (00:07 +0300)]
Fill in the tracking issue for `#![feature(const_unsafecell_get_mut)]`

2 years agorustc: Remove local variable IDs from `Export`s
Vadim Petrochenkov [Sun, 5 Sep 2021 20:37:15 +0000 (23:37 +0300)]
rustc: Remove local variable IDs from `Export`s

Local variables can never be exported.

2 years agoAdd help for E0463
Guillaume Gomez [Fri, 10 Sep 2021 18:20:10 +0000 (20:20 +0200)]
Add help for E0463

2 years agoARMV6K 3DS: Removed useless parameters in target spec
Meziu [Fri, 10 Sep 2021 18:20:12 +0000 (20:20 +0200)]
ARMV6K 3DS: Removed useless parameters in target spec

2 years agoDuplicate tests for incremental spans mode.
Camille GILLOT [Thu, 22 Apr 2021 19:33:16 +0000 (21:33 +0200)]
Duplicate tests for incremental spans mode.

2 years agoRecord call_site parent for macros.
Camille GILLOT [Sun, 2 May 2021 19:19:28 +0000 (21:19 +0200)]
Record call_site parent for macros.

2 years agoRemove some span tracking.
Camille GILLOT [Fri, 30 Apr 2021 18:16:09 +0000 (20:16 +0200)]
Remove some span tracking.

2 years agoGive spans their parent item during lowering.
Camille GILLOT [Sun, 18 Apr 2021 19:28:23 +0000 (21:28 +0200)]
Give spans their parent item during lowering.

We only do this operation when incremental compilation is enabled. This
avoids pessimizing the span handling for non-incremental compilation.

2 years agoAdd actual spans to the crate hash.
Camille GILLOT [Sun, 2 May 2021 10:16:59 +0000 (12:16 +0200)]
Add actual spans to the crate hash.

Now that we encode spans relative to the items, the item's own span is
never actually hashed as part of the HIR.
In consequence, we explicitly include it in the crate hash to avoid
missing cross-crate invalidations.

2 years agoAdd sanity check.
Camille GILLOT [Tue, 27 Apr 2021 17:58:46 +0000 (19:58 +0200)]
Add sanity check.

We force the relative span's parent to be absolute. This avoids having to
handle long dependency chains.

2 years agoRename decode to data_untracked.
Camille GILLOT [Fri, 30 Apr 2021 18:15:22 +0000 (20:15 +0200)]
Rename decode to data_untracked.

2 years agoTrack span dependency using a callback.
Camille GILLOT [Tue, 27 Apr 2021 17:24:33 +0000 (19:24 +0200)]
Track span dependency using a callback.

2 years agoEncode spans relative to their parent.
Camille GILLOT [Sun, 18 Apr 2021 12:27:28 +0000 (14:27 +0200)]
Encode spans relative to their parent.

2 years agoKeep a parent LocalDefId in SpanData.
Camille GILLOT [Sun, 18 Apr 2021 12:27:04 +0000 (14:27 +0200)]
Keep a parent LocalDefId in SpanData.

2 years agoKeep def_spans collected by resolution.
Camille GILLOT [Sun, 4 Apr 2021 14:04:38 +0000 (16:04 +0200)]
Keep def_spans collected by resolution.

2 years agoAuto merge of #88823 - hyd-dev:miri, r=RalfJung
bors [Fri, 10 Sep 2021 15:51:58 +0000 (15:51 +0000)]
Auto merge of #88823 - hyd-dev:miri, r=RalfJung

Update Miri

Fixes #88768.

r? `@RalfJung`

2 years agoRollup merge of #88812 - gz:patch-1, r=ehuss
Manish Goregaokar [Fri, 10 Sep 2021 15:23:27 +0000 (08:23 -0700)]
Rollup merge of #88812 - gz:patch-1, r=ehuss

Fix typo `option` -> `options`.

2 years agoRollup merge of #88807 - jruderman:which_reverses, r=joshtriplett
Manish Goregaokar [Fri, 10 Sep 2021 15:23:26 +0000 (08:23 -0700)]
Rollup merge of #88807 - jruderman:which_reverses, r=joshtriplett

Fix typo in docs for iterators

2 years agoRollup merge of #88776 - dns2utf8:rustdoc_workaround_1000_elements_grid_bug, r=Guilla...
Manish Goregaokar [Fri, 10 Sep 2021 15:23:25 +0000 (08:23 -0700)]
Rollup merge of #88776 - dns2utf8:rustdoc_workaround_1000_elements_grid_bug, r=GuillaumeGomez

Workaround blink/chromium grid layout limitation of 1000 rows

I made this in case we don't come up with a better solution in time.

See https://github.com/rust-lang/rust/issues/88545 for more details.

A rendered version of the standard library is hosted here:
https://data.estada.ch/rustdoc-nightly_497ee321af_2021-09-09/core/arch/arm/index.html

r? `@GuillaumeGomez` `@jsha`

2 years agoRollup merge of #88742 - GuillaumeGomez:fix-table-in-docblocks, r=nbdd0121
Manish Goregaokar [Fri, 10 Sep 2021 15:23:24 +0000 (08:23 -0700)]
Rollup merge of #88742 - GuillaumeGomez:fix-table-in-docblocks, r=nbdd0121

Fix table in docblocks

"Overwrite" of #88702.

Instead of adding a z-index to the sidebar (which only hides the issue, doesn't fix it), I wrap `<table>` elements inside a `<div>` and limit all chidren of `.docblock` elements' width to prevent having the scrollbar on the whole doc block.

![Screenshot from 2021-09-08 15-11-24](https://user-images.githubusercontent.com/3050060/132515740-71796515-e74f-429f-ba98-2596bdbf781c.png)

Thanks `@nbdd0121` for `overflow-x: auto;`. ;)

r? `@notriddle`

2 years agoRollup merge of #88732 - durin42:llvm-14-attrs-2, r=nikic
Manish Goregaokar [Fri, 10 Sep 2021 15:23:23 +0000 (08:23 -0700)]
Rollup merge of #88732 - durin42:llvm-14-attrs-2, r=nikic

RustWrapper: avoid deleted unclear attribute methods

These were deleted in https://reviews.llvm.org/D108614, and in C++ I
definitely see the argument for their removal. I didn't try and
propagate the changes up into higher layers of rustc in this change
because my initial goal was to get rustc working against LLVM HEAD
promptly, but I'm happy to follow up with some refactoring to make the
API on the Rust side match the LLVM API more directly (though the way
the enum works in Rust makes the API less scary IMO).

r? ``@nagisa`` cc ``@nikic``

2 years agoRollup merge of #88720 - GuillaumeGomez:rustdoc-coverage-fields-count, r=Manishearth
Manish Goregaokar [Fri, 10 Sep 2021 15:23:22 +0000 (08:23 -0700)]
Rollup merge of #88720 - GuillaumeGomez:rustdoc-coverage-fields-count, r=Manishearth

Rustdoc coverage fields count

Follow-up of #88688.

Instead of requiring enum tuple variant fields and tuple struct fields to be documented, we count them if they are documented, otherwise we don't include them in the count.

r? `@Manishearth`

2 years agoRollup merge of #88667 - kraktus:patch-1, r=dtolnay
Manish Goregaokar [Fri, 10 Sep 2021 15:23:21 +0000 (08:23 -0700)]
Rollup merge of #88667 - kraktus:patch-1, r=dtolnay

Tweak `write_fmt` doc.

Found this weird sentence while reading the docs.

2 years agoRollup merge of #88639 - Emilgardis:fix-issue-88600, r=GuillaumeGomez
Manish Goregaokar [Fri, 10 Sep 2021 15:23:20 +0000 (08:23 -0700)]
Rollup merge of #88639 - Emilgardis:fix-issue-88600, r=GuillaumeGomez

rustdoc: Fix ICE with `doc(hidden)` on tuple variant fields

Fixes #88600.

```rust
pub struct H;
pub struct S;

pub enum FooEnum {
    HiddenTupleItem(#[doc(hidden)] H),
    MultipleHidden(#[doc(hidden)] H, #[doc(hidden)] H),
    MixedHiddenFirst(#[doc(hidden)] H, S),
    MixedHiddenLast(S, #[doc(hidden)] H),
    HiddenStruct {
        #[doc(hidden)]
        h: H,
        s: S,
    },
}
```

Generates
![image](https://user-images.githubusercontent.com/1502855/132259152-382f9517-c2a0-41d8-acd0-64e5993931fc.png)

2 years agoRollup merge of #88632 - camelid:md-opts, r=CraftSpider
Manish Goregaokar [Fri, 10 Sep 2021 15:23:19 +0000 (08:23 -0700)]
Rollup merge of #88632 - camelid:md-opts, r=CraftSpider

Fix issues with Markdown summary options

- Use `summary_opts()` for Markdown summaries
- Enable all main body Markdown options for summaries

2 years agoRollup merge of #88578 - notriddle:notriddle/suggest-add-reference-to-for-loop-iter...
Manish Goregaokar [Fri, 10 Sep 2021 15:23:18 +0000 (08:23 -0700)]
Rollup merge of #88578 - notriddle:notriddle/suggest-add-reference-to-for-loop-iter, r=nagisa

fix(rustc): suggest `items` be borrowed in `for i in items[x..]`

Fixes #87994

2 years agoRollup merge of #88546 - scrabsha:scrabsha/closure-missing-braces, r=estebank
Manish Goregaokar [Fri, 10 Sep 2021 15:23:17 +0000 (08:23 -0700)]
Rollup merge of #88546 - scrabsha:scrabsha/closure-missing-braces, r=estebank

Emit proper errors when on missing closure braces

This commit focuses on emitting clean errors for the following syntax
error:

```
Some(42).map(|a|
    dbg!(a);
    a
);
```

Previous implementation tried to recover after parsing the closure body
(the `dbg` expression) by replacing the next `;` with a `,`, which made
the next expression belong to the next function argument. As such, the
following errors were emitted (among others):
  - the semicolon token was not expected,
  - a is not in scope,
  - Option::map is supposed to take one argument, not two.

This commit allows us to gracefully handle this situation by adding
giving the parser the ability to remember when it has just parsed a
closure body inside a function call. When this happens, we can treat the
unexpected `;` specifically and try to parse as much statements as
possible in order to eat the whole block. When we can't parse statements
anymore, we generate a clean error indicating that the braces are
missing, and return an ExprKind::Err.

Closes #88065.

r? `@estebank`

2 years agoRollup merge of #87441 - ibraheemdev:i-86865, r=cjgillot
Manish Goregaokar [Fri, 10 Sep 2021 15:23:15 +0000 (08:23 -0700)]
Rollup merge of #87441 - ibraheemdev:i-86865, r=cjgillot

Emit suggestion when passing byte literal to format macro

Closes #86865