about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2021-04-25Auto merge of #80339 - jyn514:no-span, r=GuillaumeGomezbors-55/+80
Calculate `span` info on-demand - Add helper `attr_span` for common reused function - Stop storing `Span`s on `Item` directly; calculate them on demand instead - Special case modules, which have different spans depending on whether you use inner or outer attributes - Special case impls with fake IDs, which can have either dummy spans (for auto traits) or the DefId of the impl block (for blanket impls) - Use a fake ID for primitives instead of the ID of the crate; this lets `source()` know that it should use a dummy span instead of the span of the crate. This shrinks `Item` from 48 to 40 bytes. Helps with https://github.com/rust-lang/rust/issues/76382.
2021-04-24Finally (finally) ((finally!!!!)) fix spans for the standard libraryJoshua Nelson-1/+5
2021-04-24Get rid of `item.span`Joshua Nelson-36/+44
- Remove `span` field, adding `Item::span()` instead - Special-case `Impl` and `Module` items - Use dummy spans for primitive items
2021-04-24Do the hard part firstJoshua Nelson-20/+33
The only bit failing was the module, so change that before removing the `span` field.
2021-04-24Add attr_span helper functionJoshua Nelson-17/+17
2021-04-24Auto merge of #84511 - davidhewitt:revert-84445, r=GuillaumeGomezbors-13/+6
Revert "rustdoc: Hide `#text` in doc-tests" See discussion in #84502 - I'm worried that #84445 may cause a lot of breakages if this were to hit stable, so I think it's safer to revert and work on the known correct fix #84478.
2021-04-25Rollup merge of #84518 - GuillaumeGomez:cleanup-up-dom-string, r=jshaYuki Okushi-4/+9
Clean up DOM strings Follow-up of #84320. r? ``@jsha``
2021-04-25Rollup merge of #84464 - jyn514:type-kind, r=CraftSpiderYuki Okushi-134/+93
rustdoc: Get rid of `clean::TypeKind` It does exactly the same thing as ItemType.
2021-04-25Rollup merge of #84460 - jyn514:doctree-is-crate, r=camelidYuki Okushi-42/+26
rustdoc: Remove unnecessary `is_crate` field from doctree::Module and clean::Module It can be calculated on-demand even without a TyCtxt. This also changed `json::conversions::from_item_kind` to take a whole item, which avoids having to add more and more parameters. Helps with https://github.com/rust-lang/rust/issues/76382. r? ```@camelid```
2021-04-24rustdoc: Turn `JsonRenderer::mod_item_in` into `unreachable!()`Joshua Nelson-15/+2
The JSON renderer no longer gets called on modules.
2021-04-24Clean up DOM stringsGuillaume Gomez-4/+9
2021-04-24Revert "rustdoc: Hide `#text` in doc-tests"David Hewitt-13/+6
This reverts commit af6c3201fc3d5ec2559836454ea4f43eec583fa2.
2021-04-24Rollup merge of #84492 - jyn514:span, r=camelidYuki Okushi-3/+4
rustdoc: Remove unnecessary dummy span Follow-up to https://github.com/rust-lang/rust/pull/84460#discussion_r619447655. r? `@camelid`
2021-04-24Rollup merge of #84458 - jyn514:cleanup-after-krate, r=GuillaumeGomezYuki Okushi-79/+39
Remove unnecessary fields and parameters in rustdoc r? `@GuillaumeGomez`
2021-04-24Rollup merge of #84320 - jsha:details-implementors, ↵Yuki Okushi-24/+26
r=Manishearth,Nemo157,GuillaumeGomez Use details tag for trait implementors. Part of #83332 and following on from #83337 and #83355. This removes one category of JS-generated toggles (implementors), and replaces them with a `<details>` tag. This simplifies the JS, and fixes some bugs where things that were supposed to be hidden by the toggle were not hidden. Compare https://hoffman-andrews.com/rust/details-implementors/std/io/trait.Read.html#impl-Read vs https://doc.rust-lang.org/nightly/std/io/trait.Read.html#implementors. This introduces a `left: -23px` to put the toggle in the correct place, matching the current style for `.collapse-toggle`. It's worth noting this introduces a slight behavior change: since the entire line is now a `<summary>`, any part of the line is clickable. So for instance, in `impl Read for File`, clicking `impl` or `for` will collapse / expand the docs. Clicking `Read` or `File` still links to the appropriate documentation as before.
2021-04-23Fix macro bug in `impl From<DefKind> for ItemType`Joshua Nelson-1/+5
This was missed a while ago when support for proc-macro attributes was first added.
2021-04-23Don't repeat `hir::def::DefKind` so muchJoshua Nelson-33/+33
2021-04-23Remove unused `impl Clean<ItemType> for DefKind`Joshua Nelson-6/+0
2021-04-23Remove `TypeKind`Joshua Nelson-53/+0
2021-04-23Use ItemType in cacheJoshua Nelson-32/+11
2021-04-23Take ItemType instead of TypeKind in record_extern_fqnJoshua Nelson-49/+84
2021-04-23rustdoc: Remove unnecessary dummy spanJoshua Nelson-3/+4
2021-04-23rustdoc: Remove unnecessary `is_crate` field from doctree::Module and ↵Joshua Nelson-42/+26
clean::Module It can be calculated on-demand even without a TyCtxt. This also changed `from_item_kind` to take a whole item, which avoids having to add more and more parameters.
2021-04-24Rollup merge of #84433 - GuillaumeGomez:search-input-blur, r=jshaYuki Okushi-3/+6
Prevent control, shift and alt keys to make search input lose focus Part of #84384. r? ````@jsha````
2021-04-24Rollup merge of #84321 - Swatinem:subvariant-details, r=GuillaumeGomezYuki Okushi-6/+17
rustdoc: Convert sub-variant toggle to HTML Instead of creating a JS toggle, this injects details/summary for sub-variants of enums. This also fixes the CSS so that the toggle button does not jump when expanding/collapsing. Takes inspiration from #83337 and should be considered part of #83332. Not quite sure if the `.sub-variant` selectors could be further simplified? AFAICS it is only used in that place, and that does not seem to allow any recursion.
2021-04-23improve wordingArpad Borsos-1/+1
2021-04-23Auto merge of #84457 - jyn514:cleanup-crate, r=GuillaumeGomezbors-132/+150
rustdoc: Remove most fields from ExternalCrate Once https://github.com/rust-lang/rust/issues/84304 is fixed, I can get rid of ExternCrate altogether in favor of CrateNum, but in the meantime, this shrinks ExternalCrate quite a lot. This might hurt compile-times; if it does, I can add `primitive` and `keyword` queries. I expect this to improve compilemem. Helps with https://github.com/rust-lang/rust/issues/76382. r? GuillaumeGomez
2021-04-23rustdoc: Implement `is_primitive` in terms of `primitive_type()`Joshua Nelson-8/+1
Previously, they disagreed about what types were primitives. This also fixes a bug where rustdoc would mark any type with a reference as a primitive.
2021-04-23Auto merge of #84445 - jyn514:hidden, r=<try>bors-6/+13
rustdoc: Hide `#text` in doc-tests Since `#![attr]` and `#[attr]` are the only valid syntax that start with `#`, we can just special case those two tokens. Fixes https://github.com/rust-lang/rust/issues/83284.
2021-04-22rustdoc: Stop special casing `broken_intra_doc_links` unnecessarilyJoshua Nelson-8/+1
2021-04-22Remove unnecessary item_name parameter to `mod_item_in`Joshua Nelson-11/+9
2021-04-22Remove unnecessary `item_name` parameter to `mod_item_out`Joshua Nelson-7/+5
2021-04-22Remove unnecessary `edition` field on SharedContextJoshua Nelson-9/+10
2021-04-22Remove unnecessary `edition` parameter to rendererJoshua Nelson-25/+6
2021-04-22Remove unnecessary `diag` parameter to `after_krate`Joshua Nelson-16/+10
2021-04-22Remove unnecessary `crate_name` parameter to `after_krate`Joshua Nelson-19/+7
It's always `tcx.crate_name(LOCAL_CRATE)`, it doesn't need to be passed in separately.
2021-04-22Remove `keywords` from ExternCrateJoshua Nelson-52/+57
2021-04-22Get rid of ExternCrate::primitivesJoshua Nelson-77/+77
2021-04-22Remove `name` field from ExternalCrateJoshua Nelson-7/+12
2021-04-22Remove src field from ExternCrateJoshua Nelson-6/+14
2021-04-22rustdoc: Hide `#text` in doc-testsJoshua Nelson-6/+13
Since `#![attr]` and `#[attr]` are the only valid syntax that start with `#`, we can just special case those two tokens.
2021-04-22Use flex more consistently.Tor Hovland-14/+8
2021-04-22Auto merge of #84420 - workingjubilee:microvec, r=Mark-Simulacrumbors-5/+5
Use arrayvec 0.7, drop smallvec 0.6 With the arrival of min const generics, many alt-vec libraries have updated to use it in some way and arrayvec is no exception. Use the latest with minor refactoring. Also, rustc_workspace_hack is the only user of smallvec 0.6 in the entire tree, so drop it.
2021-04-22Rollup merge of #84376 - torhovland:issue-84534, r=GuillaumeGomezDylan DPC-4/+9
Uses flex to fix formatting of h1 at any width Fixes #84354.
2021-04-22Prevent control, shift and alt keys to make search input lose focusGuillaume Gomez-3/+6
2021-04-21Use arrayvec 0.7, drop smallvec 0.6Jubilee Young-5/+5
With the arrival of min const generics, many alt-vec libraries have updated to use it in some way and arrayvec is no exception. Use the latest with minor refactoring. Also, rustc_workspace_hack is the only user of smallvec 0.6 in the entire tree, so drop it.
2021-04-21Replaced flex gap with margin, for compatibility with older browsers.Tor Hovland-1/+1
2021-04-20fix is_module checkSmitty-4/+4
2021-04-20Rename pushname to is_moduleSmitty-3/+3
2021-04-20Write Rustdoc titles like "x in crate::mod - Rust"Smitty-9/+8
This makes Rustdoc titles for items read like "x in cratename::blah::foo - Rust". Title for modules and other non-items are unchanged, and still read like "doccratenameconst::blah::foo - Rust". This makes managing several open Rustdoc tabs easier. Closes #84371.