summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2021-03-10Add testDániel Buga-0/+11
(cherry picked from commit d3f75ebf609eed01b39fb7528745f2fce88e33e6)
2021-03-10Remove duplicate stringDániel Buga-1/+0
(cherry picked from commit 3be69b100f6678c42eff36e18505c2ba9419647a)
2021-03-10[intra-doc links] Don't check feature gates of items re-exported across cratesJoshua Nelson-0/+3
It should be never break another crate to re-export a public item. Note that this doesn't check the feature gate at *all* for other crates: - Feature-gates aren't currently serialized, so the only way to check the gate is with ad-hoc attribute checking. - Checking the feature gate twice (once when documenting the original crate and one when documenting the current crate) seems not great. This should still catch using the feature most of the time though, since people tend to document their own crates. (cherry picked from commit fdb32e997bef725f538f66dcfd96b1c1e51d2c56)
2021-03-10rustdoc: treat edition 2021 as unstableEric Huss-12/+2
(cherry picked from commit ee0e841a2e949cba1dcf3a2fb04e9a673681e4fd)
2021-02-13Do not ICE on range patterns in function argumentsLeSeulArtichaut-4/+1
2021-02-13Revert "Get rid of custom pretty-printing in rustdoc"LeSeulArtichaut-1/+71
This reverts commit 31375d2074aeed0c6f173aa200f0bd3bf6d36756.
2021-02-06Rollup merge of #81675 - poliorcetics:respect-shortness, r=jyn514Mara Bos-1/+6
Make rustdoc respect `--error-format short` in doctests Note that this will not work with `cargo test`, only with `rustdoc --test`, I'll have to modify `cargo` as well. Fix #81662. `@rustbot` label +T-rustdoc +A-doctests
2021-02-06Rollup merge of #80011 - Stupremee:stabilize-peekable-next-if, r=dtolnayMara Bos-1/+0
Stabilize `peekable_next_if` This PR stabilizes the `peekable_next_if` feature Resolves #72480
2021-02-05Rollup merge of #81763 - camelid:rustdoc-passes-desc-up, r=GuillaumeGomezMara Bos-7/+7
Cleanup rustdoc pass descriptions a bit Also changed a couple of comments from "intra-doc-links" to "intra-doc links" (my understanding is that "intra-doc links" is the standard way to refer to them).
2021-02-05Rollup merge of #81500 - CraftSpider:union-kind, r=jyn514Mara Bos-5/+4
Remove struct_type from union output Also bumps the format number and adds a test Rationale: It's illegal to have unions of the form `union Union(i32, f32);`, or `union Union;`. The struct_type field was recently removed from the rustdoc Union AST, at which time this field was changed to always just read "union". It makes sense to completely remove it, as it provides no information.
2021-02-05Rollup merge of #81497 - camelid:rustdoc-display_fn-remove-cell, r=jyn514Mara Bos-11/+11
rustdoc: Move `display_fn` struct inside `display_fn` This makes it clear that it's an implementation detail of `display_fn` and shouldn't be used elsewhere, and it enforces in the compiler that no one else can use it. r? ````@GuillaumeGomez````
2021-02-05Rollup merge of #81318 - CraftSpider:json-trait-fix, r=jyn514Mara Bos-11/+9
rustdoc-json: Fix has_body Previously, `has_body` was always true. Now propagate the type of the method to set it correctly. Relies on #81287, that will need to be merged first.
2021-02-04Cleanup rustdoc pass descriptions a bitCamelid-7/+7
Also changed a couple of comments from "intra-doc-links" to "intra-doc links" (my understanding is that "intra-doc links" is the standard way to refer to them).
2021-02-03Rollup merge of #81681 - Smittyvb:rustdoc-shortcuts-styling, r=GuillaumeGomezGuillaume Gomez-2/+2
Better styling of "Switch result tab" shortcut Before: ![](https://user-images.githubusercontent.com/10530973/106663877-544de400-6572-11eb-98a4-77b6b3d9cd42.png) ![image](https://user-images.githubusercontent.com/10530973/106664790-8d3a8880-6573-11eb-811f-29c4ade31848.png) After: ![](https://user-images.githubusercontent.com/10530973/106663945-6b8cd180-6572-11eb-911a-12c69d935ee5.png) ![](https://user-images.githubusercontent.com/10530973/106664403-05547e80-6573-11eb-84bf-fdd0dfc7dac8.png)
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-02Better styling of "Switch result tab" shortcutSmitty-2/+2
2021-02-02Bind all clean::Type variants and remove FIXMEGuillaume Gomez-2/+10
2021-02-02Make rustdoc respect `--error-format short`Alexis Bourget-1/+6
The other two (`human` and `json`) are already handled.
2021-02-02Rollup merge of #81630 - GuillaumeGomez:overflow-sidebar-title-text, r=pickfireJonas Schievink-0/+8
Fix overflowing text on mobile when sidebar is displayed Fixes #81597. Before: ![Screenshot from 2021-02-01 17-21-15](https://user-images.githubusercontent.com/3050060/106486857-610b0300-64b2-11eb-96d3-12b939f5b661.png) After: ![Screenshot from 2021-02-01 17-20-59](https://user-images.githubusercontent.com/3050060/106486840-5cdee580-64b2-11eb-9492-4df27bb39e59.png) cc `@pickfire` r? `@Nemo157`
2021-02-02Rollup merge of #81492 - camelid:rustdoc-internal-mod-vis, r=GuillaumeGomezJonas Schievink-1/+3
rustdoc: Note why `rustdoc::html::markdown` is public Almost all of the modules are crate-private, except for `rustdoc::json::types`, which I believe is intended to be for public use; and `rustdoc::html::markdown`, which is used externally by the error-index generator and so has to be public. r? ``@GuillaumeGomez``
2021-02-02Auto merge of #81557 - GuillaumeGomez:primitive-search, r=ollie27bors-14/+27
Fix primitive search in parameters and returned values Part of #60485. Fixes #74780. Replacing #74879. cc `@camelid` `@jyn514` `@CraftSpider` r? `@ollie27`
2021-02-01Fix overflowing text on mobile when sidebar is displayedGuillaume Gomez-0/+8
2021-02-01Put back primitives in searchGuillaume Gomez-14/+27
2021-02-01Rollup merge of #81592 - GuillaumeGomez:rustdoc-ui-fixes, r=Nemo157Jonas Schievink-11/+2
Rustdoc UI fixes The first commit fixes this bug (I couldn't figure out why we were setting the width manually and it works as expected without so...): ![Screenshot from 2021-01-31 12-58-46](https://user-images.githubusercontent.com/3050060/106384371-d56a7700-63ca-11eb-9e04-c06b40c2ab5e.png) The second commit fixes a small bug. On tablets or computer with very little width, the search section goes "over" the search input, making it impossible to click on the search input: ![Screenshot from 2021-01-31 13-22-37](https://user-images.githubusercontent.com/3050060/106384413-021e8e80-63cb-11eb-8321-391a1f8a4c7e.png) The third and last commit fixes two bugs that you can see in this screenshot: ![Screenshot from 2021-01-31 13-41-05](https://user-images.githubusercontent.com/3050060/106384424-0cd92380-63cb-11eb-82de-76218286c3fb.png) The wheel is going over the search input and the search tab is going under the search results text. The bug was fixed by simply switching to "mobile mode" at a bigger width: ![Screenshot from 2021-01-31 13-49-50](https://user-images.githubusercontent.com/3050060/106384466-4447d000-63cb-11eb-9330-a7cd29403905.png) cc ```@pickfire``` r? ```@Nemo157```
2021-01-31rustdoc: Note why `rustdoc::html::markdown` is publicCamelid-1/+3
Almost all of the modules are crate-private, except for `rustdoc::json::types`, which I believe is intended to be for public use; and `rustdoc::html::markdown`, which is used externally by the error-index generator and so has to be public.
2021-01-31Improve resize handlingGuillaume Gomez-1/+1
2021-01-31Prevent search section to go over search inputGuillaume Gomez-1/+1
2021-01-31Remove unneeded explicit width from search resultsGuillaume Gomez-9/+0
2021-01-31Rollup merge of #81563 - pickfire:patch-6, r=GuillaumeGomezJonas Schievink-0/+4
Improve docblock readability on small screen Before ![image](https://user-images.githubusercontent.com/4687791/106363174-f77bdf00-6361-11eb-898f-d480b8460ab3.png) After ![image](https://user-images.githubusercontent.com/4687791/106363259-6bb68280-6362-11eb-85a1-ef9262681dd7.png) Too much space is wasted on the left side. I wanted to make that 0 but it breaks some part with error symbols. 0 ![image](https://user-images.githubusercontent.com/4687791/106363287-90aaf580-6362-11eb-88c1-62a8313988a7.png) After ![image](https://user-images.githubusercontent.com/4687791/106363276-825cd980-6362-11eb-86eb-6f4611b4ab99.png)
2021-01-31Rollup merge of #81558 - pickfire:patch-5, r=GuillaumeGomezJonas Schievink-1/+2
Fix ascii art text wrapping in mobile Fix #81377 Before ![image](https://user-images.githubusercontent.com/4687791/106362405-a1a53800-635d-11eb-87b9-2f40bbd023bf.png) ![image](https://user-images.githubusercontent.com/4687791/106362410-aa960980-635d-11eb-96ee-979251b213a3.png) ![image](https://user-images.githubusercontent.com/4687791/106362562-80911700-635e-11eb-97ee-b19a6ea2fc6d.png) After ![image](https://user-images.githubusercontent.com/4687791/106362428-b4b80800-635d-11eb-8d5b-e4f51f5501ee.png) ![image](https://user-images.githubusercontent.com/4687791/106362433-bbdf1600-635d-11eb-96af-7043c74b3a0a.png) ![image](https://user-images.githubusercontent.com/4687791/106362570-8f77c980-635e-11eb-928d-ef1d26c13136.png) Note the second image is scrolled to the back (right), I added some padding for the text block (not the code block) to make it more comfortable to read since the last character is stuck to the last character.
2021-01-31Remove extra trailing spacesIvan Tham-1/+1
2021-01-31Fix docblock short code missing end whitespacesIvan Tham-0/+3
2021-01-31Improve docblock readability on small screenIvan Tham-0/+4
2021-01-31Fix ascii art text wrapping in mobileIvan Tham-3/+1
Fix #81377
2021-01-30Balance sidebar `Deref` cycle check with main contentJ. Ryan Stinnett-7/+11
The `Deref` cycle checks added as part of #80653 were "unbalanced" in the sense that the main content code path checks for cycles _before_ descending, while the sidebar checks _after_. Checking _before_ is correct, so this changes the sidebar path to match the main content path.
2021-01-30Rollup merge of #81512 - GuillaumeGomez:cleanup-fixme-rustdoc, r=bugadaniYuki Okushi-2/+1
Add missing variants in match binding cc `````@bugadani````` `````@CraftSpider````` r? `````@camelid`````
2021-01-30Rollup merge of #81495 - camelid:rustdoc-output_format-optional, ↵Yuki Okushi-13/+21
r=GuillaumeGomez rustdoc: Remove unnecessary optional Previously, the HTML output format was represented by both `Some(OutputFormat::Html)` and `None` so there's no need to have an optional. Instead, `OutputFormat::Html` is explicitly the default and we no longer have a "tri-state enum". r? `````@GuillaumeGomez`````
2021-01-30rustdoc tweakingbors-512/+520
* Reuse memory * simplify `next_def_id`, avoid multiple hashing and unnecessary lookups * remove `all_fake_def_ids`, use the global map instead (probably not a good step toward parallelization, though...) * convert `add_deref_target` to iterative implementation * use `ArrayVec` where we know the max number of elements * minor touchups here and there * avoid building temporary vectors that get appended to other vectors At most places I may or may not be doing the compiler's job is this PR.
2021-01-29rustdoc: Move `display_fn` struct inside `display_fn`Camelid-11/+11
This makes it clear that it's an implementation detail of `display_fn` and shouldn't be used elsewhere, and it enforces in the compiler that no one else can use it.
2021-01-29Add missiong variants in match bindingGuillaume Gomez-2/+1
2021-01-28Remove struct_type from union output and bump formatRune Tynan-5/+4
2021-01-28Fix has_body for trait methodsRune Tynan-11/+9
2021-01-28rustdoc: Remove unnecessary optionalCamelid-13/+21
Previously, the HTML output format was represented by both `Some(OutputFormat::Html)` and `None` so there's no need to have an optional. Instead, `OutputFormat::Html` is explicitly the default and we no longer have a "tri-state enum".
2021-01-29Rollup merge of #81459 - probablykasper:text-selection-fix, r=Nemo157Yuki Okushi-32/+32
Fix rustdoc text selection for page titles Fixes text selection of page titles by placing the `h1.fqn span.in-band` element before `h1.fqn span.out-of-band`. Before vs after: https://user-images.githubusercontent.com/11315492/105768203-55708700-5f5c-11eb-924b-4e7527ffe147.mp4 Retry of PR #81397 due to merge conflicts confusing me. Recreated the same changes as in that PR, but now when I run `./x.py doc library/std`, no changes I make to `src/librustdoc/html/render/mod.rs` to the file are reflected in the built doc files, even if I delete the `build` folder. I'm guessing there's some cache I'm missing? r? `@Nemo157`
2021-01-29Rollup merge of #81287 - CraftSpider:json-crate, r=jyn514,GuillaumeGomezYuki Okushi-546/+51
Split rustdoc JSON types into separately versioned crate For now just an in-tree change. In the future, this may be exposed as a standalone crate with standard semver.
2021-01-29Rollup merge of #79991 - camelid:rustdoc-for-lifetime, r=GuillaumeGomez,jyn514Yuki Okushi-6/+15
rustdoc: Render HRTB correctly for bare functions The angle brackets were not rendered, so code like this: some_func: for<'a> fn(val: &'a i32) -> i32 would be rendered as: some_func: fn'a(val: &'a i32) -> i32 However, rendering with angle brackets is still invalid syntax: some_func: fn<'a>(val: &'a i32) -> i32 so now it renders correctly as: some_func: for<'a> fn(val: &'a i32) -> i32 ----- However, note that this code: some_trait: dyn for<'a> Trait<'a> will still render as: some_trait: dyn Trait<'a> which is not invalid syntax, but is still unclear. Unfortunately I think it's hard to fix that case because there isn't enough information in the `rustdoc::clean::Type` that this code operates on. Perhaps that case can be fixed in a later PR. r? ``@jyn514``
2021-01-28Rollup merge of #81379 - GuillaumeGomez:improve-urls, r=Nemo157Yuki Okushi-7/+17
Improve URLs handling Fixes #81330. Explanations: before this PR, when emptying the search input, we still had `?search=` in the URL, which wasn't very nice. Now, if the search is empty, we drop the `?search=` part. Also, I realized while working on this PR that when we clicked on a menu link when we were on the search results, the search parameters would look like: `?search=#the-anchor`, which was super weird. Now, it looks like this: `?search=the-search#the-anchor`. Also, I didn't use the `Url` very nice API because it's not available in any IE version (sadness...). cc `````@lzutao````` r? `````@Nemo157`````
2021-01-28Rollup merge of #81284 - jyn514:impl-times, r=wesleywiserYuki Okushi-16/+18
Make `-Z time-passes` less noisy - Add the module name to `pre_AST_expansion_passes` and don't make it a verbose event (since it normally doesn't take very long, and it's emitted many times) - Don't make the following rustdoc events verbose; they're emitted many times. + build_extern_trait_impl + build_local_trait_impl + build_primitive_trait_impl + get_auto_trait_impls + get_blanket_trait_impls - Remove the `get_auto_trait_and_blanket_synthetic_impls` rustdoc event; it's wholly covered by get_{auto,blanket}_trait_impls and not very useful. I found this while working on https://github.com/rust-lang/rust/pull/81275 but it's independent of those changes.
2021-01-28Rollup merge of #79951 - LeSeulArtichaut:ty-ir, r=nikomatsakisYuki Okushi-2/+37
Refractor a few more types to `rustc_type_ir` In the continuation of #79169, ~~blocked on that PR~~. This PR: - moves `IntVarValue`, `FloatVarValue`, `InferTy` (and friends) and `Variance` - creates the `IntTy`, `UintTy` and `FloatTy` enums in `rustc_type_ir`, based on their `ast` and `chalk_ir` equilavents, and uses them for types in the rest of the compiler. ~~I will split up that commit to make this easier to review and to have a better commit history.~~ EDIT: done, I split the PR in commits of 200-ish lines each r? `````@nikomatsakis````` cc `````@jackh726`````
2021-01-27rustdoc: Render HRTB correctly for bare functionsCamelid-6/+15
The angle brackets were not rendered, so code like this: some_func: for<'a> fn(val: &'a i32) -> i32 would be rendered as: some_func: fn'a(val: &'a i32) -> i32 However, rendering with angle brackets is still invalid syntax: some_func: fn<'a>(val: &'a i32) -> i32 so now it renders correctly as: some_func: for<'a> fn(val: &'a i32) -> i32 ----- However, note that this code: some_trait: dyn for<'a> Trait<'a> will still render as: some_trait: dyn Trait<'a> which is not invalid syntax, but is still unclear. Unfortunately I think it's hard to fix that case because there isn't enough information in the `rustdoc::clean::Type` that this code operates on. Perhaps that case can be fixed in a later PR.