Commit Graph

87 Commits

Author SHA1 Message Date
Guillaume Gomez
1a15c7147f Fix rustdoc JSON inline 2022-07-16 13:39:38 +02:00
Guillaume Gomez
87d90b1332 Fix rustdoc handling of primitive documentation 2022-06-17 14:41:07 +02:00
Guillaume Gomez
a752f82f19 Ignore impl items because they can be duplicated in case of generic impl 2022-06-13 15:29:29 +02:00
Guillaume Gomez
77e729ea92 Add Symbol into rustdoc JSON ID to prevent conflicts between reexports 2022-06-02 11:14:32 +02:00
Jacob Pratt
6970246886
Remove crate visibility modifier in libs, tests 2022-05-21 00:32:47 -04:00
Guillaume Gomez
b1e6211c5c Rename def_id into item_id when the type is ItemId for readability 2022-04-16 14:28:09 +02:00
Nixon Enraght-Moony
a5c0b1470c rustdoc-json-types: implementors -> implementations
Closes #94198
2022-03-14 00:05:11 +00:00
Nixon Enraght-Moony
ae158224ac rustdoc-json: buffer output 2022-02-13 01:25:54 +00:00
Rune Tynan
f4b42946c8 Remove FIXME and fix inconsistency of local blanket impls by using HIR for them 2022-01-21 13:01:58 -05:00
Matthias Krüger
51fd48f157
Rollup merge of #93099 - tomkris:rustdoc-fix, r=jsha
rustdoc: auto create output directory when "--output-format json"

This PR allows rustdoc to automatically create output directory in case it does not exist (when run with `--output-format json`).

This fixes rustdoc crash:

````
$ rustdoc --output-format json -Z unstable-options src/main.rs
error: couldn't generate documentation: No such file or directory (os error 2)
  |
  = note: failed to create or modify "doc/main.json"

error: aborting due to previous error
````

With this fix behavior of `rustdoc --output-format json` becomes consistent with `rustdoc --output-format html` (which already auto-creates output directory if it's missing)
2022-01-20 23:37:39 +01:00
Matthias Krüger
530c884372
Rollup merge of #92860 - CraftSpider:rustdoc-json-impl-ice, r=jsha
Fix errors on blanket impls by ignoring the children of generated impls

Related to #83718

We can safely skip the children, as they don't contain any new info, and may be subtly different for reasons hard to track down, in ways that are consistently worse than the actual generic impl.
2022-01-20 23:37:31 +01:00
Artem Kryvokrysenko
4e17170c54 rustdoc: auto create output directory when "--output-format json"
This PR allows rustdoc to automatically create output directory in case
it does not exist (when run with `--output-format json`).

This fixes rustdoc crash:

````
$ rustdoc --output-format json -Z unstable-options src/main.rs
error: couldn't generate documentation: No such file or directory (os error 2)
  |
  = note: failed to create or modify "doc/main.json"

error: aborting due to previous error
````

With this fix behavior of `rustdoc --output-format json` becomes consistent
with `rustdoc --output-format html` (which already auto-creates output
directory if it's missing)
2022-01-19 22:28:07 -08:00
Nicholas Nethercote
10b1c9aa8b rustdoc: avoid many Symbol to String conversions.
Particularly when constructing file paths and fully qualified paths.
This avoids a lot of allocations, speeding things up on almost all
examples.
2022-01-14 11:57:18 -08:00
Rune Tynan
474e091160 Move FIXME to if statement 2022-01-13 14:46:04 -05:00
Rune Tynan
aafcbf1e70 Update comment to make it a FIXME 2022-01-13 14:43:32 -05:00
Rune Tynan
a6aa3cb2c1 inline ItemId method, clarify comments a bit 2022-01-13 14:40:28 -05:00
Rune Tynan
aa523a9b4b Fix errors on blanket impls by ignoring the children of their generated implementations 2022-01-13 12:40:07 -05:00
bors
65d8785f0a Auto merge of #92377 - compiler-errors:rustdoc-lifetimes, r=camelid,jyn514
remove in_band_lifetimes from librustdoc

r? `@camelid`

closes #92368
2021-12-30 08:26:07 +00:00
Michael Goulet
bc7968f961 remove in_band_lifetimes from librustdoc 2021-12-28 18:18:00 -08:00
Noah Lev
2b801dcdd3 Move ExternalLocation to clean::types
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-27 18:57:07 -08:00
Noah Lev
60a1abe4c5 Rename rustdoc::html::render::cache to search_index
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-27 18:42:13 -08:00
Yuval Dolev
43f4ef5c6a Moved format-version constant to rustdoc-json-types 2021-10-15 12:27:42 +03:00
Guillaume Gomez
4adc8ea2ac
Rollup merge of #89669 - Urgau:json-remove-type-never, r=GuillaumeGomez
Remove special-casing of never primitive in rustdoc-json-types

Fixes https://github.com/rust-lang/rust/issues/89349

r? `@GuillaumeGomez`
2021-10-08 22:30:42 +02:00
Matthias Krüger
e6f77a1787 clippy::complexity fixes 2021-10-08 20:07:44 +02:00
Loïc BRANSTETT
4891aaf2e9 Remove special-casing of never primitive in rustdoc-json-types 2021-10-08 16:53:39 +02:00
Manish Goregaokar
7a09755148
Rollup merge of #88234 - hkmatsumoto:rustdoc-impls-for-primitive, r=jyn514
rustdoc-json: Don't ignore impls for primitive types

Fix the issue discussed at [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.E2.9C.94.20Json.20output.20lacks.20some.20item.20which.20are.20supposed.20to.20be.20there)

r? ``@jyn514``
2021-10-04 23:56:16 -07:00
Hirochika Matsumoto
e18a8efb8b Don't ignore impls for primitive types 2021-09-29 23:57:01 +09:00
Loïc BRANSTETT
88ff75c6cc Fix populate of union.impls 2021-09-26 18:22:07 +02:00
Noah Lev
2a60229490 rustdoc: Clean up handling of lifetime bounds
Previously, rustdoc recorded lifetime bounds by rendering them into the
name of the lifetime parameter. Now, it leaves the name as the actual
name and instead records lifetime bounds in an `outlives` list, similar
to how type parameter bounds are recorded.
2021-09-02 14:27:59 -07:00
Justus K
97c82d8731
Revert "rustdoc: Store DefId's in ItemId on heap for decreasing Item's size"
This reverts commit 41a345d4c46dad1a98c9993bc78513415994e8ba.
2021-07-05 19:51:54 +02:00
Justus K
45d3daece3
rustdoc: Store DefId's in ItemId on heap for decreasing Item's size 2021-07-05 19:51:51 +02:00
Justus K
acd4dc2d0c
rustdoc: Rename expect_real to expect_def_id, remove Item::is_fake 2021-07-05 19:49:48 +02:00
Justus K
43e1cdbaf9
rustdoc: Replace FakeDefId with new ItemId type 2021-07-05 19:49:43 +02:00
Ellen
f7117f8c17 format version 2021-06-07 09:47:05 +01:00
Justus K
67d8d18b23
Minimize amount of fake DefIds used in rustdoc 2021-05-15 13:21:35 +02:00
Justus K
b6120bfb35
Add type to differentiate between fake and real DefId's 2021-05-04 19:34:12 +02:00
Timothée Delabrouille
2cc263988e only store locations in extern_locations 2021-04-29 19:46:29 +02:00
Joshua Nelson
03ace761fb rustdoc: Turn JsonRenderer::mod_item_in into unreachable!()
The JSON renderer no longer gets called on modules.
2021-04-24 11:03:02 -04:00
Joshua Nelson
edb60a9243 Remove unnecessary item_name parameter to mod_item_in 2021-04-22 19:53:38 -04:00
Joshua Nelson
7f6d540440 Remove unnecessary item_name parameter to mod_item_out 2021-04-22 19:46:53 -04:00
Joshua Nelson
640cc741e0 Remove unnecessary edition parameter to renderer 2021-04-22 19:35:20 -04:00
Joshua Nelson
68db5869e3 Remove unnecessary diag parameter to after_krate 2021-04-22 19:32:24 -04:00
Joshua Nelson
f435f7185b Remove unnecessary crate_name parameter to after_krate
It's always `tcx.crate_name(LOCAL_CRATE)`, it doesn't need to be passed
in separately.
2021-04-22 19:27:37 -04:00
Dylan DPC
0502815529
Rollup merge of #83055 - aDotInTheVoid:selective-strip-item-doc, r=jyn514
[rustdoc] Don't document stripped items in JSON renderer.

Fixes #80664, see [my comment there](https://github.com/rust-lang/rust/issues/80664#issuecomment-797557948) for why

Note that we already do something similar in `convert_item`:

bb4cdf8ec0/src/librustdoc/json/conversions.rs (L28-L31)

``@rustbot`` modify labels: +T-rustdoc +A-rustdoc-json

r? ``@jyn514``
cc ``@CraftSpider``
2021-03-26 02:34:38 +01:00
Guillaume Gomez
0cde85523f Rework rustdoc const type 2021-03-24 21:48:34 +01:00
Nixon Enraght-Moony
9ba92972ed Don't call item on modules for json renderer
Closes #80664
2021-03-24 16:54:13 +00:00
Dylan DPC
5c0d880e4b
Rollup merge of #83415 - camelid:remove-crate-module-option, r=jyn514
Remove unnecessary `Option` wrapping around `Crate.module`

I'm wondering if it was originally there so that we could `take` the
module which enables `after_krate` to take an `&Crate`. However, the two
impls of `after_krate` only use `Crate.name`, so we can pass just the
name instead.
2021-03-24 01:52:36 +01:00
Camelid
68244fc521 Remove unnecessary Option wrapping around Crate.module
I'm wondering if it was originally there so that we could `take` the
module which enables `after_krate` to take an `&Crate`. However, the two
impls of `after_krate` only use `Crate.name`, so we can pass just the
name instead.
2021-03-23 11:04:09 -07:00
Camelid
9b9bb71c59 Bump rustdoc-json format version
The rustdoc-json-types renames are breaking changes.
2021-03-21 19:47:12 -07:00
Camelid
e190983bd3 Rename rustdoc_json_types::Item.source to span 2021-03-21 19:47:12 -07:00