Commit Graph

34 Commits

Author SHA1 Message Date
Rune Tynan ca48d1566e
Add roundtrip testing and bump format version 2021-03-06 15:50:28 -05:00
Rune Tynan cf5246915b
Remove Item::kind, use tagged enum. Rename variants to match 2021-03-06 15:50:20 -05:00
Guillaume Gomez f879ecc4ef Make ItemKind::ExternCrate looks like hir::ItemKind::ExternCrate to make transition over hir::ItemKind simpler 2021-03-05 16:04:24 +01:00
Joshua Nelson be069a687a Remove `krate.version`; fix `crate_version` in JSON
Previously, `JsonRenderer::after_krate` called `krate.version.clone()`.
The problem was it did that after the version was already moved into the
cache, so it would always be None. The fix was to get the version from
the cache instead.
2021-03-01 00:30:40 -05:00
Joshua Nelson 4d7a648485 Remove the dummy cache in `DocContext`
The same information is available everywhere; the only reason the dummy
cache was needed is because it waas previously stored in three different
places. This consolidates the info a bit so the cache in `DocContext` is
used throughout. As a bonus, it means `renderinfo` is used much much
less.

- Return a `Cache` from `run_global_ctxt`, not `RenderInfo`
- Remove the unused `render_info` from `run_renderer`
- Remove RefCell around `inlined`
- Add intra-doc links
2021-03-01 00:30:30 -05:00
Guillaume Gomez b5c8eea55d Put clean::Trait extra information into a new struct to make it more coherent 2021-02-23 21:58:16 +01:00
Guillaume Gomez 58a34a4dde Remove is_spotlight field from `Trait` 2021-02-23 21:57:40 +01:00
Joshua Nelson 2bc5a0a600 Make `Clean` take &mut DocContext
- Take `FnMut` in `rustc_trait_selection::find_auto_trait_generics`
- Take `&mut DocContext` in most of `clean`
- Collect the iterator in auto_trait_impls instead of iterating lazily; the lifetimes were really bad.
- Changes `fn sess` to properly return a borrow with the lifetime of `'tcx`, not the mutable borrow.
2021-02-16 21:25:14 -05:00
Rune Tynan a26fa74d3c
Make `header` a vec of modifiers, make FunctionPointer consistent with Function and Method. 2021-02-08 14:00:30 -05:00
Rune Tynan 3106de5f2a
Remove struct_type from union output and bump format 2021-01-28 23:30:40 -05:00
Rune Tynan 67b78a0271
Update crate name and add README 2021-01-27 18:58:44 -05:00
Rune Tynan cca4eea6f9
Simplify conversion 2021-01-27 18:58:40 -05:00
Rune Tynan 28f6cab498
Allow rustc::default_hash_types in the offending statement 2021-01-27 18:57:14 -05:00
Rune Tynan c689b97fba
Split JSON into separately versioned crate 2021-01-27 18:56:57 -05:00
Guillaume Gomez cac238e4a3 More cleanup 2021-01-27 10:05:06 +01:00
Guillaume Gomez d98a72c77b Update to new rustdoc APIs 2021-01-27 10:05:06 +01:00
Guillaume Gomez 9fd5a67984 Remove CACHE_KEY global 2021-01-27 10:05:05 +01:00
Jonas Schievink 81647c627a
Rollup merge of #81275 - jyn514:time-render, r=wesleywiser
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-23 20:16:10 +01:00
Joshua Nelson 1d1010f1af Add more timing info to render_html
- Show `create_renderer` and `renderer_after_crate` by default
- Don't rewrite `extra_verbose_generic_activity`
2021-01-23 11:42:11 -05:00
Mara Bos 1cc13b4f5a
Rollup merge of #81225 - CraftSpider:json-opt-docs, r=jyn514
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-22 14:30:14 +00:00
Joshua Nelson a194881991 Fix rustc::internal lints on rustdoc 2021-01-21 22:25:59 -05:00
Rune Tynan 26565f05c0
Bump format version 2021-01-21 21:18:31 -05:00
Joshua Nelson d926147ccb Remove unnecessary `after_run` function
It's called at the same time and in the same place as `after_krate`, so
they can be combined.
2021-01-19 02:04:18 -05:00
Joshua Nelson 4a4426377e Box ItemKind to reduce the size of `Item`
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-23 12:50:35 -05:00
Joshua Nelson 47c969436a Make it compile 2020-12-17 11:36:04 -05:00
Joshua Nelson 9221d4d1d3 [tmp] Pass `TyCtxt` through to the render backend
First actually useful step in https://github.com/rust-lang/rust/issues/76382

This doesn't yet compile because there's no way to get a `Lrc<Session>`
from a TyCtxt, only a `&Session`.
2020-12-17 11:36:04 -05:00
Joshua Nelson 7ee8e1816f Use `Symbol`s for crate names 2020-12-15 21:22:35 -05:00
Joshua Nelson 0e574fb39a Fix the JSON backend
This was simpler than expected.
2020-12-12 00:01:25 -05:00
Joshua Nelson af6aa9f431 Pass Session into renderer 2020-12-12 00:00:09 -05:00
Nixon Enraght-Moony c254a15906 Use true ID for def_id. 2020-12-05 22:38:57 +00:00
Nixon Enraght-Moony 40b5470b0d Address review comments.
Go back to CRATE_DEF_INDEX

Minor niceness improvements

Don't output hidden items

Remove striped items from fields

Add $TEST_BASE_DIR

Small catch
2020-12-01 18:34:39 +00:00
Joseph Ryan 66884e318f Add json backend
Respond to comments and start adding tests

Fix re-exports and extern-crate

Add expected output tests

Add restricted paths

Format

Fix: associated methods missing in output

Ignore stripped items

Mark stripped items

removing them creates dangling references

Fix tests and update conversions

Don't panic if JSON backend fails to create a file

Fix attribute error in JSON testsuite

Move rustdoc-json to rustdoc/

This way it doesn't have to build rustc twice. Eventually it should
probably get its own suite, like rustdoc-js, but that can be fixed in a
follow-up.

Small cleanups

Don't prettify json before printing

This fully halves the size of the emitted JSON.

Add comments

[BREAKING CHANGE] rename version -> crate_version

[BREAKING CHANGE] rename source -> span

Use exhaustive matches

Don't qualify imports for DefId

Rename clean::{ItemEnum -> ItemKind}, clean::Item::{inner -> kind}

Fix Visibility conversion

clean::Visability was changed here:
https://github.com/rust-lang/rust/pull/77820/files#diff-df9f90aae0b7769e1eb6ea6f1d73c1c3f649e1ac48a20e169662a8930eb427beL1467-R1509

More churn catchup

Format
2020-12-01 18:34:39 +00:00
Joshua Nelson d6c16e4253 Make all rustdoc functions and structs crate-private
This gives warnings about dead code.
2020-11-15 11:21:12 -05:00
Joseph Ryan 48c6f05662
Update driver to add json backend 2020-07-30 14:13:51 -05:00