about summary refs log tree commit diff
path: root/src/librustdoc/html/render/context.rs
AgeCommit message (Collapse)AuthorLines
2022-02-22Prevent generation of infinite redirectionsGuillaume Gomez-26/+34
2022-02-14Fix macro reexports duplicates in the sidebarGuillaume Gomez-6/+11
2022-01-18Simplify and unify rustdoc sidebar stylesJacob Hoffman-Andrews-10/+2
This switches to just use size, weight, and spacing to distinguish headings in the sidebar. We no longer use boxes, horizontal bars, or centering to distinguish headings. This makes it much easier to understand the hierarchy of headings, and reduces visual noise. I also refactored how the mobile topbar works. Previously, we tried to shift around elements from the sidebar to make the topbar. Now, the topbar gets its own elements, which can be styled on their own. This makes styling and reasoning about those elements simpler. Because the heading font sizes are bigger, increase the sidebar width slightly. As a very minor change, removed version from the "All types" page. It's now only on the crate page.
2022-01-14rustdoc: avoid many `Symbol` to `String` conversions.Nicholas Nethercote-10/+10
Particularly when constructing file paths and fully qualified paths. This avoids a lot of allocations, speeding things up on almost all examples.
2022-01-13Auto merge of #92526 - djc:rustdoc-askama, r=jshabors-11/+1
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-12Rollup merge of #92742 - GuillaumeGomez:missing-suffix-sidebar-items, ↵Matthias Krüger-1/+1
r=notriddle Add missing suffix for sidebar-items script path Fixes https://github.com/rust-lang/docs.rs/issues/1590. r? ```@syphar```
2022-01-10Add missing suffix for sidebar-items script pathGuillaume Gomez-1/+1
2022-01-10Remove configuration which became unused in ↵Dirkjan Ochtman-2/+0
8abb4bb698c9d74507adb9cd7b54a032f3c1b595
2022-01-10Migrate rustdoc from Tera to AskamaDirkjan Ochtman-9/+1
See #84419.
2022-01-08Make source links look cleanerJacob Hoffman-Andrews-1/+1
Change from syntaxy-looking [src] to the plain word "source".
2021-12-27Move `ExternalLocation` to `clean::types`Noah Lev-2/+2
It was previously defined in `render::search_index` but wasn't used at all there. `clean::types` seems like a better fit since that's where `ExternalCrate` is defined.
2021-12-27Rename `rustdoc::html::render::cache` to `search_index`Noah Lev-1/+1
The old name wasn't very clear, while the new one makes it clear that this is the code responsible for creating the search index.
2021-12-23Rollup merge of #92146 - willcrichton:example-analyzer, r=jyn514Matthias Krüger-6/+10
Don't emit shared files when scraping examples from dependencies in Rustdoc This PR fixes #91605. The issue is that `Context::init` gets called when scraping dependencies. By default, just calling `init` calls into `write_shared` and `build_index` which register the scraped crate into a list that later gets used for the Rustdoc sidebar. The fix is to ensure that `write_shared` is not called when scraping. r? `@jyn514`
2021-12-19Auto merge of #92099 - matthiaskrgr:rollup-4gwv67m, r=matthiaskrgrbors-9/+0
Rollup of 7 pull requests Successful merges: - #91141 (Revert "Temporarily rename int_roundings functions to avoid conflicts") - #91984 (Remove `in_band_lifetimes` from `rustc_middle`) - #92028 (Sync portable-simd to fix libcore build for AVX-512 enabled targets) - #92042 (Enable `#[thread_local]` for all windows-msvc targets) - #92071 (Update example code for Vec::splice to change the length) - #92077 (rustdoc: Remove unused `collapsed` field) - #92081 (rustdoc: Remove unnecessary `need_backline` function) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-12-18Remove `collapsed` fieldJoshua Nelson-9/+0
`render/context` always runs after `run_global_context`, so it was always set to `true`. This is a holdover from when rustdoc allowed configuring passes, but the `collapse-docs` pass was removed ages ago, and the ability to configure passes is about to be removed.
2021-12-15Remove unnecessary sigils around `Symbol::as_str()` calls.Nicholas Nethercote-5/+5
2021-12-15Remove `SymbolStr`.Nicholas Nethercote-3/+3
By changing `as_str()` to take `&self` instead of `self`, we can just return `&str`. We're still lying about lifetimes, but it's a smaller lie than before, where `SymbolStr` contained a (fake) `&'static str`!
2021-12-11Don't emit shared files when scraping dependenciesWill Crichton-6/+10
2021-11-24Simplify rendering of stylesheet links into HTMLJacob Hoffman-Andrews-7/+11
We carry around a list of stylesheets that can carry two different types of thing: 1. Internal stylesheets specific to a page type (only for settings) 2. Themes In this change I move the link generation for settings.css into settings(), so Context.style_files is reserved just for themes. We had two places where we extracted a base theme name from a list of StylePaths. I consolidated that code to be a method on StylePath. I moved generation of link tags for stylesheets into the page.html template. With that change, I made the template responsible for special handling of light.css (making it the default theme) and of the other themes (marking them disabled). That allowed getting rid of the `disabled` field on StylePath.
2021-10-31Clean up now that visitors only need `&clean::Crate`Noah Lev-3/+3
2021-10-31Auto merge of #90391 - camelid:crate-size, r=jyn514bors-4/+4
rustdoc: Compute some fields of `clean::Crate` on-demand to reduce size `clean::Crate` is frequently moved by-value -- for example, in `DocFolder` implementations -- so reducing its size should improve performance. This PR reduces the size of `clean::Crate` from 168 bytes to 104 bytes. r? `@jyn514`
2021-10-30Rollup merge of #90183 - GuillaumeGomez:recurse-deref, r=jyn514Guillaume Gomez-2/+7
Show all Deref implementations recursively Fixes #87783. This is a re-implementation of #80653, so taking the original PR comment: 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) cc `@camelid` r? `@jyn514`
2021-10-30rustdoc: Remove `Crate.name` and instead compute it on-demandNoah Lev-3/+3
It is not as large as `Crate.src` was, but it's still 8 bytes, and `clean::Crate` is moved by-value a lot.
2021-10-30rustdoc: Remove `Crate.src` and instead compute it on-demandNoah Lev-1/+1
It is only used in one place; `src` was about a third of `Crate`'s total size; `Crate` is frequently moved by-value; and `src` can be easily computed on-demand.
2021-10-30Remove unnecessary `macro_use`s in rustdocJoshua Nelson-2/+2
2021-10-29Remove the Rc wrapping of deref_id_mapGuillaume Gomez-4/+4
2021-10-29Recursively document DerefGuillaume Gomez-2/+7
2021-10-25Fix clippy lints in librustdocGuillaume Gomez-2/+2
2021-10-23Rollup merge of #85833 - willcrichton:example-analyzer, r=jyn514Matthias Krüger-8/+24
Scrape code examples from examples/ directory for Rustdoc Adds support for the functionality described in https://github.com/rust-lang/rfcs/pull/3123 Matching changes to Cargo are here: https://github.com/rust-lang/cargo/pull/9525 Live demo here: https://willcrichton.net/example-analyzer/warp/trait.Filter.html#method.and
2021-10-08Move template initialization into its own file.Jacob Hoffman-Andrews-12/+2
2021-10-08Add template for print_itemJacob Hoffman-Andrews-2/+6
Add print_item.html and the code in print_item.rs to use it.
2021-10-08Move more scrape-examples logic from JS to rustWill Crichton-8/+18
Fix failing test Add missing backslash Fix padding issue with horizontal scrollbar
2021-10-06Fix lint error, change scrape-examples.js minify callWill Crichton-1/+1
2021-10-06Move JS into a standalone fileWill Crichton-0/+1
2021-10-06Incorporate jyn's feedbackWill Crichton-0/+5
* Move call location logic from function constructor to rendering * Fix issue with macro spans in scraping examples * Clean up example loading logic Documentation / newtype for DecorationInfo Fix line number display Serialize edition of call site, other small cleanup
2021-10-06Reduce blur size, fix example width bug, add better error handling for I/O ↵Will Crichton-9/+1
issues Remove repository url Fix formatting Fix file_span in print_src Formatting
2021-10-06Generate example source files with corresponding linksWill Crichton-0/+1
Add display name Fix remaining merge conflicts Only embed code for items containing examples
2021-10-06Add updated support for example-analyzerWill Crichton-1/+8
Move rendering of examples into Finalize design Cleanup, rename found -> scraped Softer yellow Clean up dead code Document scrape_examples More simplification and documentation Remove extra css Test
2021-09-16Auto merge of #88219 - jyn514:parallel-io, r=GuillaumeGomezbors-7/+7
rustdoc: reduce number of copies when using parallel IO This is Windows-only for now; I was getting really bad slowdowns from this on linux for some reason. Helps with https://github.com/rust-lang/rust/issues/82741. Follow-up to https://github.com/rust-lang/rust/pull/60971.
2021-09-05Change more x64 size checks to not apply to x32.Harald van Dijk-1/+1
Commit 95e096d6 changed a bunch of size checks already, but more have been added, so this fixes the new ones the same way: the various size checks that are conditional on target_arch = "x86_64" were not intended to apply to x86_64-unknown-linux-gnux32, so add target_pointer_width = "64" to the conditions.
2021-08-26Remove unnecessary copies when using parallel IOJoshua Nelson-7/+7
Previously, rustdoc was making lots of copies of temporary owned values. Now, it uses the owned value wherever possible.
2021-08-22Move Cache from Context to SharedContextJoshua Nelson-19/+10
2021-08-05Remove LightSpan and use Span directlyGuillaume Gomez-3/+3
2021-08-05Wrap the span_map tuple index into a type called "LightSpan"Guillaume Gomez-3/+3
2021-08-05Add an option for the source code link generationGuillaume Gomez-2/+8
2021-08-05Add links on source types to go to definitionGuillaume Gomez-23/+41
2021-07-17Rustdoc accessibility: make the sidebar headers actual headersMichael Howell-2/+2
Part of #87059 Preview it at: https://notriddle.com/notriddle-rustdoc-test/rustdoc-sidebar-header/std/index.html
2021-07-05rustdoc: Rename `expect_real` to `expect_def_id`, remove `Item::is_fake`Justus K-1/+1
2021-06-20Use Tera templates for rustdoc.Jacob Hoffman-Andrews-0/+14
Replaces a format!() call in layout::render with a template expansion. Introduces a `templates` field in SharedContext so parts of rustdoc can share pre-rendered templates. This currently builds in a copy of the single template available, like with static files. However, future work can make this live-loadable with a perma-unstable flag, to make rustdoc developers' work easier.
2021-06-10manually crafted revert of PR #80653, to address issue #82465.Felix S. Klock II-7/+2
(update: placated tidy) (update: rebased post PR #84707 ) merge me