Commit Graph

135948 Commits

Author SHA1 Message Date
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
J. Ryan Stinnett
61c8aae0a9 Extract sidebar_deref_methods function 2021-01-04 13:27:13 +00:00
bors
6163bfdcce Auto merge of #80661 - jyn514:duplicate-types, r=GuillaumeGomez
Cleanup rustdoc handling of associated types

This is best reviewed a commit at a time. No particular reason for these changes, they just stood out as I was reviewing https://github.com/rust-lang/rust/pull/80653 and thinking about https://github.com/rust-lang/rust/issues/80379. The new test case worked before, it just wasn't tested.

r? `@GuillaumeGomez`
2021-01-04 10:32:28 +00:00
bors
887398ff68 Auto merge of #80610 - Aaron1011:unhash-def-path-hash, r=varkor
Use `UnhashMap` whenever we have a key of `DefPathHash`
2021-01-04 07:49:01 +00:00
bors
0cd459fd62 Auto merge of #80554 - GuillaumeGomez:more-js-cleanup, r=jyn514
More js cleanup

Part of #79052 (Same kind as #80515).

This one is about some small fixes:
 * Replacing some loops with `onEachLazy`.
 * Removing unused function arguments.
 * Turn `buildHelperPopup` into a variable so it can be "replaced" once the function has been called once so it's not called again.

r? `@jyn514`
2021-01-04 05:04:04 +00:00
bors
8989689e72 Auto merge of #80418 - oli-obk:this_could_have_been_so_simple, r=RalfJung
Allow references to interior mutable data behind a feature gate

supercedes #80373 by simply not checking for interior mutability on borrows of locals that have `StorageDead` and thus can never be leaked to the final value of the constant

tracking issue: https://github.com/rust-lang/rust/issues/80384

r? `@RalfJung`
2021-01-04 02:15:57 +00:00
Joshua Nelson
24ef94593c Don't clone type_ unnecessarily 2021-01-03 16:10:46 -05:00
Joshua Nelson
a786eaac1f Simplify rustdoc handling of type aliases for associated types
The logic was very hard to follow before.
2021-01-03 15:40:41 -05:00
bors
80184183ba Auto merge of #77859 - bugadani:no-duplicate-ref-link-error, r=jyn514
Rustdoc: only report broken ref-style links once

This PR assigns the markdown `LinkType` to each parsed link and passes this information into the link collector.
If a link can't be resolved in `resolve_with_disambiguator`, the failure is cached for the link types where we only want to report the error once (namely `Shortcut` and `Reference`).

Fixes  #77681
2021-01-03 20:24:16 +00:00
bors
db69136369 Auto merge of #80655 - GuillaumeGomez:rollup-ai7soid, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - #80580 (Add suggestion for "ignore" doc code block)
 - #80591 (remove allow(incomplete_features) from std)
 - #80617 (Detect invalid rustdoc test commands)
 - #80628 (reduce borrowing and (de)referencing around match patterns (clippy::match_ref_pats))
 - #80646 (Clean up in `each_child_of_item`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-01-03 17:42:27 +00:00
Dániel Buga
4b612dd9cc Only report reference-style link errors once
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-01-03 17:44:59 +01:00
Guillaume Gomez
539c435b50
Rollup merge of #80646 - bugadani:meta, r=petrochenkov
Clean up in `each_child_of_item`

This PR hopes to eliminate some of the surprising elements I encountered while reading the function.
- `macros_only` is checked against inside the loop body, but if it is `true`, the loop is skipped anyway
- only query `span` when relevant
- no need to allocate attribute vector
2021-01-03 17:09:13 +01:00
Guillaume Gomez
ff1f21a8fd
Rollup merge of #80628 - matthiaskrgr:match_ref_pats, r=varkor
reduce borrowing and (de)referencing around match patterns (clippy::match_ref_pats)
2021-01-03 17:09:11 +01:00
Guillaume Gomez
fd0dbac943
Rollup merge of #80617 - GuillaumeGomez:detect-invalid-rustdoc-test-commands, r=jyn514
Detect invalid rustdoc test commands

Fixes #80570.

There are now errors displayed in case of bad command syntax:

```
---- [rustdoc] rustdoc/remove-url-from-headings.rs stdout ----

error: htmldocck failed!
status: exit code: 1
command: "/usr/bin/python" "/home/imperio/rust/rust/src/etc/htmldocck.py" "/home/imperio/rust/rust/build/x86_64-unknown-linux-gnu/test/rustdoc/remove-url-from-headings" "/home/imperio/rust/rust/src/test/rustdoc/remove-url-from-headings.rs"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
3: Invalid command: `!`@has`,` (try with ``@!has`)`
	// !`@has` - '//a[`@href="http://a.a"]'`

Encountered 1 errors
```

r? `@camelid`
2021-01-03 17:09:09 +01:00
Guillaume Gomez
2072e11730
Rollup merge of #80591 - lcnr:incomplete-features, r=RalfJung
remove allow(incomplete_features) from std

cc https://github.com/rust-lang/rust/pull/80349#issuecomment-753357123

> Now I am somewhat concerned that the standard library uses some of these features...

I think it is theoretically ok to use incomplete features in the standard library or the compiler if we know that there is an already working subset and we explicitly document what we have to be careful about. Though at that point it is probably better to try and split the incomplete feature into two separate ones, similar to `min_specialization`.

Will be interesting once `feature(const_evaluatable_checked)` works well enough to imo be used in the compiler but not yet well enough to be removed from `INCOMPLETE_FEATURES`.

r? `@RalfJung`
2021-01-03 17:09:08 +01:00
Guillaume Gomez
2686daa779
Rollup merge of #80580 - GuillaumeGomez:suggestion-ignore-codeblock-warn, r=jyn514
Add suggestion for "ignore" doc code block

Part of https://github.com/rust-lang/rust/issues/30032.

This PR adds a suggestion to help users when they have a "ignore" doc code block which is invalid rust code.

r? `@jyn514`
2021-01-03 17:09:01 +01:00
oli
90b56b94f6 Stylistic fixes to diagnostic messages 2021-01-03 15:11:34 +00:00
oli
d3992f36ad Refactor the non-transient cell borrow error diagnostic 2021-01-03 14:46:49 +00:00
Oli Scherer
8968c8a103
Dangling pointers point to everything and nothing
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-01-03 15:19:07 +01:00
Oli Scherer
e5e4a851c4
Grammar fixes
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-01-03 15:15:23 +01:00
Guillaume Gomez
8b6304ed62 Inline resetMouseMoved function directly into "mousemove" event handler 2021-01-03 15:02:49 +01:00
Guillaume Gomez
22fc4544ad Replace some loops with "onEachLazy" call 2021-01-03 15:02:49 +01:00
Guillaume Gomez
7bc1eb4506 Create a "is_ignore" variable instead of doing the comparison multiple times 2021-01-03 14:56:56 +01:00
oli
a137ff1706 Update now-more-precise operation with a preciser message 2021-01-03 13:45:16 +00:00
Oli Scherer
e5330a4f52 Apply suggestions from code review
comment nits

Co-authored-by: Ralf Jung <post@ralfj.de>
2021-01-03 13:32:56 +00:00
Dániel Buga
4d3227fe1c Move variable into condition where it's used 2021-01-03 13:55:43 +01:00
Dániel Buga
250fb72d1b No need to collect result of get_item_attrs 2021-01-03 13:55:40 +01:00
Guillaume Gomez
da3eef61f5 Detect invalid rustdoc test commands 2021-01-03 13:53:11 +01:00
bors
bcd6975079 Auto merge of #80590 - camelid:bool-never-docs, r=nagisa
Update `bool` and `!` docs
2021-01-03 12:21:12 +00:00
Dániel Buga
675059a9eb Clean up convoluted macros_only logic 2021-01-03 12:47:38 +01:00
bors
18cb4ad3b9 Auto merge of #80247 - tmiasko:indent, r=bjorn3
Fix indentation of -Z meta-stats output
2021-01-03 09:16:24 +00:00
bors
e821a6ef78 Auto merge of #80261 - GuillaumeGomez:attr-rework, r=jyn514
rustdoc DocFragment rework

Kind of a follow-up of #80119.

A few things are happening in this PR. I'm not sure about the impact on perf though so I'm very interested about that too (if the perf is worse, then we can just close this PR).

The idea here is mostly about reducing the memory usage by relying even more on `Symbol` instead of `String`. The only issue is that `DocFragment` has 3 modifications performed on it:
 1. Unindenting
 2. Collapsing similar comments into one
 3. "Beautifying" (weird JS-like comments handling).

To do so, I saved the information about unindent and the "collapse" is now on-demand (which is why I'm not sure the perf will be better, it has to be run multiple times...).

r? `@jyn514`
2021-01-03 06:29:42 +00:00
bors
05dfaba442 Auto merge of #79827 - tmiasko:size-align, r=kennytm
Describe why `size_align` have not been inlined so far

although it is used only in one place.
2021-01-03 03:43:29 +00:00
bors
18d855b8f6 Auto merge of #80623 - flip1995:clippyup, r=Manishearth
Update Clippy

Biweekly Clippy update.

This includes a Cargo.lock update for the recent Clippy version bump.

r? `@Manishearth`
2021-01-03 00:55:26 +00:00
bors
c7d6c3dfdc Auto merge of #80592 - Skynoodle:snake-case-lint-reserved-identifier, r=davidtwco
Suggest renaming or escaping when fixing non-snake-case identifiers which would conflict with keywords

Fixes #80575
2021-01-02 22:06:17 +00:00
Matthias Krüger
8a90626a46 reduce borrowing and (de)referencing around match patterns (clippy::match_ref_pats) 2021-01-02 20:09:17 +01:00
Guillaume Gomez
df2df14424 Simplify docfragment transformation in unindent tests 2021-01-02 19:16:27 +01:00
Guillaume Gomez
d0e7523a32 Remove unused collapse pass 2021-01-02 19:16:27 +01:00
Guillaume Gomez
4ba1928fa2 Improve code for DocFragment rework 2021-01-02 19:16:27 +01:00
bors
fde6927395 Auto merge of #80412 - GuillaumeGomez:fix-search-section-pos, r=jyn514
Fix search section position on small devices

Fixes #79526.

This is exactly the same issue fixed in 9c36491538 (in https://github.com/rust-lang/rust/pull/79936) but applied to the search section. When the width becomes too small, the search input goes on its own line to get more space, making it go "under" the section following (so either "main" or "search"). The fix is to simply make the section go more under so that it doesn't go over the search input.

r? `@jyn514`
2021-01-02 18:13:48 +00:00
flip1995
5dd64b3cd6
Use bootstrap rustc for versioncheck in Clippy 2021-01-02 18:12:28 +01:00
Guillaume Gomez
0ab6c90699 Update rustdoc-ui test output 2021-01-02 16:55:12 +01:00
Guillaume Gomez
122b141f58 End of rework of Attributes struct 2021-01-02 16:55:12 +01:00
Guillaume Gomez
c4739bc920 Rework DocFragment 2021-01-02 16:55:12 +01:00
flip1995
d35d827bc8
Update Cargo.lock 2021-01-02 16:47:58 +01:00
Skynoodle
750c52af73 Add snake case lint note about keyword identifiers which cannot be raw 2021-01-02 15:46:41 +00:00
bors
fd85ca02f6 Auto merge of #80550 - bugadani:markdown-refactor, r=jyn514
Cleanup markdown span handling, take 2

This PR includes the cleanups made in #80244 except for the removal of `locate()`.

While the biggest conceptual part in #80244 was the removal of `locate()`, it introduced a diagnostic regression.

Additional cleanup:
 - Use `RefCell` to avoid building two separate vectors for the links

Work to do:
- [ ] Decide if `locate()` can be simplified by assuming `s` is always in `md`
- [ ] Should probably add some tests that still provide the undesired diagnostics causing #80381

cc `@jyn514` This is the best I can do without patching Pulldown to provide multiple ranges for reference-style links. Also, since `locate` is probably more efficient than `rfind` (at least it's constant time), I decided to not check the link type and just cover every &str as it was before.
2021-01-02 15:31:53 +00:00