Commit graph

136095 commits

Author SHA1 Message Date
Charles Lew
ce7de07866 Add Box::into_inner. 2021-02-09 10:28:50 +08:00
bors
26438b4738 Auto merge of #78452 - cjgillot:ddk-struct, r=Mark-Simulacrum
Access query (DepKind) metadata through fields

This refactors the access to query definition metadata (attributes such as eval always, anon, has_params) and loading/forcing functions to generate a number of structs, instead of matching on the DepKind enum. This makes access to the fields cheaper to compile. Using a struct means that finding the metadata for a given query is just an offset away; previously the match may have been compiled to a jump table but likely not completely inlined as we expect here.

A previous attempt explored a similar strategy, but using trait objects in #78314 that proved less effective, likely due to higher overheads due to forcing dynamic calls and poorer cache utilization (all metadata is fairly densely packed with this PR).
2021-01-08 18:16:00 +00:00
Camille GILLOT
0f334c3642 Check is_anon outside of can_reconstruct_query_key. 2021-01-08 18:03:27 +01:00
Camille GILLOT
5fcc537d18 Make DepConstructor a module. 2021-01-08 18:02:04 +01:00
Camille GILLOT
921b284167 Make force_from_dep_node a function pointer. 2021-01-08 18:01:50 +01:00
Camille GILLOT
bee1fbb67e Make try_load_from_on_disk_cache a function pointer. 2021-01-08 17:59:27 +01:00
Camille GILLOT
438c430c76 Make can_reconstruct_query_key a function pointer. 2021-01-08 17:57:25 +01:00
Camille GILLOT
5027f1c6ea Use a field for has_params. 2021-01-08 17:55:46 +01:00
Camille GILLOT
d8c87ac080 Use a field for is_eval_always. 2021-01-08 17:53:38 +01:00
Camille GILLOT
24f0b957e7 Use a field for is_anon. 2021-01-08 17:51:53 +01:00
Camille GILLOT
016ea6b319 Use a side-table of consts instead of matching on the DepKind enum. 2021-01-08 17:48:02 +01:00
Camille GILLOT
d1220fdedf Simplify DepNodeParams. 2021-01-08 17:29:49 +01:00
Camille GILLOT
79a57625f5 Move DepNodeExt outside of the macro. 2021-01-08 17:29:48 +01:00
bors
ddf2cc7f8e Auto merge of #76896 - spastorino:codegen-inline-fns2, r=davidtwco,wesleywiser
Do not make local copies of inline fns in debug mode

r? `@wesleywiser`

cc `@rust-lang/wg-incr-comp`

If this is correct it supersedes https://github.com/rust-lang/rust/pull/76889

Related to #54089
2021-01-08 15:21:45 +00:00
bors
937f629535 Auto merge of #80653 - jryans:doc-deref-recursive, r=jyn514,GuillaumeGomez
Recursively document methods via `Deref` traits

This changes `rustdoc` to recursively follow `Deref` targets so that methods from all levels are added to the rendered output. This implementation displays the methods from all levels in the expanded state with separate sections for each level.

![image](https://user-images.githubusercontent.com/279572/103482863-46723b00-4ddb-11eb-972b-c463351a425c.png)

Fixes https://github.com/rust-lang/rust/issues/26207
Fixes https://github.com/rust-lang/rust/issues/53038
Fixes https://github.com/rust-lang/rust/issues/71640

r? `@jyn514`
2021-01-08 12:34:20 +00:00
bors
3d8608a863 Auto merge of #80535 - JohnTitor:improve-use-diag, r=estebank
Add a note for `*` and `{}` usage on `use`

Closes #80333
2021-01-08 09:51:26 +00:00
Yuki Okushi
d063745023 Add a note for * and {} usage on use 2021-01-08 17:36:14 +09:00
J. Ryan Stinnett
ea946071dd Combine several push_str calls 2021-01-08 07:15:03 +00:00
J. Ryan Stinnett
8eaf68f92c Preserve non-local recursive Deref impls
This adjusts the `rustdoc` trait impl collection path to preserve `Deref` impls
from other crates. This adds a first pass to map all of the `Deref` type to
target edges and then recursively preserves all targets.
2021-01-08 07:15:03 +00:00
J. Ryan Stinnett
06ce97c3c9 Use target in Deref method section IDs
There can now be multiple `Deref` method sections, so this adds the target type
to the section ID to ensure they are unique.
2021-01-08 07:15:03 +00:00
J. Ryan Stinnett
fd0ad03902 Recursively document methods via Deref traits 2021-01-08 07:15:03 +00:00
bors
569e542f9f Auto merge of #80756 - sunfishcode:path-cleanup/rustc-incremental, r=nagisa
Optimize away some `fs::metadata` calls.

This also eliminates a use of a `Path` convenience function, in support
of #80741, refactoring `std::path` to focus on pure data structures and
algorithms.
2021-01-08 07:01:30 +00:00
bors
9155a9dae5 Auto merge of #80806 - JohnTitor:rollup-y64z7ph, r=JohnTitor
Rollup of 7 pull requests

Successful merges:

 - #79675 (Make sure rust-call errors occur correctly for traits)
 - #80372 (Don't panic when an external crate can't be resolved)
 - #80761 (handle generic trait methods in coverage-report tests)
 - #80785 (rustc_ast_pretty: Remove `PrintState::insert_extra_parens`)
 - #80791 (Fix type name in doc example for Iter and IterMut)
 - #80794 (Use Option::map_or instead of `.map(..).unwrap_or(..)`)
 - #80799 (Get rid of custom pretty-printing in rustdoc)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-08 03:09:03 +00:00
Yuki Okushi
dec3dbd36a
Rollup merge of #80799 - jyn514:pretty-print, r=CraftSpider
Get rid of custom pretty-printing in rustdoc

and use rustc_hir_pretty directly instead.

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

r? `@CraftSpider`
2021-01-08 11:11:50 +09:00
Yuki Okushi
faf5412cd1
Rollup merge of #80794 - LingMan:map_or, r=jyn514
Use Option::map_or instead of `.map(..).unwrap_or(..)`

r? `@jyn514`
`@rustbot` modify labels +C-cleanup +T-rustdoc
2021-01-08 11:11:48 +09:00
Yuki Okushi
1ed90e4f06
Rollup merge of #80791 - mrcz:master, r=jyn514
Fix type name in doc example for Iter and IterMut
2021-01-08 11:11:47 +09:00
Yuki Okushi
f6c58afe15
Rollup merge of #80785 - petrochenkov:prettyparen, r=Aaron1011
rustc_ast_pretty: Remove `PrintState::insert_extra_parens`

It's no longer necessary after #79472.

r? `@Aaron1011`
2021-01-08 11:11:45 +09:00
Yuki Okushi
c851ae9d26
Rollup merge of #80761 - andjo403:generic_coverage, r=spastorino
handle generic trait methods in coverage-report tests

also make the generic function pattern more specific and remove the extra $ that fails the matching.

r? `@wesleywiser`
as this was failing the test of #76896
2021-01-08 11:11:43 +09:00
Yuki Okushi
901b9a2d7b
Rollup merge of #80372 - jyn514:fix-panics, r=Manishearth
Don't panic when an external crate can't be resolved

This isn't actually a bug, it can occur when rustdoc tries to resolve a
crate that isn't used in the main code.

Fixes #72381.

r? `@kinnison` if you have time, otherwise `@Manishearth`
2021-01-08 11:11:41 +09:00
Yuki Okushi
0afd72e313
Rollup merge of #79675 - CraftSpider:79669, r=estebank
Make sure rust-call errors occur correctly for traits

Fixes #79669

Adds trait method resolution to the error, and adds UI tests to ensure it doesn't happen again. Opening as draft because I'm getting weird link errors from unrelated code on my machine, and want to see what CI thinks.
2021-01-08 11:11:34 +09:00
bors
92c625d0f7 Auto merge of #80746 - ehuss:update-cargo, r=ehuss
Update cargo

12 commits in 75d5d8cffe3464631f82dcd3c470b78dc1dda8bb..329895f5b52a358e5d9ecb26215708b5cb31d906
2020-12-22 18:10:56 +0000 to 2021-01-06 00:01:52 +0000
- metadata: Supply local path for path dependencies (rust-lang/cargo#8994)
- Add support for Rust edition 2021. (rust-lang/cargo#8922)
- Stabilize -Zfeatures and -Zpackage-features. (rust-lang/cargo#8997)
- Small refactor, adding a list of all kinds to BuildContext (rust-lang/cargo#9046)
- Fix git http.proxy config setting. (rust-lang/cargo#8986)
- Clarify the help text of `--aggressive` and `--precise` of `update` (rust-lang/cargo#9031)
- Assert that tests are run in the crate directory (rust-lang/cargo#9037)
- Update mdbook (rust-lang/cargo#9044)
- Bump to 0.52.0, update changelog (rust-lang/cargo#9042)
- Fix redundant semicolon. (rust-lang/cargo#9033)
- Clarify fingerprint log messages (rust-lang/cargo#9026)
- Update credential docs for gnome-secret. (rust-lang/cargo#9013)
2021-01-08 00:20:06 +00:00
Joshua Nelson
31375d2074 Get rid of custom pretty-printing in rustdoc
and use rustc_hir_pretty directly instead
2021-01-07 17:44:59 -05:00
Vadim Petrochenkov
f915e3e5cf rustc_ast_pretty: Remove PrintState::insert_extra_parens
It's no longer necessary after #79472
2021-01-08 00:43:38 +03:00
bors
e02b0f4a55 Auto merge of #80709 - lzutao:target-enumerate, r=petrochenkov
Limit target endian to an enum instead of free string

This is #77604 revived.
2021-01-07 21:33:57 +00:00
LingMan
961f9ee6df Use Option::map_or instead of .map(..).unwrap_or(..) 2021-01-07 20:03:59 +01:00
Andreas Jonson
4f6305bc37 handle generic trait methods in coverage tests
make the generic function pattern more specific
2021-01-07 19:40:19 +01:00
bors
c8915eebea Auto merge of #80790 - JohnTitor:rollup-js1noez, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #80012 (Add pointing const identifier when emitting E0435)
 - #80521 (MIR Inline is incompatible with coverage)
 - #80659 (Edit rustc_ast::tokenstream docs)
 - #80660 (Properly handle primitive disambiguators in rustdoc)
 - #80738 (Remove bottom margin from crate version when the docs sidebar is collapsed)
 - #80744 (rustdoc: Turn `next_def_id` comments into docs)
 - #80750 (Don't use to_string on Symbol in rustc_passes/check_attr.rs)
 - #80769 (Improve wording of parse doc)
 - #80780 (Return EOF_CHAR constant instead of magic char.)
 - #80784 (rustc_parse: Better spans for synthesized token streams)

Failed merges:

 - #80785 (rustc_ast_pretty: Remove `PrintState::insert_extra_parens`)

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-07 18:20:12 +00:00
Marcus Svensson
358ef56216 Enclose types in comments in backticks 2021-01-07 18:36:25 +01:00
Marcus Svensson
10180b4c53 Fix type name in doc example for Iter and IterMut 2021-01-07 18:22:37 +01:00
Yuki Okushi
695f878332
Rollup merge of #80784 - petrochenkov:nontspan, r=Aaron1011
rustc_parse: Better spans for synthesized token streams

I think using the nonterminal span for synthesizing its tokens is a better approximation than using `DUMMY_SP` or the attribute span like #79472 did in `expand.rs`.

r? `@Aaron1011`
2021-01-08 02:06:20 +09:00
Yuki Okushi
695f18ebab
Rollup merge of #80780 - lianghanzhen:master, r=petrochenkov
Return EOF_CHAR constant instead of magic char.
2021-01-08 02:06:18 +09:00
Yuki Okushi
a97dc5f103
Rollup merge of #80769 - ejez:patch-1, r=jonas-schievink
Improve wording of parse doc

Change:
```
`parse` can parse any type that...
```
to:
```
`parse` can parse into any type that...
```
Word `into` added to be more precise and in coherence with other parts of the doc.
2021-01-08 02:06:16 +09:00
Yuki Okushi
fd7f2443f1
Rollup merge of #80750 - GuillaumeGomez:cleanup-to_string, r=lzutao
Don't use to_string on Symbol in rustc_passes/check_attr.rs

Improve code from #80686.

r? ``@lzutao``
2021-01-08 02:06:14 +09:00
Yuki Okushi
6fb79245e8
Rollup merge of #80744 - camelid:next_def_id-docs, r=jyn514
rustdoc: Turn `next_def_id` comments into docs

Split out from #80740.

r? ``@jyn514``
2021-01-08 02:06:13 +09:00
Yuki Okushi
94a27f2617
Rollup merge of #80738 - arusahni:master, r=GuillaumeGomez
Remove bottom margin from crate version when the docs sidebar is collapsed

This fixes a mobile UI bug where a vertical scrollbar would always be
rendered on the sidebar nav when the menu was closed.  When opened, the overflow would be handled by the opened sidebar, causing the scrollbar to disappear, and the contents to shift to the right.

## Firefox
**Before**
![before-ff](https://user-images.githubusercontent.com/139487/103713599-c2f74c00-4f8a-11eb-88c0-d5c6c088f8a0.png)
![before](https://user-images.githubusercontent.com/139487/103713793-2bdec400-4f8b-11eb-8223-94b77cc05f71.gif)

**After**
![after-ff](https://user-images.githubusercontent.com/139487/103713605-c8ed2d00-4f8a-11eb-9ee8-f86cafaa8775.png)
![after](https://user-images.githubusercontent.com/139487/103713805-31d4a500-4f8b-11eb-9e5b-4156402ca43e.gif)

## Chrome
**Before**
![localhost_8000_unicode_xid_ (1)](https://user-images.githubusercontent.com/139487/103713626-d60a1c00-4f8a-11eb-8605-cc98e04e9ad0.png)

**After**
![localhost_8000_unicode_xid_](https://user-images.githubusercontent.com/139487/103713622-d1456800-4f8a-11eb-8c66-7d19f81614ca.png)
2021-01-08 02:06:11 +09:00
Yuki Okushi
2e9788b298
Rollup merge of #80660 - max-heller:issue-80559-fix, r=jyn514
Properly handle primitive disambiguators in rustdoc

Fixes #80559

r? ``@jyn514``

Is there a way to test that the generated intra-doc link is what I expect?
2021-01-08 02:06:09 +09:00
Yuki Okushi
d02b31ca3c
Rollup merge of #80659 - pierwill:edit-tokenstream, r=davidtwco
Edit rustc_ast::tokenstream docs

Fix some punctuation and wording, and add intra-documentation links.
2021-01-08 02:06:07 +09:00
Yuki Okushi
3acd75dd25
Rollup merge of #80521 - richkadel:llvm-coverage-counters-2.4.0, r=wesleywiser
MIR Inline is incompatible with coverage

Fixes: #80060

Fixed by disabling inlining if `-Zinstrument-coverage` is set.

The PR also adds additional use cases to the coverage test for doctests.

r? `@wesleywiser`
cc: `@tmandry`
2021-01-08 02:06:03 +09:00
Yuki Okushi
bb229b8f6c
Rollup merge of #80012 - sasurau4:feature/point-constant-identifier-E0435, r=petrochenkov
Add pointing const identifier when emitting E0435

Fix #79919
2021-01-08 02:05:58 +09:00
bors
8f0b945cfc Auto merge of #77853 - ijackson:slice-strip-stab, r=Amanieu
Stabilize slice::strip_prefix and slice::strip_suffix

These two methods are useful.  The corresponding methods on `str` are already stable.

I believe that stablising these now would not get in the way of, in the future, extending these to take a richer pattern API a la `str`'s patterns.

Tracking PR: #73413.  I also have an outstanding PR to improve the docs for these two functions and the corresponding ones on `str`: #75078

I have tried to follow the [instructions in the dev guide](https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#stabilization-pr).  The part to do with `compiler/rustc_feature` did not seem applicable.  I assume that's because these are just library features, so there is no corresponding machinery in rustc.
2021-01-07 15:21:30 +00:00