about summary refs log tree commit diff
path: root/src/librustdoc/formats
AgeCommit message (Collapse)AuthorLines
2021-05-03Rollup merge of #84811 - scottmcm:rustdoc-trait-alias-fix, r=jyn514Dylan DPC-14/+32
RustDoc: Fix bounds linking trait.Foo instead of traitalias.Foo Fixes #84782 The code was assuming `Trait` when adding bounds to the cache, so add a check on the DefId to see what its kind really is. r? `@jyn514` Before: ![image](https://user-images.githubusercontent.com/18526288/116775611-6a751e80-aa53-11eb-84d0-ed6b7782be3c.png) After: ![image](https://user-images.githubusercontent.com/18526288/116802227-d19cdc80-ab00-11eb-8133-7b34dd750da2.png)
2021-05-01RustDoc: Fix bounds linking trait.Foo instead of traitalias.FooScott McMurray-14/+32
2021-04-29only store locations in extern_locationsTimothée Delabrouille-7/+3
2021-04-28added methods src_root and location to External crate, remove ↵Timothée Delabrouille-11/+2
extern_location function
2021-04-27Removed usage of Attributes in FnDecl and ExternalCrate. Relocate part of ↵Timothée Delabrouille-3/+5
the fields in Attributes, as functions in AttributesExt. refacto use from_def_id_and_attrs_and_parts instead of an old trick most of josha suggestions + check if def_id is not fake before using it in a query Removed usage of Attributes in FnDecl and ExternalCrate. Relocate part of the Attributes fields as functions in AttributesExt.
2021-04-25Rollup merge of #84464 - jyn514:type-kind, r=CraftSpiderYuki Okushi-19/+39
rustdoc: Get rid of `clean::TypeKind` It does exactly the same thing as ItemType.
2021-04-24Rollup merge of #84458 - jyn514:cleanup-after-krate, r=GuillaumeGomezYuki Okushi-23/+12
Remove unnecessary fields and parameters in rustdoc r? `@GuillaumeGomez`
2021-04-23Fix macro bug in `impl From<DefKind> for ItemType`Joshua Nelson-1/+5
This was missed a while ago when support for proc-macro attributes was first added.
2021-04-23Don't repeat `hir::def::DefKind` so muchJoshua Nelson-33/+33
2021-04-23Use ItemType in cacheJoshua Nelson-21/+1
2021-04-23Take ItemType instead of TypeKind in record_extern_fqnJoshua Nelson-2/+38
2021-04-22Remove unnecessary item_name parameter to `mod_item_in`Joshua Nelson-7/+4
2021-04-22Remove unnecessary `item_name` parameter to `mod_item_out`Joshua Nelson-2/+4
2021-04-22Remove unnecessary `edition` parameter to rendererJoshua Nelson-4/+2
2021-04-22Remove unnecessary `diag` parameter to `after_krate`Joshua Nelson-5/+2
2021-04-22Remove unnecessary `crate_name` parameter to `after_krate`Joshua Nelson-7/+2
It's always `tcx.crate_name(LOCAL_CRATE)`, it doesn't need to be passed in separately.
2021-04-22Get rid of ExternCrate::primitivesJoshua Nelson-1/+1
2021-04-22Remove `name` field from ExternalCrateJoshua Nelson-3/+4
2021-04-22Remove src field from ExternCrateJoshua Nelson-1/+1
2021-04-06Store links in Cache instead of on items directlyJoshua Nelson-0/+5
Items are first built after rustdoc creates the TyCtxt. To allow resolving the links before the TyCtxt is built, the links can't be stored on `clean::Item` directly.
2021-04-06Rollup merge of #83835 - notriddle:sort-index, r=ollie27Yuki Okushi-12/+1
rustdoc: sort search index items for compression This should not affect the appearance of the docs pages themselves. This makes the pre-compressed search index smaller, thanks to the empty-string path duplication format, and also the gzipped version, by giving the algorithm more structure to work with. rust$ wc -c search-index-old.js search-index-new.js 2628334 search-index-old.js 2586181 search-index-new.js 5214515 total rust$ gzip search-index-* rust$ wc -c search-index-old.js.gz search-index-new.js.gz 239486 search-index-old.js.gz 237386 search-index-new.js.gz 476872 total
2021-04-04Get rid of unneeded `aliases` fieldMichael Howell-4/+0
2021-04-03rustdoc: sort search index items for compressionMichael Howell-8/+1
This should not affect the appearance of the docs pages themselves. This makes the pre-compressed search index smaller, thanks to the empty-string path duplication format, and also the gzipped version, by giving the algorithm more structure to work with. rust$ wc -c search-index-old.js search-index-new.js 2628334 search-index-old.js 2586181 search-index-new.js 5214515 total rust$ gzip search-index-* rust$ wc -c search-index-old.js.gz search-index-new.js.gz 239486 search-index-old.js.gz 237386 search-index-new.js.gz 476872 total
2021-04-04Rollup merge of #83756 - camelid:internal-rename-doc-spotlight, r=GuillaumeGomezYuki Okushi-2/+2
rustdoc: Rename internal uses of `spotlight` I didn't make these renames in #80965 because I didn't want the PR to conflict with #80914.
2021-04-02rustdoc: Rename internal uses of `spotlight`Camelid-2/+2
I didn't make these renames in #80965 because I didn't want the PR to conflict with #80914.
2021-04-02Rollup merge of #83478 - jyn514:fine-grained-files, r=Mark-SimulacrumDylan DPC-0/+5
rustdoc: Add unstable option to only emit shared/crate-specific files The intended use case is for docs.rs, which can now copy exactly the files it cares about, rather than having to guess based on whether they have a resource suffix or not. In particular, some files have a resource suffix but cannot be shared between crates: https://github.com/rust-lang/docs.rs/pull/1312#issuecomment-798783688 The end goal is to fix rust-lang/docs.rs#1327 by reverting rust-lang/docs.rs#1324. This obsoletes `--print=unversioned-files`, which I plan to remove as soon as docs.rs stops using it. I recommend reviewing this one commit at a time. r? ``@GuillaumeGomez`` cc ``@Nemo157`` ``@pietroalbini``
2021-04-02Auto merge of #80965 - camelid:rename-doc-spotlight, r=jyn514bors-1/+1
Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]` Fixes #80936. "spotlight" is not a very specific or self-explaining name. Additionally, the dialog that it triggers is called "Notable traits". So, "notable trait" is a better name. * Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]` * Rename `#![feature(doc_spotlight)]` to `#![feature(doc_notable_trait)]` * Update documentation * Improve documentation r? `@Manishearth`
2021-03-25Add unstable option to only emit shared/crate-specific filesJoshua Nelson-0/+5
The intended use case is for docs.rs, which can now copy exactly the files it cares about, rather than having to guess based on whether they have a resource suffix or not. In particular, some files have a resource suffix but cannot be shared between crates: https://github.com/rust-lang/docs.rs/pull/1312#issuecomment-798783688 The end goal is to fix https://github.com/rust-lang/docs.rs/issues/1327 by reverting https://github.com/rust-lang/docs.rs/pull/1324. This obsoletes `--print=unversioned-files`, which I plan to remove as soon as docs.rs stops using it.
2021-03-24Don't call `item` on modules for json rendererNixon Enraght-Moony-1/+6
Closes #80664
2021-03-23Remove unnecessary `Option` wrapping around `Crate.module`Camelid-13/+7
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-22Don't push the crate name onto the `Cache.stack`Camelid-2/+0
Now that we record the crate's name in its `clean::Item`, pushing the crate name onto the `stack` causes duplicate paths. E.g., the URL generated for the path `::foo::bar::baz` would be something like ../foo/foo/bar/baz With this commit, the URL is corrected to ../foo/bar/baz
2021-03-15Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]`Camelid-1/+1
"spotlight" is not a very specific or self-explaining name. Additionally, the dialog that it triggers is called "Notable traits". So, "notable trait" is a better name. * Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]` * Rename `#![feature(doc_spotlight)]` to `#![feature(doc_notable_trait)]` * Update documentation * Improve documentation
2021-03-09Remove `masked_crates` from `clean::Crate`Camelid-2/+5
Previously, `masked_crates` existed both on `Cache` and on `clean::Crate`. During cache population, the `clean::Crate` version was `take`n and moved to `Cache`. This change removes the version on `clean::Crate` and instead directly mutates `Cache.masked_crates` to initialize it. This has the advantage of avoiding duplication and avoiding unnecessary allocation, as well as making the flow of information through rustdoc less confusing. The one downside I see is that `clean::utils::krate()` now uses the side effect of mutating `DocContext.cache` instead of returning the data directly, but it already mutated the `Cache` for other things (e.g., `deref_trait_did`) so it's not really new behavior. Also, `clean::utils::krate()` is only called once (and is meant to only be called once since it performs expensive and potentially destructive operations) so the mutation shouldn't be an issue.
2021-03-09Auto merge of #82356 - camelid:render-cleanup, r=GuillaumeGomezbors-3/+6
rustdoc: Cleanup `html::render::Context` - Move most shared fields to `SharedContext` (except for `cache`, which isn't mutated anyway) - Replace a use of `Arc` with `Rc` - Make a bunch of fields private - Add static size assertion for `Context` - Don't share `id_map` and `deref_id_map`
2021-03-05Don't unnecessarily clone some fields in `Context`Camelid-3/+6
There was no need to clone `id_map` because it was reset before each item was rendered. `deref_id_map` was not reset, but it was keyed by `DefId` and thus was unlikely to have collisions (at least for now). Now we just clone the fields that need to be cloned, and instead create fresh versions of the others.
2021-03-05Make ItemKind::ExternCrate looks like hir::ItemKind::ExternCrate to make ↵Guillaume Gomez-2/+4
transition over hir::ItemKind simpler
2021-03-01Remove `krate.version`; fix `crate_version` in JSONJoshua Nelson-1/+0
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-01Remove unused `RenderInfo` structJoshua Nelson-27/+3
2021-03-01Remove the dummy cache in `DocContext`Joshua Nelson-41/+31
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-02-23* Fix some typoGuillaume Gomez-5/+1
* Improve documentation * Add a test to ensure that spotlighted traits from dependencies are taken into account as expected
2021-02-23Put clean::Trait extra information into a new struct to make it more coherentGuillaume Gomez-5/+7
2021-02-23Remove is_spotlight field from `Trait`Guillaume Gomez-2/+8
2021-02-05Remove Function all_types and ret_types fieldsGuillaume Gomez-46/+60
2021-02-02Auto merge of #81557 - GuillaumeGomez:primitive-search, r=ollie27bors-0/+1
Fix primitive search in parameters and returned values Part of #60485. Fixes #74780. Replacing #74879. cc `@camelid` `@jyn514` `@CraftSpider` r? `@ollie27`
2021-02-01Put back primitives in searchGuillaume Gomez-0/+1
2021-01-30rustdoc tweakingbors-1/+1
* 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-27Update to new rustdoc APIsGuillaume Gomez-5/+2
2021-01-27Remove cache usage wherever possibleGuillaume Gomez-71/+54
2021-01-27Use empty Cache for methods requiring it when filling Cache itselfGuillaume Gomez-48/+70
2021-01-27Remove CACHE_KEY globalGuillaume Gomez-40/+25