about summary refs log tree commit diff
path: root/src/librustdoc/html
AgeCommit message (Collapse)AuthorLines
2021-10-10Auto merge of #89695 - jsha:more-templates, r=GuillaumeGomezbors-55/+113
Move top part of print_item to Tera templates Part of #84419. This moves the first line of each item page (E.g. `Struct foo::Bar .... 1.0.0 [-][src]` into a Tera template. I also moved template initialization into its own module and added a small macro to reduce duplication and opportunity for errors.
2021-10-09Auto merge of #88379 - camelid:cleanup-clean, r=jyn514bors-115/+96
rustdoc: Cleanup various `clean` types Cleanup various `clean` types.
2021-10-09Remove some stray whitespace.Jacob Hoffman-Andrews-3/+3
2021-10-09Rollup merge of #89700 - GuillaumeGomez:fix-rustdoc-higher-bound-html-gen, ↵Guillaume Gomez-2/+6
r=notriddle Fix invalid HTML generation for higher bounds Considering this is a bug, I cherry-picked the commit from #89676 so it's merged more quickly. r? ``@notriddle``
2021-10-09Fix invalid HTML generation for higher boundsGuillaume Gomez-2/+6
2021-10-08Move template initialization into its own file.Jacob Hoffman-Andrews-15/+23
2021-10-08Add template for print_itemJacob Hoffman-Andrews-46/+96
Add print_item.html and the code in print_item.rs to use it.
2021-10-08Change handling of spans in scrape examples, add test for highlight decorationsWill Crichton-1/+18
2021-10-08Rollup merge of #89538 - notriddle:notriddle/arrow-highlight, r=GuillaumeGomezGuillaume Gomez-6/+25
Make rustdoc not highlight `->` and `=>` as operators It was marking them up as `<span class="op">=</span><span class="op">&gt;</span>`, which is bloaty and wrong (at least, I think `<=` and `=>` should probably be different colors, since they're so different and yet made from the same symbols). Before: ![image](https://user-images.githubusercontent.com/1593513/135939748-f49b0f9e-6a7d-4d65-935a-e31cdf688a81.png) After: ![image](https://user-images.githubusercontent.com/1593513/135940063-5ef1f6b1-7e03-4227-b46b-572b063aba05.png)
2021-10-08Move more scrape-examples logic from JS to rustWill Crichton-60/+60
Fix failing test Add missing backslash Fix padding issue with horizontal scrollbar
2021-10-07Move some expansion logic into generation-time, fix section header links, ↵Will Crichton-40/+54
remove ID from line numbers, fix horizontal scrolling on non-expanded elements
2021-10-07Rollup merge of #89596 - GuillaumeGomez:implicit-doc-cfg, r=jyn514Guillaume Gomez-1/+1
Make cfg imply doc(cfg) This is a reopening of #79341, rebased and modified a bit (we made a lot of refactoring in rustdoc's types so they needed to be reflected in this PR as well): * `hidden_cfg` is now in the `Cache` instead of `DocContext` because `cfg` information isn't stored anymore on `clean::Attributes` type but instead computed on-demand, so we need this information in later parts of rustdoc. * I removed the `bool_to_options` feature (which makes the code a bit simpler to read for `SingleExt` trait implementation. * I updated the version for the feature. There is only one thing I couldn't figure out: [this comment](https://github.com/rust-lang/rust/pull/79341#discussion_r561855624) > I think I'll likely scrap the whole `SingleExt` extension trait as the diagnostics for 0 and >1 items should be different. How/why should they differ? EDIT: this part has been solved, the current code was fine, just needed a little simplification. cc `@Nemo157` r? `@jyn514` Original PR description: This is only active when the `doc_cfg` feature is active. The implicit cfg can be overridden via `#[doc(cfg(...))]`, so e.g. to hide a `#[cfg]` you can use something like: ```rust #[cfg(unix)] #[doc(cfg(all()))] pub struct Unix; ``` By adding `#![doc(cfg_hide(foobar))]` to the crate attributes the cfg `#[cfg(foobar)]` (and _only_ that _exact_ cfg) will not be implicitly treated as a `doc(cfg)` to render a message in the documentation.
2021-10-06Update to latest rustc and rustdoc stylesWill Crichton-7/+8
2021-10-06Unversioned -> InvocationSpecificWill Crichton-1/+1
2021-10-06Fix lint error, change scrape-examples.js minify callWill Crichton-2/+9
2021-10-06Move JS into a standalone fileWill Crichton-115/+124
2021-10-06Change serialized format to use DefPathHash instead of custom StringWill Crichton-28/+21
Move test to rustdoc-ui Fix test writing to wrong directory Formatting Fix test Add FIXME Remove raw multiline strings
2021-10-06Incorporate jyn's feedbackWill Crichton-36/+81
* 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-06Add styles for non-white themesWill Crichton-15/+61
Tweak colors Tabs New link heading style
2021-10-06Reduce blur size, fix example width bug, add better error handling for I/O ↵Will Crichton-29/+68
issues Remove repository url Fix formatting Fix file_span in print_src Formatting
2021-10-06Move highlighting logic from JS to RustWill Crichton-159/+145
Continue migrating JS functionality Cleanup Fix compile error Clean up the diff Set toggle font to sans-serif
2021-10-06Sort examples by sizeWill Crichton-36/+126
Improve styling Start to clean up code, add comments
2021-10-06Generate example source files with corresponding linksWill Crichton-44/+64
Add display name Fix remaining merge conflicts Only embed code for items containing examples
2021-10-06Factor scraping and rendering into separate calls to rustdocWill Crichton-54/+25
Simplify toggle UI logic, add workspace root for URLs
2021-10-06Fix check issueWill Crichton-8/+18
Clean up tidy checks
2021-10-06Add updated support for example-analyzerWill Crichton-2/+407
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-10-06Rollup merge of #89506 - yaymukund:docblock-headings, r=GuillaumeGomezManish Goregaokar-100/+183
librustdoc: Use correct heading levels. Closes #89309 This fixes the `<h#>` header tags throughout the docs to reflect a semantic hierarchy. - I ran a script to manually check that we don't have any files with multiple `<h1>` tags. - Also checked that we never incorrectly nest e.g. a `<h2>` under an `<h3>`. - I also spot-checked a bunch of pages (`trait.Read`, `enum.Ordering`, `primitive.isize`, `trait.Iterator`).
2021-10-06Restore h1 styles, which got accidentally removed.Mukund Lakshman-3/+3
2021-10-05Allow adding a set of cfg's to hide from being implicitly doc(cfg)'dWim Looman-1/+1
By adding #![doc(cfg_hide(foobar))] to the crate attributes the cfg #[cfg(foobar)] (and _only_ that _exact_ cfg) will not be implicitly treated as a doc(cfg) to render a message in the documentation.
2021-10-05Make cfg implicitly imply doc(cfg)Wim Looman-1/+1
This is only active when the `doc_cfg` feature is active. The implicit cfg can be overridden via #[doc(cfg(...))], so e.g. to hide a #[cfg] you can use something like: ```rust #[cfg(unix)] #[doc(cfg(all()))] pub struct Unix; ``` (since `all()` is always true, it is never shown in the docs)
2021-10-04heading_level: u32 -> heading_offset: HeadingOffsetMukund Lakshman-54/+79
2021-10-04No need to default offset since we always override it.Mukund Lakshman-37/+33
2021-10-04Change `Markdown(...)` to `Markdown { ... }`Mukund Lakshman-35/+69
2021-10-04Fix heading for methods on trait impls.Mukund Lakshman-1/+1
2021-10-04Make rustdoc not highlight `->` and `=>` as operatorsMichael Howell-6/+25
It was marking them up as `<span class="op">=</span><span class="op">&gt;</span>`, which is bloaty and wrong.
2021-10-04librustdoc: Use correct heading levels.Mukund Lakshman-56/+84
- Avoid multiple <h1>s on a page. - The <h#> tags should follow a semantic hierarchy. - Cap at h6 (no h7)
2021-10-03Move from grid layout to table based layout because of browser limits that ↵Stefan Schindler-21/+17
overlay row entries after a UA specific amount of rows
2021-10-02Replace all uses of `path.res.def_id()` with `path.def_id()`Noah Lev-5/+5
2021-10-01Auto merge of #89395 - ↵bors-6/+3
In-line:remove_visible_path_from_allowed_deprecated_lint, r=jyn514 Remove visible path calculation from allowed deprecation lint
2021-09-30Remove temporary `GetDefId` impl for `Path`Noah Lev-56/+40
2021-09-30Use `Path` instead of `Type` in `PolyTrait`Noah Lev-57/+45
The change to `impl Clean<Path> for hir::TraitRef<'_>` was necessary to fix a test failure for `src/test/rustdoc/trait-alias-mention.rs`. Here's why: The old code path was through `impl Clean<Type> for hir::TraitRef<'_>`, which called `resolve_type`, which in turn called `register_res`. Now, because `PolyTrait` uses a `Path` instead of a `Type`, the impl of `Clean<Path>` was being run, which did not call `register_res`, causing the trait alias to not be recorded in the `external_paths` cache.
2021-09-30Make `Impl.trait_` a `Path`, not a `Type`Noah Lev-2/+11
It should only ever be a `ResolvedPath`, so this (a) enforces that, and (b) reduces the size of `Impl`. I had to update a test because the order of the rendered auto trait impl bounds changed. I think the order changed because rustdoc sorts auto trait bounds using their `Debug` output.
2021-09-30Remove visible path calculation from allowed deprecation lintAlik Aslanyan-6/+3
2021-09-29Rollup merge of #89297 - GuillaumeGomez:remove-never-from-type-enum, r=camelidEric Huss-2/+3
Remove Never variant from clean::Type enum Fixes #89287. r? ``@camelid``
2021-09-29Rollup merge of #87428 - GuillaumeGomez:union-highlighting, r=notriddleEric Huss-5/+91
Fix union keyword highlighting in rustdoc HTML sources I followed this logic: if I find an ident "union", I check if it followed by another ident or not. If it's the case, then I consider this is a keyword because it's declaring a union type. To do so I created a new Iterator which allows to peek the next items without moving the current iterator position. This is part of https://github.com/rust-lang/rust/issues/85016. If the fix makes sense, I'll extend it to other weak keywords (the issue only mentions they exist but https://doc.rust-lang.org/nightly/reference/keywords.html#weak-keywords only talks about `dyn` and `'static` so not sure if there is anything else to be done?). cc `@notriddle` (you're one of the last ones who worked on this part of rustdoc so here you go :wink: ) r? `@jyn514`
2021-09-29Remove Never variant from clean::Type enumGuillaume Gomez-2/+3
2021-09-28Auto merge of #89277 - jyn514:codeblock-edition, r=GuillaumeGomezbors-15/+8
Use the correct edition for syntax highlighting doctests Previously it would unconditionally use edition 2015, which was incorrect. Helps with https://github.com/rust-lang/rust/issues/89135 in that you can now override the doctest to be 2018 edition instead of being forced to fix the error. This doesn't resolve any of the deeper problems that rustdoc disagrees with most rust users on what a code block is. cc `@Mark-Simulacrum`
2021-09-26Preserve the whole LangSyntax when parsing doctestsJoshua Nelson-15/+8
Previously, only the raw string and the `is_ignore` field were preserved, which made it hard to recover anything else.
2021-09-25Rollup merge of #88895 - camelid:cleanup-pt2, r=jyn514Manish Goregaokar-33/+22
rustdoc: Cleanup `clean` part 2 Split out from #88379. This contains the following commits from that PR: - Remove `Type::ResolvedPath.is_generic` - Rename `is_generic()` to `is_assoc_ty()` r? `@jyn514`
2021-09-21rustdoc: Emphasize "completely unstable"Noah Lev-1/+1