about summary refs log tree commit diff
path: root/src/librustdoc/fold.rs
AgeCommit message (Collapse)AuthorLines
2025-08-28Add new `doc(attribute = "...")` attributeGuillaume Gomez-1/+2
2024-12-19Rename TyMethodItem -> RequiredMethodItemDavid Tolnay-1/+1
2024-12-19Rename TyAssocTypeItem -> RequiredAssocTypeItemDavid Tolnay-1/+1
2024-12-19Split AssocConstItem into ProvidedAssocConstItem and ImplAssocConstItemDavid Tolnay-1/+2
2024-12-19Rename TyAssocConstItem -> RequiredAssocConstItemDavid Tolnay-1/+1
2024-09-25de-rc external traitsLukas Markeffsky-4/+7
Don't keep the `external_traits` as shared mutable data between the `DocContext` and `clean::Crate`. Instead, move the data over when necessary. This allows us to get rid of a borrowck hack in the `DocVisitor`.
2024-09-07rustdoc: use a single box to store Attributes and ItemKindMichael Howell-5/+5
2024-08-01rustdoc: Remove OpaqueTyAlona Enraght-Moony-1/+0
2024-07-27rustdoc: use strategic ThinVec/Box to shrink `clean::ItemKind`Michael Howell-1/+1
2024-06-20Implement `unsafe_extern_blocks` feature in rustdocGuillaume Gomez-2/+2
2024-06-05Remove `Type` from rustdoc `Const`Boxy-1/+1
2023-08-26rustdoc: bind typedef inner type items to the folding systemUrgau-1/+22
This let's us handle a multitude of things for free: - #[doc(hidden)] - private fields/variants - --document-private-items - --document-hidden-items And correct in the process the determination of "has stripped items" by doing the same logic done by other ones.
2023-08-21rustdoc: Rename `clean` items from typedef to type aliasNoah Lev-1/+1
2023-01-01clean: Always store enum disriminant.Nixon Enraght-Moony-11/+15
2022-09-27rustdoc: remove `clean::TraitWithExtraInfo`Michael Howell-1/+1
Instead, it gathers the extra info later, when it's actually requested.
2022-09-03Rustdoc-Json: Add enum discriminantNixon Enraght-Moony-1/+1
2022-07-29Remove box syntax from Box<rustdoc::clean::types::ItemKind> constructionest31-4/+4
The type has 240 bytes according to compiler internal rustdoc.
2022-07-21Remove unused field in ItemKind::KeywordItemGuillaume Gomez-1/+1
2022-05-21Remove fields_stripped fields (and equivalents)Guillaume Gomez-20/+0
2022-05-21Remove `crate` visibility modifier in libs, testsJacob Pratt-2/+2
2022-04-12rustdoc: discr. required+provided assoc consts+tysLeón Orell Valerian Liehr-2/+4
2022-02-27make GATs print properly in traitsMichael Goulet-1/+1
2021-11-04rustdoc: Use conditional for _stripped foldMichael Howell-8/+16
Followup: https://github.com/rust-lang/rust/pull/90475#discussion_r741405472
2021-11-01List all cases explicitly in `Doc{Folder,Visitor}`Noah Lev-2/+20
2021-10-31Fix `RefCell` `BorrowMut` error in `DocVisitor`Noah Lev-7/+5
Until `external_traits` is cleaned up (i.e., no longer behind a `RefCell`), `DocVisitor` will have to `take` `external_traits` -- just like `DocFolder` -- to prevent `RefCell` runtime errors.
2021-10-31rustdoc: Add `DocVisitor`Noah Lev-15/+14
`DocFolder` allows transforming the docs, accomplished by making its methods take and return types by-value. However, several of the rustdoc `DocFolder` impls only *visit* the docs; they don't change anything. Passing around types by-value is thus unnecessary, confusing, and potentially inefficient for those impls. `DocVisitor` is very similar to `DocFolder`, except that its methods take shared references and return nothing (i.e., the unit type). This should both be more efficient and make the code clearer. There is an additional reason to add `DocVisitor`, too. As part of my cleanup of `external_traits`, I'm planning to add a `fn cache(&mut self) -> &mut Cache` method to `DocFolder` so that `external_traits` can be retrieved explicitly from the `Cache`, rather than implicitly via `Crate.external_traits` (which is an `Rc<RefCell<...>>`). However, some of the `DocFolder` impls that could be turned into `DocVisitor` impls only have a shared reference to the `Cache`, because they are used during rendering. (They have to access the `Cache` via `html::render::Context.shared.cache`, which involves an `Rc`.) Since `DocVisitor` does not mutate any of the types it's visiting, its equivalent `cache()` method will only need a shared reference to the `Cache`, avoiding the problem described above.
2021-10-31rustdoc: Replace wildcard with explicit patternNoah Lev-1/+1
This simplifies the code and future-proofs it against changes to `Variant`.
2021-10-31rustdoc: Remove unnecessary clone in `DocFolder`Noah Lev-2/+1
Also, contrary to the comment, the clone is not that small, since `Variant` contains `Item`s, which are quite large when you factor in both stack- and heap-allocated memory.
2021-09-21Revert the rustdoc box syntax removalest31-4/+4
It turned out to cause (minor) perf regressions.
2021-08-29Use the correct type for Enum variant tuplesGuillaume Gomez-0/+4
2021-08-18remove box_syntax uses from cranelift and toolsMarcel Hellwig-4/+4
2021-05-04rustdoc: Remove unnecessary `StripItem` wrapperJoshua Nelson-11/+4
2021-04-24Do the hard part firstJoshua Nelson-1/+4
The only bit failing was the module, so change that before removing the `span` field.
2021-04-23rustdoc: Remove unnecessary `is_crate` field from doctree::Module and ↵Joshua Nelson-4/+1
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-03-23Remove unnecessary `Option` wrapping around `Crate.module`Camelid-1/+1
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-02-23Put clean::Trait extra information into a new struct to make it more coherentGuillaume Gomez-3/+4
2021-02-23Remove is_spotlight field from `Trait`Guillaume Gomez-2/+2
2021-01-15Rename VariantKind -> VariantJoshua Nelson-2/+2
There's no `Variant`, so it seems silly to have `Kind`.
2021-01-15Remove useless `clean::Variant` structJoshua Nelson-2/+2
It had exactly one field and no special behavior, so there was no point.
2021-01-01clippy fixes for librustdocMatthias Krüger-1/+1
fixes clippy warnings of type: match_like_matches_macro or_fun_call op_ref needless_return let_and_return single_char_add_str useless_format unnecessary_sort_by match_ref_pats redundant_field_names
2020-12-30remove unused return types such as empty Results or Options that would ↵Matthias Krüger-3/+3
always be Some(..) remove unused return type of dropck::check_drop_obligations() don't wrap return type in Option in get_macro_by_def_id() since we would always return Some(..) remove redundant return type of back::write::optimize() don't Option-wrap return type of compute_type_parameters() since we always return Some(..) don't return empty Result in assemble_generator_candidates() don't return empty Result in assemble_closure_candidates() don't return empty result in assemble_fn_pointer_candidates() don't return empty result in assemble_candidates_from_impls() don't return empty result in assemble_candidates_from_auto_impls() don't return emtpy result in assemble_candidates_for_trait_alias() don't return empty result in assemble_builtin_bound_candidates() don't return empty results in assemble_extension_candidates_for_traits_in_scope() and assemble_extension_candidates_for_trait() remove redundant wrapping of return type of StripItem::strip() since it always returns Some(..) remove unused return type of assemble_extension_candidates_for_all_traits()
2020-12-23Box ItemKind to reduce the size of `Item`Joshua Nelson-4/+4
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-11-22Make `fold_item_recur` non-nullableJoshua Nelson-8/+5
This gets rid of a bunch of `unwrap()`s and makes it a little more clear what's going on. Originally I wanted to make `fold_item` non-nullable too, which would have been a lot nicer to work with, but unfortunately `stripper` does actually return `None` in some places. I might make a follow-up moving stripper to be special and not a pass so that passes can be non-nullable.
2020-11-15Make all rustdoc functions and structs crate-privateJoshua Nelson-3/+3
This gives warnings about dead code.
2020-11-14Rename ItemEnum -> ItemKind, inner -> kindJoshua Nelson-8/+8
2020-08-29rustdoc: Fix intra-doc links for cross-crate re-exports of traitsJoshua Nelson-9/+5
#58972 ignored extern_traits because before #65983 was fixed, they would always fail to resolve, giving spurious warnings. This undoes that change, so extern traits are now seen by the `collect_intra_doc_links` pass. There are also some minor changes in librustdoc/fold.rs to avoid borrowing the extern_traits RefCell more than once at a time.
2019-12-22Format the worldMark Rousskov-39/+30
2019-08-11Remove ReentrantMutexMark Rousskov-4/+4
This drops the parking_lot dependency; the ReentrantMutex type appeared to be unused (at least, no compilation failures occurred). This is technically a possible change in behavior of its users, as lock() would wait on other threads releasing their guards, but since we didn't actually remove any threading or such in this code, it appears that we never used that behavior (the behavior change is only noticeable if the type previously was used in two threads, in a single thread ReentrantMutex is useless).
2019-02-23Transition librustdoc to 2018 editionHirokazu Hata-1/+1
2018-12-25Remove licensesMark Rousskov-10/+0