summary refs log tree commit diff
path: root/src/librustdoc/html/render/cache.rs
AgeCommit message (Collapse)AuthorLines
2021-04-27cfg taken out of Attributes, put in ItemTimothée Delabrouille-2/+1
check item.is_fake() instead of self_id.is_some() Remove empty branching in Attributes::from_ast diverse small refacto after Josha review cfg computation moved in merge_attrs refacto use from_ast twice for coherence take cfg out of Attributes and move it to Item
2021-04-27Removed usage of Attributes in FnDecl and ExternalCrate. Relocate part of ↵Timothée Delabrouille-3/+6
the fields in Attributes, as functions in AttributesExt. refacto use from_def_id_and_attrs_and_parts instead of an old trick most of josha suggestions + check if def_id is not fake before using it in a query Removed usage of Attributes in FnDecl and ExternalCrate. Relocate part of the Attributes fields as functions in AttributesExt.
2021-04-23Use ItemType in cacheJoshua Nelson-5/+5
2021-04-22Remove `name` field from ExternalCrateJoshua Nelson-1/+2
2021-04-04Get rid of unneeded `aliases` fieldMichael Howell-2/+6
2021-04-03rustdoc: sort search index items for compressionMichael Howell-7/+16
This should not affect the appearance of the docs pages themselves. This makes the pre-compressed search index smaller, thanks to the empty-string path duplication format, and also the gzipped version, by giving the algorithm more structure to work with. rust$ wc -c search-index-old.js search-index-new.js 2628334 search-index-old.js 2586181 search-index-new.js 5214515 total rust$ gzip search-index-* rust$ wc -c search-index-old.js.gz search-index-new.js.gz 239486 search-index-old.js.gz 237386 search-index-new.js.gz 476872 total
2021-03-23Remove unnecessary `Option` wrapping around `Crate.module`Camelid-5/+2
I'm wondering if it was originally there so that we could `take` the module which enables `after_krate` to take an `&Crate`. However, the two impls of `after_krate` only use `Crate.name`, so we can pass just the name instead.
2021-03-10rustdoc: tweak the search index formatMichael Howell-6/+54
This essentially switches search-index.js from a "array of struct" to a "struct of array" format, like this: { "doc": "Crate documentation", "t": [ 1, 1, 2, 3, ... ], "n": [ "Something", "SomethingElse", "whatever", "do_stuff", ... ], "q": [ "a::b", "", "", "", ... ], "d": [ "A Struct That Does Something", "Another Struct", "a function", "another function", ... ], "i": [ 0, 0, 1, 1, ... ], "f": [ null, null, [], [], ... ], "p": ..., "a": ... } So `{ty: 1, name: "Something", path: "a::b", desc: "A Struct That Does Something", parent_idx: 0, search_type: null}` is the first item. This makes the uncompressed version smaller, but it really shows on the compressed version: notriddle:rust$ wc -c new-search-index1.52.0.js 2622427 new-search-index1.52.0.js notriddle:rust$ wc -c old-search-index1.52.0.js 2725046 old-search-index1.52.0.js notriddle:rust$ gzip new-search-index1.52.0.js notriddle:rust$ gzip old-search-index1.52.0.js notriddle:rust$ wc -c new-search-index1.52.0.js.gz 239385 new-search-index1.52.0.js.gz notriddle:rust$ wc -c old-search-index1.52.0.js.gz 296328 old-search-index1.52.0.js.gz notriddle:rust$ That's a 4% improvement on the uncompressed version (fewer `[]`), and 20% improvement after gzipping it, thanks to putting like-typed data next to each other. Any compression algorithm based on a sliding window will probably show this kind of improvement.
2021-02-05Remove unused cache argumentGuillaume Gomez-12/+9
2021-02-05Improve codeGuillaume Gomez-1/+1
2021-02-05Improve html::render::cache::get_real_types codeGuillaume Gomez-3/+125
2021-02-05Remove Function all_types and ret_types fieldsGuillaume Gomez-13/+19
2021-02-03Rollup merge of #81679 - GuillaumeGomez:clean-fixme-match-bind, ↵Guillaume Gomez-2/+10
r=poliorcetics,CraftSpider Bind all clean::Type variants and remove FIXME This is simply a little cleanup. cc `@CraftSpider` r? `@poliorcetics`
2021-02-02Bind all clean::Type variants and remove FIXMEGuillaume Gomez-2/+10
2021-02-01Put back primitives in searchGuillaume Gomez-1/+1
2021-01-27Apply review comments and improve codeGuillaume Gomez-1/+1
2021-01-27Remove cache usage wherever possibleGuillaume Gomez-8/+11
2021-01-27Remove CACHE_KEY globalGuillaume Gomez-17/+17
2021-01-02End of rework of Attributes structGuillaume Gomez-2/+2
2020-12-23Box ItemKind to reduce the size of `Item`Joshua Nelson-1/+1
This brings the size of `Item` from ``` [src/librustdoc/lib.rs:103] std::mem::size_of::<Item>() = 680 ``` to ``` [src/librustdoc/lib.rs:103] std::mem::size_of::<Item>() = 280 ```
2020-12-18Auto merge of #80119 - GuillaumeGomez:str-to-symbol, r=jyn514bors-7/+7
Continue String to Symbol conversion in rustdoc Follow-up of https://github.com/rust-lang/rust/pull/80091. This PR is already big enough so I'll stop here before the next one. r? `@jyn514`
2020-12-17Continue String to Symbol conversion in rustdocGuillaume Gomez-7/+7
2020-12-17Rollup merge of #80047 - jyn514:more-symbols, r=GuillaumeGomezGuillaume Gomez-1/+1
Use more symbols in rustdoc Builds on https://github.com/rust-lang/rust/pull/80044 and should not be merged before. I want to test if this is actually faster before merging it, there was a lot of `to_string()` calls so I'm not sure it will actually help. That means I have to wait for 80044 to get merged before running perf. r? `@ghost`
2020-12-16Replace String with Symbol where possibleGuillaume Gomez-1/+1
2020-12-15Use `Symbol`s for crate namesJoshua Nelson-1/+1
2020-12-14Switch to Symbol for item.nameJoshua Nelson-1/+1
This decreases the size of `Item` from 680 to 616 bytes. It also does a lot less work since it no longer has to copy as much.
2020-12-03Render Markdown in search resultsCamelid-3/+3
Previously Markdown documentation was not rendered to HTML for search results, which led to the output not being very readable, particularly for inline code. This PR fixes that by rendering Markdown to HTML with the help of pulldown-cmark (the library rustdoc uses to parse Markdown for the main text of documentation). However, the text for the title attribute (the text shown when you hover over an element) still uses the plain-text rendering since it is displayed in browsers as plain-text. Only these styles will be rendered; everything else is stripped away: * *italics* * **bold** * `inline code`
2020-11-16Get rid of clean::MethodJoshua Nelson-1/+1
Replace it instead with `(clean::Function, Option<hir::Defaultness>)`.
2020-11-15Make all rustdoc functions and structs crate-privateJoshua Nelson-3/+3
This gives warnings about dead code.
2020-11-14Rename ItemEnum -> ItemKind, inner -> kindJoshua Nelson-1/+1
2020-11-10Changed unwrap_or to unwrap_or_else in some places.Nicholas-Baron-1/+1
The discussion seems to have resolved that this lint is a bit "noisy" in that applying it in all places would result in a reduction in readability. A few of the trivial functions (like `Path::new`) are fine to leave outside of closures. The general rule seems to be that anything that is obviously an allocation (`Box`, `Vec`, `vec![]`) should be in a closure, even if it is a 0-sized allocation.
2020-08-30rustdoc: do not use plain summary for trait implsAndy Russell-3/+3
Fixes #38386. Fixes #48332. Fixes #49430. Fixes #62741. Fixes #73474.
2020-08-18Add doc examples count for --show-coverageGuillaume Gomez-2/+4
2020-08-04rustc_ast: `(Nested)MetaItem::check_name` -> `has_name`Vadim Petrochenkov-1/+1
For consistency with `Attribute::has_name` which doesn't mark the attribute as used either. Replace all uses of `check_name` with `has_name` outside of rustc
2020-07-27Extract `Cache` and other types from `html` moduleJoseph Ryan-489/+12
2020-07-27Move `Error` and `RenderInfo` out of `html` moduleJoseph Ryan-1/+2
2020-06-26Generate docs for links to private items when passed --document-privateJoshua Nelson-0/+6
- Pass around document_private a lot more - Add tests + Add tests for intra-doc links to private items + Add ignored tests for warnings in reference links
2020-05-29Split payload of FileName::Real to track both real and virutalized paths.Felix S. Klock II-1/+1
Such splits arise from metadata refs into libstd. This way, we can (in a follow on commit) continue to emit the virtual name into things like the like the StableSourceFileId that ends up in incremetnal build artifacts, while still using the devirtualized file path when we want to access the file. Note that this commit is intended to be a refactoring; the actual fix to the bug in question is in a follow-on commit.
2020-05-14* Update aliases data struct from HashMap to BTreeMap to have more ↵Guillaume Gomez-9/+7
deterministic results * Update Javascript to take this change into account * Update CrateData::aliases field to take a reference instead (it allowed to remove a conversion loop)
2020-05-14Move doc alias discovery into the Attributes struct and some code improvementsGuillaume Gomez-37/+4
2020-05-07Merge aliases and search-indexGuillaume Gomez-21/+23
2020-05-07Improve doc alias discoveryGuillaume Gomez-36/+53
2020-04-20Rollup merge of #71250 - GuillaumeGomez:use-json-instead-of-js, r=kinnisonDylan DPC-1/+6
Replace big JS dict with JSON parsing Part of #56545. @ollie27 suggested that using JSON instead of a JS dict might be faster, so I decided to test it. And the results far exceeded whatever expectations I had... I used https://github.com/adamgreig/stm32ral for my tests. If you want to build it locally: ```bash $ cargo doc --features doc --open ``` But I strongly recommend to do it with this PR. Some numbers: * Loading a page with the JSON search-index: less than 1 second * Loading a page with the JS search-index: crashed after 30 seconds I think the results are clear enough... r? @ollie27 cc @rust-lang/rustdoc
2020-04-17Replace big JS dict with JSON parsingGuillaume Gomez-1/+6
2020-04-16Dogfood or_patterns in rustdocJosh Stone-4/+7
2020-04-10Improve rustdoc source code a bitGuillaume Gomez-5/+5
2020-03-31more clippy fixesMatthias Krüger-1/+1
use is_empty() instead of len comparison (clippy::len_zero) use if let instead of while let loop that never loops (clippy::never_loop) remove redundant returns (clippy::needless_return) remove redundant closures (clippy::redundant_closure) use if let instead of match and wildcard pattern (clippy::single_match) don't repeat field names redundantly (clippy::redundant_field_names)
2020-03-30rustc -> rustc_middle part 3 (rustfmt)Mazdak Farrokhzad-1/+1
2020-03-30rustc -> rustc_middle part 2Mazdak Farrokhzad-1/+1
2020-03-22don't create variable bindings just to return the bound value immediately ↵Matthias Krüger-3/+2
(clippy::let_and_return)