1. 01 11月, 2021 10 次提交
    • N
      Fix `RefCell` `BorrowMut` error in `DocVisitor` · c03cab3f
      Noah Lev 提交于
      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.
      c03cab3f
    • N
      Convert more impls of `DocFolder` to `DocVisitor` · 3f0f5101
      Noah Lev 提交于
      I think these are the last of the impls that can be easily converted to visitors.
      3f0f5101
    • N
      Convert many impls of `DocFolder` to `DocVisitor` · b7428707
      Noah Lev 提交于
      Many of `DocFolder`'s impls didn't actually transform the syntax tree,
      so they can be visitors instead.
      b7428707
    • N
      rustdoc: Small micro-optimizations and cleanups · 10606c3c
      Noah Lev 提交于
      * Flip conjuncts of `&&` in rustdoc
      
        The `CrateNum` comparison should be very cheap, while
        `span.filename()` fetches and clones a `FileName`.
      
      * Use `into_local_path()` instead of `local_path().clone()`
      10606c3c
    • N
      Fix FIXMEs in `rustdoc::html::sources` · 4ee2d035
      Noah Lev 提交于
      One of the FIXMEs is irrelevant since that code is only run if
      `include_sources` is set. I fixed the other FIXME.
      4ee2d035
    • N
      Clean up now that visitors only need `&clean::Crate` · 6215f7c8
      Noah Lev 提交于
      6215f7c8
    • N
      rustdoc: Use `DocVisitor` for sources collection · 28bdf892
      Noah Lev 提交于
      28bdf892
    • N
      rustdoc: Add `DocVisitor` · 5a9bbba2
      Noah Lev 提交于
      `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.
      5a9bbba2
    • N
      rustdoc: Replace wildcard with explicit pattern · 705dec11
      Noah Lev 提交于
      This simplifies the code and future-proofs it against changes to
      `Variant`.
      705dec11
    • N
      rustdoc: Remove unnecessary clone in `DocFolder` · 537b82cf
      Noah Lev 提交于
      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.
      537b82cf
  2. 31 10月, 2021 5 次提交
  3. 30 10月, 2021 3 次提交
  4. 29 10月, 2021 7 次提交
  5. 28 10月, 2021 1 次提交
    • N
      Improve perf measurements of `build_extern_trait_impl` · eb713d27
      Noah Lev 提交于
      Before, it was only measuring one callsite of `build_impl`, and it
      incremented the call count even if `build_impl` returned early because
      the `did` was already inlined.
      
      Now, it measures all calls, minus calls that return early.
      eb713d27
  6. 26 10月, 2021 4 次提交
  7. 25 10月, 2021 2 次提交
  8. 24 10月, 2021 1 次提交
  9. 23 10月, 2021 7 次提交