about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
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.
2021-01-28Fix rustdoc page title text selectionKasper-32/+32
2021-01-27Update crate name and add READMERune Tynan-3/+3
2021-01-27`src/etc/json-types` -> `src/rustdoc-json-types`Rune Tynan-1/+1
2021-01-27Simplify conversionRune Tynan-8/+1
2021-01-27Move into src/etcRune Tynan-504/+1
2021-01-27Allow rustc::default_hash_types in the offending statementRune Tynan-0/+3
2021-01-27Split JSON into separately versioned crateRune Tynan-59/+71
2021-01-27Fix clean/types doc linksGuillaume Gomez-0/+3
2021-01-27More cleanupGuillaume Gomez-30/+18
2021-01-27Unify cache usage and improve namingGuillaume Gomez-11/+12
2021-01-27Improve documentation on GetDefId trait's methodsGuillaume Gomez-3/+13
2021-01-27Update to new rustdoc APIsGuillaume Gomez-8/+4
2021-01-27Apply review comments and improve codeGuillaume Gomez-24/+20
2021-01-27Remove cache usage wherever possibleGuillaume Gomez-166/+179
2021-01-27Use empty Cache for methods requiring it when filling Cache itselfGuillaume Gomez-48/+70
2021-01-27Remove CACHE_KEY globalGuillaume Gomez-663/+728
2021-01-27Rollup merge of #81299 - GuillaumeGomez:fix-eslint-detected-bugs, r=Nemo157Yuki Okushi-31/+33
Fix some bugs reported by eslint Simply went into `src/librustdoc/html/static/` and ran `eslint *.js` in case you want to reproduce. :) r? ``````@Nemo157``````
2021-01-25Improve URL handling when clicking on a menu link while being on the search ↵Guillaume Gomez-7/+16
results and overall
2021-01-25Completely remove search query parameter when clearing search inputGuillaume Gomez-1/+2
2021-01-25Fix some bugs reported by eslintGuillaume Gomez-31/+33
2021-01-24Rollup merge of #81302 - LeSeulArtichaut:80777-trait-render, r=jyn514Jonas Schievink-30/+21
Fix rendering of stabilization version for trait implementors Rustdoc compares an item's stabilization version with its parent's to not render it if they are the same. Here, the implementor was compared with itself, resulting in the stabilization version never getting shown. This probably needs a test. Fixes #80777. r? `@jyn514`
2021-01-24Rollup merge of #81264 - Swatinem:doctest-run-directory, r=jyn514Jonas Schievink-0/+16
Add unstable option to control doctest run directory This option will allow splitting the compile-time from the run-time directory of doctest invocations and is one step to solve https://github.com/rust-lang/cargo/issues/8993#issuecomment-760088944 r? `@jyn514`
2021-01-23Fix rendering of stabilization version for trait implementorsLeSeulArtichaut-4/+4
2021-01-23Rollup merge of #81288 - camelid:fix-trait-item-vis, r=jyn514Jonas Schievink-2/+19
rustdoc: Fix visibility of trait and impl items Fixes #81274. r? `@jyn514`
2021-01-23Rollup merge of #81275 - jyn514:time-render, r=wesleywiserJonas Schievink-14/+32
Fix <unknown> queries and add more timing info to render_html Closes https://github.com/rust-lang/rust/issues/81251. ## Fix `<unknown>` queries This happened because `alloc_query_strings` was never called. ## Add more timing info to render_html This still has some issues I'm not sure how to work out: - `create_renderer` and `renderer_after_krate` aren't shown by default. I want something like `verbose_generic_activity_with_arg`, but it doesn't exist. I'm also not sure how to show activities that aren't on by default - I tried `-Z self-profile -Z self-profile-args=all`, but it didn't show up. r? `@wesleywiser`
2021-01-23Add option to control doctest run directoryArpad Borsos-0/+16
This option will allow splitting the compile-time from the run-time directory of doctest invocations and is one step to solve https://github.com/rust-lang/cargo/issues/8993#issuecomment-760088944
2021-01-23Cleanup `render_stability_since_raw` to remove code duplicationLeSeulArtichaut-26/+17
2021-01-23Make `-Z time-passes` less noisyJoshua Nelson-16/+18
- 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 `get_auto_trait_and_blanket_synthetic_impls`; it's wholly covered by get_{auto,blanket}_trait_impls and not very useful.
2021-01-23Calculate self-profile strings in `Compiler::enter` instead in codegenJoshua Nelson-6/+3
This avoids each tool having to separately find and call `self_profile_alloc_strings`. - Don't compute the global context if it hasn't yet been computed This avoids giving extraneous errors about unresolved names if an error occurs during parsing.
2021-01-23Add more timing info to render_htmlJoshua Nelson-13/+31
- Show `create_renderer` and `renderer_after_crate` by default - Don't rewrite `extra_verbose_generic_activity`
2021-01-22rustdoc: Fix visibility of trait and impl itemsCamelid-2/+19
2021-01-22Fix <unknown> queriesJoshua Nelson-2/+5
This happened because `alloc_query_strings` was never called.
2021-01-22Rollup merge of #81227 - CraftSpider:struct-type-clean, r=jyn514Mara Bos-53/+24
Remove doctree::StructType Also removes it from the Union type, as unions can only ever be 'Plain'. Adds a new StructType to JSON, 'union', as the easiest way to encode the type of a union there. This leaves only one item in doctree, `Module`. r? `@jyn514`
2021-01-22Rollup merge of #81225 - CraftSpider:json-opt-docs, r=jyn514Mara Bos-4/+5
Make 'docs' nullable in rustdoc-json output Matches the backing better, and makes it so there's a difference between 'empty docs' and 'no docs'.
2021-01-22Rollup merge of #80573 - jyn514:tool-lints, r=GuillaumeGomezMara Bos-30/+31
Deny rustc::internal lints for rustdoc and clippy - Fix rustc::internal lints for rustdoc - Deny internal lints only for rustdoc and clippy (previously the lints were ignored for clippy because -Zunstable-options didn't get passed)
2021-01-21Deny internal lints for rustdocJoshua Nelson-0/+1
2021-01-21Fix rustc::internal lints on rustdocJoshua Nelson-30/+30