summary refs log tree commit diff
path: root/src/librustdoc/clean
AgeCommit message (Collapse)AuthorLines
2021-05-05Revert PR 83866Pietro Albini-15/+3
That PR caused multiple test failures when Rust's channel is changed from nightly to anything else. The commit will have to be landed again after the test suite is fixed.
2021-04-27Auto merge of #84494 - tdelabro:84304-bis, r=jyn514bors-86/+116
84304 - rustdoc: shrink Item::Attributes Helps with https://github.com/rust-lang/rust/issues/84304
2021-04-27cfg taken out of Attributes, put in ItemTimothée Delabrouille-57/+87
check item.is_fake() instead of self_id.is_some() Remove empty branching in Attributes::from_ast diverse small refacto after Josha review cfg computation moved in merge_attrs refacto use from_ast twice for coherence take cfg out of Attributes and move it to Item
2021-04-27Removed usage of Attributes in FnDecl and ExternalCrate. Relocate part of ↵Timothée Delabrouille-30/+30
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-25get rid of min_const_fn references in library/ and rustdocRalf Jung-4/+3
2021-04-24Finally (finally) ((finally!!!!)) fix spans for the standard libraryJoshua Nelson-1/+5
2021-04-24Get rid of `item.span`Joshua Nelson-23/+30
- Remove `span` field, adding `Item::span()` instead - Special-case `Impl` and `Module` items - Use dummy spans for primitive items
2021-04-24Do the hard part firstJoshua Nelson-8/+17
The only bit failing was the module, so change that before removing the `span` field.
2021-04-24Add attr_span helper functionJoshua Nelson-0/+4
2021-04-25Rollup merge of #84464 - jyn514:type-kind, r=CraftSpiderYuki Okushi-105/+44
rustdoc: Get rid of `clean::TypeKind` It does exactly the same thing as ItemType.
2021-04-23Remove unused `impl Clean<ItemType> for DefKind`Joshua Nelson-6/+0
2021-04-23Remove `TypeKind`Joshua Nelson-53/+0
2021-04-23Use ItemType in cacheJoshua Nelson-1/+0
2021-04-23Take ItemType instead of TypeKind in record_extern_fqnJoshua Nelson-47/+46
2021-04-23rustdoc: Remove unnecessary `is_crate` field from doctree::Module and ↵Joshua Nelson-14/+6
clean::Module It can be calculated on-demand even without a TyCtxt. This also changed `from_item_kind` to take a whole item, which avoids having to add more and more parameters.
2021-04-23Auto merge of #84457 - jyn514:cleanup-crate, r=GuillaumeGomezbors-126/+142
rustdoc: Remove most fields from ExternalCrate Once https://github.com/rust-lang/rust/issues/84304 is fixed, I can get rid of ExternCrate altogether in favor of CrateNum, but in the meantime, this shrinks ExternalCrate quite a lot. This might hurt compile-times; if it does, I can add `primitive` and `keyword` queries. I expect this to improve compilemem. Helps with https://github.com/rust-lang/rust/issues/76382. r? GuillaumeGomez
2021-04-22Remove `keywords` from ExternCrateJoshua Nelson-52/+57
2021-04-22Get rid of ExternCrate::primitivesJoshua Nelson-76/+76
2021-04-22Remove `name` field from ExternalCrateJoshua Nelson-3/+6
2021-04-22Remove src field from ExternCrateJoshua Nelson-5/+13
2021-04-21Use arrayvec 0.7, drop smallvec 0.6Jubilee Young-4/+4
With the arrival of min const generics, many alt-vec libraries have updated to use it in some way and arrayvec is no exception. Use the latest with minor refactoring. Also, rustc_workspace_hack is the only user of smallvec 0.6 in the entire tree, so drop it.
2021-04-17Remove assert that no longer mattersMichael Howell-7/+0
The function `to_src_with_space` doesn't even accept the cache as a parameter, so it doesn't matter any more what's in it.
2021-04-17rustdoc: use more precise relative URLSMichael Howell-12/+28
Instead of using a depth counter and adding "../" to get to the top, this commit makes rustdoc actually compare the path of what it's linking from to the path that it's linking to. This makes the resulting HTML shorter. Here's a comparison of one of the largest (non-source) files in the Rust standard library docs (about 4% improvement before gzipping). $ wc -c struct.Wrapping.old.html struct.Wrapping.new.html 2387389 struct.Wrapping.old.html 2298538 struct.Wrapping.new.html Most if it can be efficiently gzipped away. $ wc -c struct.Wrapping.old.html.gz struct.Wrapping.new.html.gz 70679 struct.Wrapping.old.html.gz 70050 struct.Wrapping.new.html.gz But it also makes a difference in the final DOM size, reducing it from 91MiB to 82MiB.
2021-04-17Auto merge of #84246 - notriddle:rustdoc-path-printing-cleanup, r=jyn514bors-1/+1
rustdoc: get rid of unused path printing code The code for printing a raw path is only used in utils.rs, which only prints the alternative (non-HTML) format. Path has a function that does the same thing without HTML support, so use that instead.
2021-04-16rustdoc: get rid of unused path printing codeMichael Howell-1/+1
The code for printing a raw path is only used in utils.rs, which only prints the alternative (non-HTML) format. Path has a function that does the same thing without HTML support, so use that instead.
2021-04-10rustdoc: clean up and test macro visibility printMichael Howell-2/+2
This fixes the overly-complex invariant mentioned in <https://github.com/rust-lang/rust/pull/83237#issuecomment-815346570>, where the macro source can't have any links in it only because the cache hasn't been populated yet.
2021-04-08Auto merge of #83981 - nagisa:nagisa/revert-cfg-wasm, r=Mark-Simulacrumbors-1/+0
Remove the insta-stable `cfg(wasm)` The addition of `cfg(wasm)` was an oversight on my end that turns out to have a number of downsides: * It was introduced as an insta-stable addition, forgoing the usual staging mechanism we use for potentially far-reaching changes; * It is a breaking change for people who are using `--cfg wasm` either directly or via cargo for other purposes; * It is not entirely clear if a bare `wasm` cfg is a right option or whether `wasm` family of targets are special enough to warrant special-casing these targets specifically. As for the last point, there appears to be a fair amount of support for reducing the boilerplate in specifying architectures from the same family, while ignoring their pointer width. The suggested way forward would be to propose such a change as a separate RFC as it is potentially a quite contentious addition. cc #83879 `@devsnek`
2021-04-07Remove the insta-stable `cfg(wasm)`Simonas Kazlauskas-1/+0
The addition of `cfg(wasm)` was an oversight on my end that has a number of downsides: * It was introduced as an insta-stable addition, forgoing the usual staging mechanism we use for potentially far-reaching changes; * It is a breaking change for people who are using `--cfg wasm` either directly or via cargo for other purposes; * It is not entirely clear if a bare `wasm` cfg is a right option or whether `wasm` family of targets are special enough to warrant special-casing these targets specifically. As for the last point, there appears to be a fair amount of support for reducing the boilerplate in specifying architectures from the same family, while ignoring their pointer width. The suggested way forward would be to propose such a change as a separate RFC as it is potentially a quite contentious addition.
2021-04-07Reuse logic for determining the channel in the rest of rustdocJoshua Nelson-9/+14
This doesn't update main.js because it's included as a fixed string.
2021-04-07Auto merge of #83833 - jyn514:no-resolver, r=GuillaumeGomezbors-73/+64
rustdoc: Store intra-doc links in Cache instead of on items directly 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. Helps with https://github.com/rust-lang/rust/issues/83761. Opening this early because I think it might decrease memory usage.
2021-04-06Store links in Cache instead of on items directlyJoshua Nelson-73/+64
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-06rustdoc: Use `ThinVec` in a few placesCamelid-3/+5
Almost every crate has no primitives and no keywords defined in it, so using `ThinVec` should make some types smaller.
2021-04-06Rollup merge of #83835 - notriddle:sort-index, r=ollie27Yuki Okushi-2/+2
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-05Rollup merge of #83863 - eggyal:issue-83852, r=jyn514Dylan DPC-11/+1
Render destructured struct function param names as underscore Fixes #83852 r? ````@GuillaumeGomez````
2021-04-05Rollup merge of #80525 - devsnek:wasm64, r=nagisaDylan DPC-1/+2
wasm64 support There is still some upstream llvm work needed before this can land.
2021-04-04Render destructured struct function param names as underscore.Alan Egerton-11/+1
Fixes #83852 r? `@GuillaumeGomez`
2021-04-04wasm64Gus Caplan-1/+2
2021-04-03rustdoc: sort search index items for compressionMichael Howell-2/+2
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-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-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-31Add var to BoundRegion. Add query to get bound vars for applicable items.Jack Huey-2/+2
2021-03-31Make late and late_anon regions track the bound var positionJack Huey-1/+1
2021-03-31Revert explicit lifetimesJack Huey-166/+158
2021-03-31Track bound varsJack Huey-158/+166
2021-03-31Auto merge of #83684 - cjgillot:csp, r=petrochenkovbors-2/+0
Remove hir::CrateItem. The crate span is exactly the crate module's inner span. There is no need to store it twice.
2021-03-30Remove hir::CrateItem.Camille GILLOT-2/+0
2021-03-30Only look at blanket impls in `get_blanket_impls`Joshua Nelson-3/+5
2021-03-29Auto merge of #82864 - jyn514:short-circuit, r=GuillaumeGomezbors-6/+2
rustdoc: Don't enter an infer_ctxt in get_blanket_impls for impls that aren't blanket impls Less broken version of https://github.com/rust-lang/rust/pull/82856. get_blanket_impls is a *very* hot region of rustdoc, so even small changes like this should help. Unfortunately I don't have benchmarks for this until https://github.com/rust-lang/rustc-perf/pull/802 is merged.
2021-03-24Split clean::Constant enum into a struct and an enumGuillaume Gomez-44/+44
2021-03-24Rename clean::Constant did fields to def_idGuillaume Gomez-18/+18