Commit Graph

125776 Commits

Author SHA1 Message Date
Michael Goulet
b9a3c32f31 Do not fail evaluation in const blocks 2022-01-14 13:05:16 -08:00
bors
b0ec3e09a9 Auto merge of #91948 - nnethercote:rustdoc-more-Symbols, r=GuillaumeGomez
rustdoc: avoid many `Symbol` to `String` conversions.

Particularly when constructing file paths and fully qualified paths.
This avoids a lot of allocations, speeding things up on almost all
examples.

r? `@GuillaumeGomez`
2022-01-14 20:34:18 +00:00
Noah Lev
c7147e4e1a Document and test UrlPartsBuilder::push_fmt 2022-01-14 12:05:35 -08:00
Noah Lev
cef250d90b Make AVG_PART_LENGTH a power of 2
I seem to recall that in general, it's best to request an allocation
with a size that's a power of 2. The low estimate of 5 was probably a
little too low as well.
2022-01-14 12:05:35 -08:00
Noah Lev
8f59eb6da0 Estimate path length instead of hardcoding 64 bytes 2022-01-14 12:05:35 -08:00
Noah Lev
53f1bed83a Use UrlPartsBuilder and remove join_with_slash 2022-01-14 12:05:35 -08:00
Nicholas Nethercote
6b19cf9f74 rustdoc: remove some unnecessary sigils. 2022-01-14 12:05:35 -08:00
Nicholas Nethercote
1e4637cf4d rustdoc: remove many unnecessary .as_ref() calls. 2022-01-14 12:05:34 -08:00
Nicholas Nethercote
10b1c9aa8b rustdoc: avoid many Symbol to String conversions.
Particularly when constructing file paths and fully qualified paths.
This avoids a lot of allocations, speeding things up on almost all
examples.
2022-01-14 11:57:18 -08:00
Jacob Hoffman-Andrews
7781636fc7 Link sidebar "location" heading to top of page
This makes it easy, when you are scrolled far down in a page, to jump
back to the top.
2022-01-14 10:41:30 -08:00
bors
ad46af2471 Auto merge of #92883 - matthiaskrgr:rollup-uoudywx, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #92045 (Don't fall back to crate-level opaque type definitions.)
 - #92381 (Suggest `return`ing tail expressions in async functions)
 - #92768 (Partially stabilize `maybe_uninit_extra`)
 - #92810 (Deduplicate box deref and regular deref suggestions)
 - #92818 (Update documentation for doc_cfg feature)
 - #92840 (Fix some lints documentation)
 - #92849 (Clippyup)
 - #92854 (Use the updated Rust logo in rustdoc)
 - #92864 (Fix a missing dot in the main item heading)

Failed merges:

 - #92838 (Clean up some links in RELEASES)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-14 17:31:28 +00:00
Maybe Waffle
f9174e1d80 Do not use HashSet for #[rustc_must_implement_one_of] 2022-01-14 16:52:30 +03:00
Maybe Waffle
c30ec5a6fd Check for duplicate arguments in #[rustc_must_implement_one_of] 2022-01-14 16:38:47 +03:00
Matthias Krüger
2ae4afddd7
Rollup merge of #92864 - Urgau:fix-missing-source-dot, r=jsha
Fix a missing dot in the main item heading

This pull-request fix a missing `·` in the item header ~~and also make use of ` ` to explicit that the spaces are mandatory~~.

| Before | After |
| --- | --- |
| ![image](https://user-images.githubusercontent.com/3616612/149393966-7cca6dc5-9a62-47fa-8c9c-18f936d43aa9.png) | ![image](https://user-images.githubusercontent.com/3616612/149393869-5ffd6e44-d91c-4ece-b69e-d103304f6626.png) |

PS: This was introduce yesterday by https://github.com/rust-lang/rust/pull/92526 (the migration from Tera to Askama) and is not currently observable in the nightly doc.
2022-01-14 07:47:39 +01:00
Matthias Krüger
dae3ef2eb2
Rollup merge of #92854 - Urgau:better-rust-logo, r=GuillaumeGomez
Use the updated Rust logo in rustdoc

This pull-request use the updated Rust logo from https://github.com/rust-lang/rust-artwork/pull/9 and also change the logo format from PNG to SVG.

| Before | After |
| --- | --- |
| ![Screenshot 2022-01-13 at 14-33-40 std - Rust](https://user-images.githubusercontent.com/3616612/149342697-7afe4c3e-2be5-444b-86f3-118712b4f7ae.png) | ![Screenshot 2022-01-13 at 14-33-15 std - Rust](https://user-images.githubusercontent.com/3616612/149342705-54ed27c6-0806-4c2d-baa1-4d65ed897e2b.png) |

I also took the liberty to update the two PNG favicons with the SVG reducing their size by ~35% each.

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

r? ```@jsha```
2022-01-14 07:47:38 +01:00
Matthias Krüger
ccfee3d53b
Rollup merge of #92849 - flip1995:clippyup, r=Manishearth
Clippyup

r? ```@Manishearth```
2022-01-14 07:47:37 +01:00
Matthias Krüger
3cbc448c9c
Rollup merge of #92818 - GuillaumeGomez:update-doc-cfg-doc, r=camelid
Update documentation for doc_cfg feature

Fixes  #92484.
2022-01-14 07:47:35 +01:00
Matthias Krüger
9d5cb20978
Rollup merge of #92810 - compiler-errors:deduplicate-box-deref-suggestion, r=camelid
Deduplicate box deref and regular deref suggestions

Remove the suggestion code special-cased for Box deref.

r? ```@camelid```
since you introduced the code in #90627
2022-01-14 07:47:34 +01:00
Matthias Krüger
347c744fe0
Rollup merge of #92381 - ThePuzzlemaker:issue-92308, r=estebank
Suggest `return`ing tail expressions in async functions

This PR fixes #92308.

Previously, the suggestion to `return` tail expressions (introduced in #81769) did not apply to `async` functions, as the suggestion checked whether the types were equal disregarding `impl Future<Output = T>` syntax sugar for `async` functions. This PR changes that in order to fix a potential papercut.

I'm not sure if this is the "right" way to do this, so if there is a better way then please let me know.

I amended an existing test introduced in #81769 to add a regression test for this, if you think I should make a separate test I will.
2022-01-14 07:47:32 +01:00
bors
86f7f78f05 Auto merge of #92781 - lambinoo:I-92755-no-mir-missing-reachable, r=petrochenkov
Set struct/union/enum fields/variants as reachable when item is

Fixes #92755
2022-01-14 06:29:32 +00:00
Michael Goulet
867554ad7c Fix suggesting turbofish with lifetime arguments 2022-01-13 19:45:29 -08:00
bors
f312a5e610 Auto merge of #92844 - matthiaskrgr:rollup-z5wb6yi, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #90001 (Make rlib metadata strip works with MIPSr6 architecture)
 - #91687 (rustdoc: do not emit tuple variant fields if none are documented)
 - #91938 (Add `std::error::Report` type)
 - #92006 (Welcome opaque types into the fold)
 - #92142 ([code coverage] Fix missing dead code in modules that are never called)
 - #92277 (rustc_metadata: Stop passing `CrateMetadataRef` by reference (step 1))
 - #92334 (rustdoc: Preserve rendering of macro_rules matchers when possible)
 - #92807 (Update cargo)
 - #92832 (Update RELEASES for 1.58.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-14 03:17:11 +00:00
Lamb
1b2c64d223 fix: set struct/union/enum fields/variants as reachable when item is 2022-01-14 02:59:16 +00:00
Ellen
73945fd620 fix bug 2022-01-14 00:27:12 +00:00
Esteban Kuber
cfc0bd1258 Parse Ty? as Option<Ty> and provide structured suggestion
Swift has specific syntax that desugars to `Option<T>` similar to our
`?` operator, which means that people might try to use it in Rust. Parse
it and gracefully recover.
2022-01-14 00:07:23 +00:00
Eric Holk
a1173cf074 Fix non-MSVC test 2022-01-13 15:56:51 -08:00
Eric Holk
05e1f0d769 Generate more precise generator names
Currently all generators are named with a `generator$N` suffix,
regardless of where they come from. This means an `async fn` shows up as
a generator in stack traces, which can be surprising to async
programmers since they should not need to know that async functions are
implementated using generators.

This change generators a different name depending on the generator kind,
allowing us to tell whether the generator is the result of an async
block, an async closure, an async fn, or a plain generator.
2022-01-13 15:38:03 -08:00
pierwill
7e055c6837 librustdoc: Address some clippy lints
Also ignore clippy's "collapsible if..." lints.
2022-01-13 16:29:39 -06:00
Maxwase
a7092f91a6 Typos fix 2022-01-14 00:17:11 +03:00
Mahdi Dibaiee
ae20500d76
rustdoc: add intra-doc trait impl test for extern types 2022-01-13 20:23:24 +00:00
Mahdi Dibaiee
9ff8ae097e
rustdoc: fix intra-link for generic trait impls 2022-01-13 20:23:24 +00:00
Guillaume Gomez
241d97750f Update documentation for doc_cfg 2022-01-13 21:08:02 +01:00
Jack Huey
e8e32e48c4 Ignore static lifetimes for GATs outlives lint 2022-01-13 15:07:12 -05:00
lolo.branstett@numericable.fr
d5871d09f1 Fix and improve missing dot in the item heading 2022-01-13 20:48:43 +01:00
Rune Tynan
474e091160 Move FIXME to if statement 2022-01-13 14:46:04 -05:00
Rune Tynan
aafcbf1e70 Update comment to make it a FIXME 2022-01-13 14:43:32 -05:00
Rune Tynan
a6aa3cb2c1 inline ItemId method, clarify comments a bit 2022-01-13 14:40:28 -05:00
bors
22e491ac7e Auto merge of #89861 - nbdd0121:closure, r=wesleywiser
Closure capture cleanup & refactor

Follow up of #89648

Each commit is self-contained and the rationale/changes are documented in the commit message, so it's advisable to review commit by commit.

The code is significantly cleaner (at least IMO), but that could have some perf implication, so I'd suggest a perf run.

r? `@wesleywiser`
cc `@arora-aman`
2022-01-13 18:51:07 +00:00
Rune Tynan
74f0e582be Fix typo in test 2022-01-13 13:25:11 -05:00
Rune Tynan
aa523a9b4b Fix errors on blanket impls by ignoring the children of their generated implementations 2022-01-13 12:40:07 -05:00
Andy Russell
51d7665be1
rustdoc: remove hand-rolled isatty 2022-01-13 11:13:01 -05:00
Loïc BRANSTETT
b8ef148eff Regenerate the PNGs favicon with the updated Rust logo 2022-01-13 14:45:10 +01:00
Loïc BRANSTETT
bc6b199588 Use the updated Rust logo and change it's format to SVG 2022-01-13 14:44:30 +01:00
flip1995
b83c77cb7c
Fix Clippy sync fallout 2022-01-13 13:37:29 +01:00
flip1995
ba66384447
Merge commit '97a5daa65908e59744e2bc625b14849352231c75' into clippyup 2022-01-13 13:18:19 +01:00
Matthias Krüger
a9fe2b95da
Rollup merge of #92807 - ehuss:update-cargo, r=ehuss
Update cargo

6 commits in 358e79fe56fe374649275ca7aebaafd57ade0e8d..06b9d31743210b788b130c8a484c2838afa6fc27
2022-01-04 18:39:45 +0000 to 2022-01-11 23:47:29 +0000
- Port cargo to clap3 (rust-lang/cargo#10265)
- feat: support rustflags per profile (rust-lang/cargo#10217)
- Make bors ignore the PR template so it doesn't end up in merge messages (rust-lang/cargo#10267)
- Be resilient to most IO error and filesystem loop while walking dirs (rust-lang/cargo#10214)
- Remove the option to disable pipelining (rust-lang/cargo#10258)
- Always ask rustc for messages about artifacts, and always process them (rust-lang/cargo#10255)
2022-01-13 08:11:22 +01:00
Matthias Krüger
ac81a13640
Rollup merge of #92334 - dtolnay:rustdocmatcher, r=camelid,GuillaumeGomez
rustdoc: Preserve rendering of macro_rules matchers when possible

Fixes #92331. This approach restores the behavior prior to #86282 **if** the matcher token held by the compiler **and** the matcher token found in the source code are identical TokenTrees. Thus #86208 remains fixed, but without regressing formatting for the vast majority of macros which are not macro-generated.
2022-01-13 08:11:22 +01:00
Matthias Krüger
5e04f513cd
Rollup merge of #92142 - wesleywiser:fix_codecoverage_partitioning, r=tmandry
[code coverage] Fix missing dead code in modules that are never called

The issue here is that the logic used to determine which CGU to put the dead function stubs in doesn't handle cases where a module is never assigned to a CGU (which is what happens when all of the code in the module is dead).

The partitioning logic also caused issues in #85461 where inline functions were duplicated into multiple CGUs resulting in duplicate symbols.

This commit fixes the issue by removing the complex logic used to assign dead code stubs to CGUs and replaces it with a much simpler model: we pick one CGU to hold all the dead code stubs. We pick a CGU which has exported items which increases the likelihood the linker won't throw away our dead functions and we pick the smallest to minimize the impact on compilation times for crates with very large CGUs.

Fixes #91661
Fixes #86177
Fixes #85718
Fixes #79622

r? ```@tmandry```
cc ```@richkadel```

This PR is not urgent so please don't let it interrupt your holidays! 🎄 🎁
2022-01-13 08:11:20 +01:00
Matthias Krüger
b45a819bef
Rollup merge of #92006 - oli-obk:welcome_opaque_types_into_the_fold, r=nikomatsakis
Welcome opaque types into the fold

r? ```@nikomatsakis``` because idk who else to bug on the type_op changes

The commits have explanations in them. The TLDR is that

* 5c46002273 stops the "recurse and replace" scheme that replaces opaque types with their canonical inference var by just doing that ahead of time
* bdeeb07bf6 does not affect anything on master afaict, but since opaque types generate obligations when instantiated, and lazy TAIT instantiates opaque types *everywhere*, we need to properly handle obligations here instead of just hoping no problematic obligations ever come up.
2022-01-13 08:11:19 +01:00
Matthias Krüger
3e7bc08b6c
Rollup merge of #91687 - euclio:tuple-variant-field-section, r=GuillaumeGomez
rustdoc: do not emit tuple variant fields if none are documented

Fixes #90824.

Before:

![2021-12-15T22:26:41](https://user-images.githubusercontent.com/1372438/146302871-4d265433-b9aa-4e53-adfb-e7cb92107180.png)

After:

![2021-12-15T22:27:01](https://user-images.githubusercontent.com/1372438/146302872-e39eda3d-2fb2-4fb9-aae7-2008e4e1b4dd.png)
2022-01-13 08:11:17 +01:00
Matthias Krüger
c7ada001ec
Rollup merge of #90001 - Fearyncess:master, r=alexcrichton
Make rlib metadata strip works with MIPSr6 architecture

Because MIPSr6 has many differences with previous MIPSr2 arch, the previous rlib metadata stripping code in `rustc_codegen_ssa` is only for MIPSr2/r3/r5 (which share the same elf e_flags).

This commit fixed this problem. It makes `rustc_codegen_ssa` happy when compiling rustc for MIPSr6 target or hosts.

e_flags REF: e356027016/llvm/include/llvm/BinaryFormat/ELF.h (L562)
2022-01-13 08:11:16 +01:00
bors
e916815d21 Auto merge of #92526 - djc:rustdoc-askama, r=jsha
Migrate rustdoc from Tera to Askama

See #84419.

Should probably get a benchmarking run to verify if it has the intended effect on rustdoc performance.

cc `@jsha` `@jyn514.`
2022-01-13 00:29:34 +00:00
Camille GILLOT
441c1a6c50 Bless tests. 2022-01-12 23:41:28 +01:00
Camille GILLOT
2e0a80c8c0 Err about fn traits in a single place. 2022-01-12 23:13:52 +01:00
pierwill
68515cb668 Rename environment variable for overriding rustc version 2022-01-12 15:31:26 -06:00
Tomasz Miąsko
d4fb6ec683 Remove LLVM-style inline assembly from rustfmt 2022-01-12 21:43:35 +01:00
Michael Goulet
8568f44fe1 suggest deref/unboxing before wrapping variant 2022-01-12 12:01:01 -08:00
Richard Cobbe
0cf7fd1208 Call out to binutils' dlltool for raw-dylib on windows-gnu platforms. 2022-01-12 10:25:35 -08:00
Tomasz Miąsko
d60edea2bd Remove LLVM-style inline assembly from clippy 2022-01-12 18:51:32 +01:00
Tomasz Miąsko
064eda47f1 Migrate intrinsic-unreachable test to asm! 2022-01-12 18:51:32 +01:00
Tomasz Miąsko
02e6c64a04 Migrate inline assembly incremental tests to asm! 2022-01-12 18:51:32 +01:00
Tomasz Miąsko
cc20dd49de Migrate abi-sysv64 abi-sysv64-register-usage test to asm! 2022-01-12 18:51:32 +01:00
Tomasz Miąsko
0b315250b8 Use black_box intrinsic in out-of-stack test 2022-01-12 18:51:31 +01:00
Tomasz Miąsko
c7d591dc28 Remove pretty tests for LLVM-style inline assembly 2022-01-12 18:51:31 +01:00
Tomasz Miąsko
11d014d05a Remove codegen tests for LLLVM-style inline assembly 2022-01-12 18:51:31 +01:00
Tomasz Miąsko
47b1c16fcd Remove mir-opt tests for LLVM-style inline assembly 2022-01-12 18:51:31 +01:00
Tomasz Miąsko
61c233bac3 Remove ui tests for LLVM-style inline assembly 2022-01-12 18:51:31 +01:00
Tomasz Miąsko
a76577cb8a Remove LLVM-style inline assembly from unstable book 2022-01-12 18:51:31 +01:00
Michael Goulet
7bf0cb7671 Add new tests, fix up old tests 2022-01-12 08:28:41 -08:00
Matthias Krüger
05dd1e4a2b
Rollup merge of #92764 - GuillaumeGomez:fix-rust-logo-style, r=jsha
Fix rust logo style

The style on the rust logo is currently broken:

![Screenshot from 2022-01-11 13-36-30](https://user-images.githubusercontent.com/3050060/148946754-a1a57253-bed0-44cf-a41c-83e0eecbd6b5.png)

With this fix, we're back to normal:

![Screenshot from 2022-01-11 13-42-07](https://user-images.githubusercontent.com/3050060/148946778-99f44678-aac1-419f-bb8c-ffa837e0c1ee.png)

I also used a GUI test to prevent future silent regressions.

r? ```@jsha```
2022-01-12 07:12:19 +01:00
Matthias Krüger
8f002a0a83
Rollup merge of #92756 - lnicola:rust-analyzer-2022-01-11, r=lnicola
⬆️ rust-analyzer

r? ```@ghost```
2022-01-12 07:12:17 +01:00
Matthias Krüger
bc0a165240
Rollup merge of #92742 - GuillaumeGomez:missing-suffix-sidebar-items, r=notriddle
Add missing suffix for sidebar-items script path

Fixes https://github.com/rust-lang/docs.rs/issues/1590.

r? ```@syphar```
2022-01-12 07:12:15 +01:00
Matthias Krüger
eecdfe526f
Rollup merge of #92732 - wesleywiser:note_musl_patch_info, r=Mark-Simulacrum
Add note about upstream commit musl-patch-configure.diff is derived from

The patch landed in upstream over the weekend so I'm adding a note so we can more easily track when our patch file can be removed.
2022-01-12 07:12:14 +01:00
Matthias Krüger
cfb9306ef9
Rollup merge of #92707 - JohnScience:patch-1, r=GuillaumeGomez
Extended the note on the use of `no_run` attribute
2022-01-12 07:12:11 +01:00
Matthias Krüger
b24b0fdcd0
Rollup merge of #92699 - camelid:private-fields, r=jsha
rustdoc: Display "private fields" instead of "fields omitted"

Also:

  * Always use `/* */` block comments
  * Use the same message everywhere, rather than sometimes prefixing
    with "some"

When I first read rustdoc docs, I was confused why the fields were being
omitted. It was only later that I realized it was because they were
private. It's also always bothered me that rustdoc sometimes uses `//`
and sometimes uses `/*` comments for these messages, so this change
makes them all use `/*`.

Technically, I think fields can be omitted if they are public but
`doc(hidden)` too, but `doc(hidden)` is analogous to privacy. It's
really just used to emulate "doc privacy" when -- because of technical
limitations -- an item has to be public. So I think it's fine to include
this under the category of "private fields".

r? ```@jsha```
2022-01-12 07:12:09 +01:00
Matthias Krüger
6726f1e013
Rollup merge of #92432 - fee1-dead:constck-impl-constness, r=oli-obk
Error when selected impl is not const in constck

Catches bad things when checking a `default_method_body_is_const` body, such as:

```rust
self.map(/* .. */).is_sorted();
```

When `Map` does not yet have a `const` `impl` for `Iterator`.

r? ```@oli-obk```
2022-01-12 07:12:06 +01:00
Michael Goulet
40f33a7a4c Deduplicate box deref and regular deref suggestions 2022-01-11 21:13:45 -08:00
Eric Huss
66f1e322c6 Update cargo 2022-01-11 20:18:29 -08:00
Noah Lev
c84f2b27d3 Remove some unnecessary uses of FieldDef::ident 2022-01-11 17:03:45 -08:00
Andy Russell
4193f2da2d
rustdoc: do not emit tuple variant fields if none are documented 2022-01-11 16:44:03 -05:00
Mahdi Dibaiee
2728af7bc0
rustc_pass_by_value: handle inferred generic types (with _) 2022-01-11 21:28:04 +00:00
bors
72e74d7b9c Auto merge of #92533 - Aaron1011:variant-symbol, r=petrochenkov
Store a `Symbol` instead of an `Ident` in `VariantDef`/`FieldDef`

The field is also renamed from `ident` to `name`. In most cases,
we don't actually need the `Span`. A new `ident` method is added
to `VariantDef` and `FieldDef`, which constructs the full `Ident`
using `tcx.def_ident_span()`. This method is used in the cases
where we actually need an `Ident`.

This makes incremental compilation properly track changes
to the `Span`, without all of the invalidations caused by storing
a `Span` directly via an `Ident`.
2022-01-11 21:02:01 +00:00
Fabian Wolff
bd1f09d417 Annotate dead code lint with notes about ignored derived impls 2022-01-11 21:06:18 +01:00
Mahdi Dibaiee
959bf2bc2e
rustc_pass_by_value: handle generic and const type parameters 2022-01-11 19:59:06 +00:00
bors
1409c015b4 Auto merge of #90948 - oli-obk:🧹, r=nikomatsakis
Actually instantiate the opaque type when checking bounds

Before this change, `instantiate_opaque_types` was a no-op, because it only works relative to the defined opaque type inference anchor. If it is a no-op, the for loop will not actually have anything to iterate over, and thus nothing is checked at all.
2022-01-11 17:31:07 +00:00
Deadbeef
bf5130b502
Add test 2022-01-11 23:52:24 +08:00
Arlo Siemsen
b03fc76dcc Use the new language identifier for Rust in the PDB debug format
Rust currently identifies as MASM (Microsoft Assembler) in the PDB
debug info format on Windows because no identifier was available.

This change pulls in a cherry-pick to Rust's LLVM that includes the
change to use the new identifier for Rust.

https://docs.microsoft.com/en-us/visualstudio/debugger/debug-interface-access/cv-cfl-lang
2022-01-11 07:41:27 -08:00
Aaron Hill
450ef8613c
Store a Symbol instead of an Ident in VariantDef/FieldDef
The field is also renamed from `ident` to `name. In most cases,
we don't actually need the `Span`. A new `ident` method is added
to `VariantDef` and `FieldDef`, which constructs the full `Ident`
using `tcx.def_ident_span()`. This method is used in the cases
where we actually need an `Ident`.

This makes incremental compilation properly track changes
to the `Span`, without all of the invalidations caused by storing
a `Span` directly via an `Ident`.
2022-01-11 10:16:22 -05:00
Guillaume Gomez
24c6e963d0 Add GUI test for rust logo style in the sidebars 2022-01-11 13:57:17 +01:00
Guillaume Gomez
9234c0fd52 Fix style for rust logo 2022-01-11 13:42:20 +01:00
Mahdi Dibaiee
a6762e962e
rustc_pass_by_value: allow types with no parameters on self
includes minor refactorings
2022-01-11 09:28:13 +00:00
Laurențiu Nicola
22d4e97d6d ⬆️ rust-analyzer 2022-01-11 07:20:40 +02:00
Noah Lev
28d2353f3b Update some comments post the side channel removal 2022-01-10 19:23:26 -08:00
Noah Lev
895fa9cd5c Extract functions for two closures
These closures were quite complex and part of a quite complex function.
The fact that they are closures makes mistakes likely when refactoring.
For example, earlier, I meant to use `resolved`, an argument of the
closure, but I instead typed `res`, which captured a local variable and
caused a subtle bug that led to a confusing test failure.

Extracting them as functions makes the code easier to understand and
refactor.
2022-01-10 19:23:26 -08:00
Noah Lev
a5f09f74d6 Update comment and make code clearer
I'm still not sure why this hack works so seemingly well.
2022-01-10 19:23:26 -08:00
Noah Lev
591ec49df3 Remove unnecessary conditional for suggesting disambiguator
Now that `res` is used directly, it seems the conditional is
unnecessary.
2022-01-10 19:23:26 -08:00
Noah Lev
9acd813380 Use Res instead of Disambiguator for resolved in report_mismatch
This allows simplifying a lot of code. It also fixes a subtle bug,
exemplified by the test output changes.
2022-01-10 19:23:26 -08:00
Noah Lev
977a7ca2e4 Add test for disambiguator mismatch with crate
This currently calls `std` a "crate" in one part of the message and a
"module" in another part. The next commits fix this so it says "crate"
in both places.
2022-01-10 19:23:26 -08:00
Noah Lev
ca20d64fb7 Enable ignored part of test
Inherent associated types *are* supported, just unstable.
2022-01-10 19:23:26 -08:00
Noah Lev
e18b23b7f4 Move two intra-doc-link tests into the intra-doc folder 2022-01-10 19:23:26 -08:00
Noah Lev
49553bbc98 Remove hack that is no longer necessary
This hack was added in 6ab1f05697.
I don't know what change allowed removing the hack, but that commit
added a test (which I presume covered the hack's behavior), and all
tests are passing with this change. So, I think it should be good.
2022-01-10 19:23:25 -08:00
Maybe Waffle
4ccfa97021 Add a test for ungated #[rustc_must_implement_one_of]
This test checks that `#[rustc_must_implement_one_of]` is gated behind
`#![feature(rustc_attrs)]`.
2022-01-11 03:39:43 +03:00
bors
1f213d983d Auto merge of #92601 - camelid:more-intra-doc-cleanup, r=Manishearth
rustdoc: Remove the intra-doc links side channel

The side channel made the code much more complex and harder to
understand. It was added as a temporary workaround in
0c99d806ea, but it's no longer necessary.

The addition of `UrlFragment` in #92088 was the key to getting rid of
the side channel. The semantic information (rather than the strings that
used to be used for fragments) that is now captured by `UrlFragment` is
enough to obviate the side channel. An additional change had to be made
to `UrlFragment` in this PR to make this possible: it now records
`DefId`s rather than item names.

This PR also consolidates the checks for anchor conflicts into one place.

r? `@Manishearth`
2022-01-11 00:08:23 +00:00
Guillaume Gomez
881b427fa3 Add missing suffix for sidebar-items script path 2022-01-10 21:01:09 +01:00
Josh Stone
f3b8812f24 Update rayon and rustc-rayon 2022-01-10 11:34:07 -08:00
Mahdi Dibaiee
71e3314673
rustc_pass_by_value remove dependency on rustc_diagnostic_item 2022-01-10 18:16:13 +00:00
Mahdi Dibaiee
91ed6892f7
rustc_pass_by_value lint: add test on custom types 2022-01-10 17:42:20 +00:00
Dirkjan Ochtman
ef96d573bf Remove configuration which became unused in 8abb4bb698 2022-01-10 18:40:57 +01:00
Dirkjan Ochtman
b00d6668b7 Address feedback 2022-01-10 18:40:57 +01:00
Dirkjan Ochtman
93a16cb7e2 Migrate rustdoc from Tera to Askama
See #84419.
2022-01-10 18:40:54 +01:00
Wesley Wiser
55abf38bf2 Add note about upstream commit musl-patch-configure.diff is derived from 2022-01-10 10:41:31 -05:00
Wesley Wiser
e9cac4ca62 Ignore unused_mod.rs file in code coverage results
As discussed in
https://github.com/rust-lang/rust/pull/92142#issuecomment-1008239473,
tests that contain multiple files order their results differently on
Windows and Linux which the test runner currently can't handle
correctly. For now, ignore the "bin" part of the test and only include
the unused library dependency which is what the test really cares about
anyway.
2022-01-10 10:31:22 -05:00
bors
89b9f7b284 Auto merge of #92719 - matthiaskrgr:rollup-tc7oqys, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #92248 (Normalize struct tail type when checking Pointee trait)
 - #92357 (Fix invalid removal of newlines from doc comments)
 - #92602 (Make source links look cleaner)
 - #92636 (Normalize generator-local types with unevaluated constants)
 - #92693 (Release notes: add `Result::unwrap_{,err_}unchecked`)
 - #92702 (Clean up lang_items::extract)
 - #92717 (update miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-10 11:53:15 +00:00
Vadim Petrochenkov
e87ce7ad74 expand: Pick cfgs and cfg_attrs one by one, like other attributes 2022-01-10 18:11:44 +08:00
Matthias Krüger
3d5db0e6b4
Rollup merge of #92717 - RalfJung:miri, r=RalfJung
update miri

Fixes https://github.com/rust-lang/rust/issues/92691
r? `@ghost`
2022-01-10 11:03:12 +01:00
Matthias Krüger
ca9fc28f0b
Rollup merge of #92636 - compiler-errors:normalize-generator-const-expr, r=oli-obk
Normalize generator-local types with unevaluated constants

Normalize generator-interior types in addition to (i.e. instead of just) erasing regions, since sometimes we collect types with unevaluated const exprs.

Fixes #84737
Fixes #88171
Fixes #92091
Fixes #92634
Probably also fixes #73114, but that one has no code I could test. It looks like it's the same issue, though.
2022-01-10 11:03:07 +01:00
Matthias Krüger
a4ac4fae41
Rollup merge of #92602 - jsha:source-link-2, r=GuillaumeGomez
Make source links look cleaner

Change from syntaxy-looking [src] to the plain word "source".

Change the syntaxy-looking `[-]` at the top of the page to say "collapse".

Reduce opacity of rightside content.

Part of #59851

r? `@GuillaumeGomez`

Demo: https://rustdoc.crud.net/jsha/source-link-2/std/string/struct.String.html

[Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/display.20of.20source.20link).
2022-01-10 11:03:06 +01:00
Matthias Krüger
d20affbf8d
Rollup merge of #92357 - GuillaumeGomez:fix-doc-comment-backline-removal, r=camelid
Fix invalid removal of newlines from doc comments

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

Before:

![Screenshot from 2021-12-28 17-02-11](https://user-images.githubusercontent.com/3050060/147585187-c8e67531-c1b4-457d-9d30-d5b44bf91fea.png)

After:

![Screenshot from 2021-12-28 17-02-25](https://user-images.githubusercontent.com/3050060/147585190-30aa0398-1fc7-4fe7-9e8b-5c475d4f9613.png)

r? `@camelid`
2022-01-10 11:03:05 +01:00
Matthias Krüger
6466f89fc5
Rollup merge of #92248 - compiler-errors:normalize-type-for-pointee, r=jackh726
Normalize struct tail type when checking Pointee trait

Let's go ahead and implement the FIXMEs by properly normalizing the struct-tail type when satisfying a Pointee obligation. This should fix the ICE when we try to calculate a layout depending on `<Ty as Pointee>::Metadata` later.
Fixes #92128
Fixes #92577

Additionally, mark the obligation as ambiguous if there are any infer types in that struct-tail type. This has the effect of causing `<_ as Pointee>::Metadata` to be properly replaced with an infer variable ([here](https://github.com/rust-lang/rust/blob/master/compiler/rustc_trait_selection/src/traits/project.rs#L813)) and registered as an obligation... this turns out to be very important in unifying function parameters with formals that are assoc types.

Fixes #91446
2022-01-10 11:03:03 +01:00
Ralf Jung
c8ff80477e miri 2022-01-10 10:27:34 +01:00
Jack Huey
ad57295fc9 Elaborate param_env predicates when checking if type outlives involving projection holds 2022-01-10 00:29:06 -05:00
Dmitrii - Demenev
8fd8db5c29
Extended the note on the use of no_run attribute 2022-01-09 19:17:15 -05:00
Lamb
3a77bb86ff Compute most of Public/Exported access level in rustc_resolve
Mak DefId to AccessLevel map in resolve for export

hir_id to accesslevel in resolve and applied in privacy
using local def id
removing tracing probes
making function not recursive and adding comments

Move most of Exported/Public res to rustc_resolve

moving public/export res to resolve

fix missing stability attributes in core, std and alloc

move code to access_levels.rs

return for some kinds instead of going through them

Export correctness, macro changes, comments

add comment for import binding

add comment for import binding

renmae to access level visitor, remove comments, move fn as closure, remove new_key

fmt

fix rebase

fix rebase

fmt

fmt

fix: move macro def to rustc_resolve

fix: reachable AccessLevel for enum variants

fmt

fix: missing stability attributes for other architectures

allow unreachable pub in rustfmt

fix: missing impl access level + renaming export to reexport

Missing impl access level was found thanks to a test in clippy
2022-01-09 21:33:14 +00:00
Eric Huss
b59e743666 Mark windows_subsytem and no_builtins as crate-only attributes.
These attributes are only checked at the crate root, so they should
have a warning if they are used anywhere else.
2022-01-09 13:08:30 -08:00
Noah Lev
2b70a3df7a Display "private fields" instead of "fields omitted"
Also:

  * Always use `/* */` block comments
  * Use the same message everywhere, rather than sometimes prefixing
    with "some"

When I first read rustdoc docs, I was confused why the fields were being
omitted. It was only later that I realized it was because they were
private. It's also always bothered me that rustdoc sometimes uses `//`
and sometimes uses `/*` comments for these messages, so this change
makes them all use `/*`.

Technically, I think fields can be omitted if they are public but
`doc(hidden)` too, but `doc(hidden)` is analogous to privacy. It's
really just used to emulate "doc privacy" when -- because of technical
limitations -- an item has to be public. So I think it's fine to include
this under the category of "private fields".
2022-01-09 12:48:28 -08:00
Eric Huss
59d4bae018 Add validation for link attribute position. 2022-01-09 11:28:40 -08:00
bors
092e1c9d23 Auto merge of #92534 - Aaron1011:hash-hir, r=petrochenkov
Hash `Ident` spans in all HIR structures

This PR removes all of the `#[stable_hasher(project(name))]`
attributes used in HIR structs. While these attributes are not known
to be causing any issues in practice, we need to hash these in
order for the incremental system to work correctly -
a query could be otherwise be incorrectly marked green
when a change occures in one of the `Span`s that it uses.
2022-01-09 16:03:41 +00:00
Mahdi Dibaiee
4c3e330a8c
feat: pass_by_value lint attribute
Useful for thin wrapper attributes that are best passed as value instead
of reference.
2022-01-09 13:05:51 +00:00
bors
f7bb8e3677 Auto merge of #92690 - matthiaskrgr:rollup-rw0oz05, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #92055 (Add release notes for 1.58)
 - #92490 (Move crate drop-down to search results page)
 - #92510 (Don't resolve blocks in foreign functions)
 - #92573 (expand: Refactor InvocationCollector visitor for better code reuse)
 - #92608 (rustdoc: Introduce a resolver cache for sharing data between early doc link resolution and later passes)
 - #92657 (Implemented const casts of raw pointers)
 - #92671 (Make `Atomic*::from_mut` return `&mut Atomic*`)
 - #92673 (Remove useless collapse toggle on "all items" page)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-09 12:43:37 +00:00
Matthias Krüger
e6aa48d3a7
Rollup merge of #92673 - GuillaumeGomez:remove-all-items-toggle, r=jsha
Remove useless collapse toggle on "all items" page

When clicking on this toggle, nothing happens because there is nothing to collapse. Instead of keeping it around, let's just remove it.

Before:

![Screenshot from 2022-01-08 16-02-38](https://user-images.githubusercontent.com/3050060/148649149-821a1e77-8c34-4975-b50a-984ca8865518.png)

After:

![Screenshot from 2022-01-08 16-02-32](https://user-images.githubusercontent.com/3050060/148649154-b5912a97-9229-46bd-be3c-df3c3fa3ac8f.png)

r? `@jsha`
2022-01-09 13:38:34 +01:00
Matthias Krüger
51001b35bd
Rollup merge of #92608 - petrochenkov:doctrscope3, r=CraftSpider
rustdoc: Introduce a resolver cache for sharing data between early doc link resolution and later passes

The refactoring parts of https://github.com/rust-lang/rust/pull/88679, shouldn't cause any slowdowns.
r? `@jyn514`
2022-01-09 13:38:32 +01:00
Matthias Krüger
464a0813d1
Rollup merge of #92510 - inquisitivecrystal:foreign-block, r=cjgillot
Don't resolve blocks in foreign functions

Although it is an error for a foreign function to have a block, it is still possible at the level of the AST. #74204 made AST lowering skip over blocks belonging to foreign functions, since they're invalid. However, resolve still treated these blocks normally, resulting in a mismatch between the HIR and resolve, which could cause an ICE under certain circumstances. This PR changes resolve to skip over blocks belonging to foreign functions, as AST lowering does.

Fixes #91370.

r? ``@cjgillot``
2022-01-09 13:38:30 +01:00
Matthias Krüger
598364c995
Rollup merge of #92490 - jsha:crates-in-results, r=GuillaumeGomez
Move crate drop-down to search results page

This reduces clutter on doc pages.

Part of #59840

r? ```@GuillaumeGomez```

Demo: https://rustdoc.crud.net/jsha/crates-in-results/std/index.html?search=str
2022-01-09 13:38:29 +01:00
Waffle Maybe
96b2f8ac32 Apply suggestions from code review
Use "(associated) function" terminology instead of "method".

Co-authored-by: Daniel Henry-Mantilla <daniel.henry.mantilla@gmail.com>
2022-01-09 12:21:33 +03:00
Maybe Waffle
268ae9a232 Move #[rustc_must_implement_one_of] tests to fix tidy check 2022-01-09 12:21:33 +03:00
Maybe Waffle
e6bc0ac6f3 Add test for misused #[rustc_must_implement_one_of] 2022-01-09 12:21:33 +03:00
Maybe Waffle
5ab40c8f99 Implement #[rustc_must_implement_one_of] attribute 2022-01-09 12:21:23 +03:00
Vadim Petrochenkov
4b03fd910c rustc_middle: Rename Export to ModChild and add some comments
Also rename `module_exports`/`export_map` to `module_reexports`/`reexport_map` for clarity.
2022-01-09 09:22:07 +08:00
Vadim Petrochenkov
3051f6e9c4 rustc_metadata: Rename item_children(_untracked) to module_children(_untracked)
And `each_child_of_item` to `for_each_module_child`
2022-01-09 09:22:06 +08:00
Vadim Petrochenkov
96c6a50e96 rustc_metadata: Optimize and document module children decoding 2022-01-09 09:22:04 +08:00
bors
23ce5fc465 Auto merge of #92068 - fee1-dead:libcore2021, r=m-ou-se
Switch all libraries to the 2021 edition

The fix for https://github.com/rust-lang/rust/issues/88638#issuecomment-996620107 is to simply add const-stability for these functions.

r? `@m-ou-se`

Closes #88638.
2022-01-08 21:41:48 +00:00
Camille GILLOT
1be6e2d6e9 Link impl items to corresponding trait items in late resolver. 2022-01-08 20:45:59 +01:00
bors
488acf86a7 Auto merge of #90639 - matthewjasper:leaf-def-cache, r=cjgillot
Add a query for resolving an impl item from the trait item

This makes finding the item in an impl that implements a given trait item a query. This is for a few reasons:

- To slightly improve performance
- To avoid having to do name resolution during monomorphisation
- To make it easier to implement potential future features that create anonymous associated items
2022-01-08 15:20:33 +00:00
Guillaume Gomez
45a43debb6 Remove useless collapse toggle on "all items" page 2022-01-08 16:03:44 +01:00
Jacob Hoffman-Andrews
962c0a4ee5 Make source links look cleaner
Change from syntaxy-looking [src] to the plain word "source".
2022-01-08 09:49:41 -05:00
bors
66f64a441a Auto merge of #92639 - pietroalbini:bump-version, r=pietroalbini
Bump version to 1.60.0

Part of the release process, cc `@rust-lang/release`

r? `@ghost`
2022-01-08 12:06:40 +00:00
bors
02822334e9 Auto merge of #91305 - camelid:rm-cond, r=GuillaumeGomez
rustdoc: Remove apparently unnecessary conditional in `doc_value`

I need to remove this conditional for #91072, but while it seems
unnecessary, we are not certain. So, the plan is to first remove the
conditional and see if any regressions pop up before doing the refactor.
This way, it will be easier to revert if there are subtle regressions.

r? `@jyn514`
2022-01-08 08:55:46 +00:00
Lain Yang
cf36c21b28 tidy: add ahash to permitted dep list 2022-01-08 16:27:58 +08:00
Eric Huss
759b13eb6c
Rollup merge of #92610 - GuillaumeGomez:css-class-instead-of-inline-style, r=jsha
Create CSS class instead of using inline style for search results

I saw this change in the update you proposed in https://github.com/rust-lang/rust/pull/92404. :)

r? ``@jsha``
2022-01-07 20:21:01 -08:00
Vadim Petrochenkov
333a5cc369 mangling_v0: Skip extern blocks during mangling 2022-01-08 11:53:13 +08:00
Vadim Petrochenkov
1b8daf8c58 mangling_v0: Add a test for mangling of foreign types 2022-01-08 11:39:34 +08:00
Vadim Petrochenkov
6a1f9e6fc7 mangling_v0: Update tests for the rust-demangler tool 2022-01-08 11:39:34 +08:00
Badel2
8ef3ce866e Change panic::update_hook to simplify usage
And to remove possibility of panics while changing the panic handler,
because that resulted in a double panic.
2022-01-08 00:57:59 +01:00
Gary Guo
c84cea9c25 Flatten InferredCaptureInformation
Min capture computation can already handle the same place appearing twice,
and previous commits made CaptureInfo construction very cheap, so just
delegate all work to min capture and let InferBorrowKind and
process_collected_capture_information handle everything linearly.
2022-01-07 22:55:36 +00:00
Gary Guo
48258ffe5a Remove region from UpvarCapture and move it to CapturedPlace
Region info is completely unnecessary for upvar capture kind computation
and is only needed to create the final upvar tuple ty. Doing so makes
creation of UpvarCapture very cheap and expose further cleanup opportunity.
2022-01-07 22:55:34 +00:00
Gary Guo
3698e03fb6 Remove span from UpvarCapture::ByValue
This span is unused and is superseded by capture_kind_expr_id in CaptureInfo
2022-01-07 22:54:28 +00:00
Matthew Jasper
9e5f23e2a6 Update clippy for associated item changes 2022-01-07 13:31:46 -08:00
Badel2
8bdf5c3de6 Implement panic::update_hook 2022-01-07 17:28:20 +01:00
Pietro Albini
18d1551f3b
bump version to 1.60.0 2022-01-07 10:04:15 +01:00
Vadim Petrochenkov
5acd1f91a0 rustdoc: Introduce a resolver cache for sharing data between early doc link resolution and later passes 2022-01-07 16:21:53 +08:00
Michael Goulet
d35b23ecd8 Normalize generator-local types with unevaluated constants 2022-01-06 19:08:04 -08:00
Matthias Krüger
0c9cf9a9ea
Rollup merge of #92589 - ChrisDenton:break-loop, r=Mark-Simulacrum
Break the loop

A missing break statement lead to an infinite loop in bootstrap.py.

I also added a short sleep so it's not constantly running at 100%. But I can remove that if it's not wanted.

Fixes #76661
2022-01-06 23:15:20 +01:00
Matthias Krüger
1a8f69826c
Rollup merge of #92417 - dtolnay:printimpl, r=jackh726
Fix spacing and ordering of words in pretty printed Impl

Follow-up to #92238 fixing one of the FIXMEs.

```rust
macro_rules! repro {
    ($item:item) => {
        stringify!($item)
    };
}

fn main() {
    println!("{}", repro!(impl<T> Struct<T> {}));
    println!("{}", repro!(impl<T> const Trait for T {}));
}
```

Before:&ensp;`impl <T> Struct<T> {}`
After:&ensp;`impl<T> Struct<T> {}`

Before:&ensp;`impl const <T> Trait for T {}` 😿
After:&ensp;`impl<T> const Trait for T {}`
2022-01-06 23:15:16 +01:00
Matthias Krüger
0604cf5fd8
Rollup merge of #92207 - tmiasko:delay-drop-elaboration-bug, r=jackh726
Delay remaining `span_bug`s in drop elaboration

This follows changes from #67967 and converts remaining `span_bug`s into
delayed bugs, since for const items drop elaboration might be executed
on a MIR which failed borrowck.

Fixes #81708.
Fixes #91816.
2022-01-06 23:15:14 +01:00
Noah Lev
a626da4e78 Split out ItemFragment from UrlFragment
This allows eliminating branches in the code where a user-written
fragment is impossible.
2022-01-06 12:49:53 -08:00
Noah Lev
a69e15c501 Remove the side channel
Hooray! It was no longer used, so it can just be deleted.
2022-01-06 12:49:29 -08:00
Noah Lev
54a14e844c Remove the last use of the side channel 2022-01-06 11:48:47 -08:00
Noah Lev
fde94538bf Use fragment instead of side channel in another place 2022-01-06 11:48:47 -08:00
Noah Lev
1064003f8c Use fragment instead of side channel for prim. assoc. items
I had the epiphany that now that fragments are "semantic" -- rather than
just strings -- they fill the role that used to be handled by the side
channel. I think I may be able to get rid of the other uses of the side
channel using this technique too.
2022-01-06 11:48:47 -08:00
Noah Lev
7e3132adb3 Extract function for reporting feature gate error 2022-01-06 11:48:47 -08:00
Noah Lev
a324fc19d4 Only check for conflicting anchors in one place
This coalesces the checks into one place.
2022-01-06 11:48:47 -08:00
Noah Lev
3b50a4e286 Use DefIds instead of names in UrlFragment
This is the next step in computing more "semantic" information during
intra-doc link collection and then doing rendering all at the end.
2022-01-06 11:48:46 -08:00
Noah Lev
f89e2dd935 Move anchor conflict check to call site
I think it makes the code easier to understand.
2022-01-06 11:40:36 -08:00
bors
cfa4ac66c1 Auto merge of #92609 - matthiaskrgr:rollup-ldp47ot, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #92058 (Make Run button visible on hover)
 - #92288 (Fix a pair of mistyped test cases in `std::net::ip`)
 - #92349 (Fix rustdoc::private_doc_tests lint for public re-exported items)
 - #92360 (Some cleanups around check_argument_types)
 - #92389 (Regression test for borrowck ICE #92015)
 - #92404 (Fix font size for [src] links in headers)
 - #92443 (Rustdoc: resolve associated traits for non-generic primitive types)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-06 15:30:46 +00:00
Guillaume Gomez
26edfc9e31 Create CSS class instead of using inline style for search results 2022-01-06 15:12:01 +01:00
Matthias Krüger
26a90e4cd7
Rollup merge of #92443 - mdibaiee:90703/resolve-traits-of-primitive-types, r=Manishearth
Rustdoc: resolve associated traits for non-generic primitive types

Fixes #90703

This seems to work:
<img width="457" alt="image" src="https://user-images.githubusercontent.com/2807772/147774059-9556ff96-4519-409e-8ed0-c33ecc436171.png">

I'm just afraid I might have missed some cases / broken previous functionality.

I also have not written tests yet, I will have to take a look to see where tests are and how they are structured, but any help there is also appreciated.
2022-01-06 12:01:05 +01:00
Matthias Krüger
b510278278
Rollup merge of #92404 - GuillaumeGomez:src-font-size, r=jsha
Fix font size for [src] links in headers

Fixes #90384.

cc `@jsha`
r? `@camelid`
2022-01-06 12:01:04 +01:00
Matthias Krüger
96a267ee1f
Rollup merge of #92389 - chordtoll:test-92015, r=Mark-Simulacrum
Regression test for borrowck ICE #92015

This issue has come up a few times. Creating a regression test.
Closes #92015.
2022-01-06 12:01:03 +01:00
Matthias Krüger
fb87e7ceed
Rollup merge of #92360 - jackh726:param-heuristics-1, r=davidtwco
Some cleanups around check_argument_types

Split out in ways from my rebase/continuation of #71827

Commits are mostly self-explanatory and these changes should be fairly straightforward
2022-01-06 12:01:02 +01:00
Matthias Krüger
4d0b567efb
Rollup merge of #92349 - avitex:fix-rustdoc-private-doc-tests, r=GuillaumeGomez
Fix rustdoc::private_doc_tests lint for public re-exported items

Closes #72081

This involves changing the lint to check the access level is exported, rather than public.
The [exported access level](e91ad5fc62/compiler/rustc_middle/src/middle/privacy.rs (L24)) accounts for public items and items accessible to other crates with the help of `pub use` re-exports.
The pattern of re-exporting public items from a private module is usage seen in a number of popular crates.
2022-01-06 12:01:01 +01:00
Matthias Krüger
50d5e38800
Rollup merge of #92058 - jsha:run-on-hover, r=GuillaumeGomez
Make Run button visible on hover

This slightly reduces the noisiness of doc pages, making them easier to read.

Demo: https://rustdoc.crud.net/jsha/run-on-hover/std/string/struct.String.html

[Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.22Run.22.20button.20visible.20on.20hover).

Part of #59845
2022-01-06 12:00:59 +01:00
David Wood
7ecdc89436 Revert "bootstrap: copy llvm-dwp to sysroot"
This reverts commit 241160de72.
2022-01-06 09:32:42 +00:00
David Wood
2dc1a8a779 cg: use thorin instead of llvm-dwp
`thorin` is a Rust implementation of a DWARF packaging utility that
supports reading DWARF objects from archive files (i.e. rlibs) and
therefore is better suited for integration into rustc.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-01-06 09:32:42 +00:00
David Wood
08ed338f56 sess/cg: re-introduce split dwarf kind
In #79570, `-Z split-dwarf-kind={none,single,split}` was replaced by `-C
split-debuginfo={off,packed,unpacked}`. `-C split-debuginfo`'s packed
and unpacked aren't exact parallels to single and split, respectively.

On Unix, `-C split-debuginfo=packed` will put debuginfo into object
files and package debuginfo into a DWARF package file (`.dwp`) and
`-C split-debuginfo=unpacked` will put debuginfo into dwarf object files
and won't package it.

In the initial implementation of Split DWARF, split mode wrote sections
which did not require relocation into a DWARF object (`.dwo`) file which
was ignored by the linker and then packaged those DWARF objects into
DWARF packages (`.dwp`). In single mode, sections which did not require
relocation were written into object files but ignored by the linker and
were not packaged. However, both split and single modes could be
packaged or not, the primary difference in behaviour was where the
debuginfo sections that did not require link-time relocation were
written (in a DWARF object or the object file).

This commit re-introduces a `-Z split-dwarf-kind` flag, which can be
used to pick between split and single modes when `-C split-debuginfo` is
used to enable Split DWARF (either packed or unpacked).

Signed-off-by: David Wood <david.wood@huawei.com>
2022-01-06 09:32:42 +00:00
inquisitivecrystal
42de973099 Add regression test 2022-01-05 15:22:22 -08:00
Guillaume Gomez
3b70c6e4bd Simplify :target CSS selector 2022-01-05 21:28:19 +01:00
Chris Denton
014f22abaf
Break the loop
A missing break statement lead to an infinite loop in bootstrap.py.
2022-01-05 17:59:13 +00:00
Jacob Hoffman-Andrews
8abb4bb698 Move crate drop-down to search results page
This reduces clutter on doc pages.
2022-01-05 12:57:25 -05:00
Jacob Hoffman-Andrews
f3fe91278c Switch to es6 for eslint
Also update Node to v16.9.0, es-check to 6.1.1, and eslint to 8.6.0.
2022-01-05 11:44:29 -05:00
Guillaume Gomez
a0085f249a Add test for [src] font-size in headers 2022-01-05 17:35:06 +01:00
Guillaume Gomez
270d09dca9 Fix font size for [src] links in headers 2022-01-05 17:35:04 +01:00
bors
f1ce0e6a00 Auto merge of #92587 - matthiaskrgr:rollup-qnwa8qx, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #92092 (Drop guards in slice sorting derive src pointers from &mut T, which is invalidated by interior mutation in comparison)
 - #92388 (Fix a minor mistake in `String::try_reserve_exact` examples)
 - #92442 (Add negative `impl` for `Ord`, `PartialOrd` on `LocalDefId`)
 - #92483 (Stabilize `result_cloned` and `result_copied`)
 - #92574 (Add RISC-V detection macro and more architecture instructions)
 - #92575 (ast: Always keep a `NodeId` in `ast::Crate`)
 - #92583 (⬆️ rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-05 15:28:36 +00:00
Jacob Hoffman-Andrews
6409f0d558 Make Run button visible on hover
This slightly reduces the noisiness of doc pages, making them easier to
read.
2022-01-05 10:07:22 -05:00
Matthias Krüger
439a1254b9
Rollup merge of #92583 - lnicola:rust-analyzer-2022-01-05, r=lnicola
⬆️ rust-analyzer

r? `@ghost`
2022-01-05 15:05:50 +01:00
Matthias Krüger
5f03ae3507
Rollup merge of #92575 - petrochenkov:cratenodeid, r=Aaron1011
ast: Always keep a `NodeId` in `ast::Crate`

This makes it more uniform with other expanded nodes.
It makes generic code in https://github.com/rust-lang/rust/pull/92573 simpler in particular.

This is another follow-up to https://github.com/rust-lang/rust/pull/91313.
r? `@Aaron1011`
2022-01-05 15:05:49 +01:00
bors
181e91567c Auto merge of #92580 - matthiaskrgr:rollup-nzyn65y, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #92182 (Label more build steps)
 - #92188 (rustdoc: Clean up NestedAttributesExt trait/implementation)
 - #92322 (Add another implementation example to Debug trait)
 - #92448 (Set font size proportional to user's font size)
 - #92517 (Explicitly pass `PATH` to the Windows exe resolver)
 - #92545 (Extract init_env_logger to crate)
 - #92579 (update Miri)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-01-05 12:32:28 +00:00
Laurențiu Nicola
2687a93bc8 ⬆️ rust-analyzer 2022-01-05 13:43:32 +02:00
Matthias Krüger
a0673468ae
Rollup merge of #92579 - RalfJung:miri, r=RalfJung
update Miri

Fixes https://github.com/rust-lang/rust/issues/92527
2022-01-05 11:26:09 +01:00
Matthias Krüger
5bf321f9a4
Rollup merge of #92448 - jsha:font-size-access, r=GuillaumeGomez
Set font size proportional to user's font size

According to MDN (https://developer.mozilla.org/en-US/docs/Web/CSS/font-size),

> To maximize accessibility, it is generally best to use values that are relative to the user's default font size.

> Defining font sizes in px is not accessible, because the user cannot change the font size in some browsers.

Note that changing font size (in browser or OS settings) is distinct from the zoom functionality triggered with Ctrl/Cmd-+. Zoom
functionality increases the size of everything on the page, effectively applying a multiplier to all pixel sizes. Font size changes apply to just text.

For relative font sizes, we could use `em`, as we do in several places already. However that has a problem of "compounding" (see MDN article for details). The compounding problem is nicely solved by `rem`, which make font sizes relative to the root element, not the parent element.

Since we were using a hodge-podge of pixel sizes, em, rem, and percentage sizes before, this change switches everything to rem, while keeping the same size relative to our old default of 16px.

16px is still the default on most browsers, for users that haven't set a larger or smaller font size.

Part of #59845. Note: this will conflict with #92404. We should merge that first (once it's done) and I'll resolve the merge conflicts.

r? `@GuillaumeGomez`

Demo: https://rustdoc.crud.net/jsha/font-size-access/std/string/struct.String.html
2022-01-05 11:26:06 +01:00
Matthias Krüger
cc01433d56
Rollup merge of #92188 - vacuus:nested-attributes-ext, r=jyn514
rustdoc: Clean up NestedAttributesExt trait/implementation
2022-01-05 11:26:04 +01:00