about summary refs log tree commit diff
path: root/src/librustdoc/visit.rs
AgeCommit message (Collapse)AuthorLines
2023-08-21rustdoc: Rename `clean` items from typedef to type aliasNoah Lev-1/+1
2023-01-01clean: Always store enum disriminant.Nixon Enraght-Moony-4/+4
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-21Remove unused field in ItemKind::KeywordItemGuillaume Gomez-1/+1
2022-05-24fix simple clippy lintsklensy-1/+0
2022-05-21Remove `crate` visibility modifier in libs, testsJacob Pratt-1/+1
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-01List all cases explicitly in `Doc{Folder,Visitor}`Noah Lev-2/+20
2021-10-31Fix `RefCell` `BorrowMut` error in `DocVisitor`Noah Lev-3/+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-0/+51
`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.