1. 01 11月, 2021 4 次提交
    • 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
      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. 21 9月, 2021 1 次提交
  3. 29 8月, 2021 1 次提交
  4. 18 8月, 2021 1 次提交
  5. 05 5月, 2021 1 次提交
  6. 25 4月, 2021 1 次提交
  7. 24 4月, 2021 1 次提交
  8. 24 3月, 2021 1 次提交
    • C
      Remove unnecessary `Option` wrapping around `Crate.module` · 68244fc5
      Camelid 提交于
      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.
      68244fc5
  9. 24 2月, 2021 2 次提交
  10. 16 1月, 2021 2 次提交
  11. 02 1月, 2021 1 次提交
    • M
      clippy fixes for librustdoc · a5807ac6
      Matthias Krüger 提交于
      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
      a5807ac6
  12. 30 12月, 2020 1 次提交
    • M
      remove unused return types such as empty Results or Options that would always be Some(..) · e5ead5fc
      Matthias Krüger 提交于
      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()
      e5ead5fc
  13. 24 12月, 2020 1 次提交
    • J
      Box ItemKind to reduce the size of `Item` · 4a442637
      Joshua Nelson 提交于
      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
      ```
      4a442637
  14. 23 11月, 2020 1 次提交
    • J
      Make `fold_item_recur` non-nullable · ab1e6342
      Joshua Nelson 提交于
      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.
      ab1e6342
  15. 16 11月, 2020 1 次提交
  16. 14 11月, 2020 1 次提交
  17. 30 8月, 2020 1 次提交
    • J
      rustdoc: Fix intra-doc links for cross-crate re-exports of traits · 868927fe
      Joshua Nelson 提交于
       #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.
      868927fe
  18. 23 12月, 2019 1 次提交
  19. 11 8月, 2019 1 次提交
    • M
      Remove ReentrantMutex · c5748100
      Mark Rousskov 提交于
      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).
      c5748100
  20. 23 2月, 2019 1 次提交
  21. 26 12月, 2018 1 次提交
  22. 20 9月, 2018 1 次提交
    • Q
      shuffle ownership of `external_traits` · 354507e6
      QuietMisdreavus 提交于
      constraints:
      
      - clean/inline.rs needs this map to fill in traits when inlining
      - fold.rs needs this map to allow passes to fold trait items
      - html/render.rs needs this map to seed the Cache.traits map of all
        known traits
      
      The first two are the real problem, since `DocFolder` only operates on
      `clean::Crate` but `clean/inline.rs` only sees the `DocContext`. The
      introduction of early passes means that these two now exist at the same
      time, so they need to share ownership of the map. Even better, the use
      of `Crate` in a rustc thread pool means that it needs to be Sync, so it
      can't use `Lrc<Lock>` to manually activate thread-safety.
      
      `parking_lot` is reused from elsewhere in the tree to allow use of its
      `ReentrantMutex`, as the relevant parts of rustdoc are still
      single-threaded and this allows for easier use in that context.
      354507e6
  23. 31 7月, 2018 1 次提交
  24. 11 7月, 2018 1 次提交
    • A
      Upgrade to LLVM's master branch (LLVM 7) · 42eb8500
      Alex Crichton 提交于
      This commit upgrades the main LLVM submodule to LLVM's current master branch.
      The LLD submodule is updated in tandem as well as compiler-builtins.
      
      Along the way support was also added for LLVM 7's new features. This primarily
      includes the support for custom section concatenation natively in LLD so we now
      add wasm custom sections in LLVM IR rather than having custom support in rustc
      itself for doing so.
      
      Some other miscellaneous changes are:
      
      * We now pass `--gc-sections` to `wasm-ld`
      * The optimization level is now passed to `wasm-ld`
      * A `--stack-first` option is passed to LLD to have stack overflow always cause
        a trap instead of corrupting static data
      * The wasm target for LLVM switched to `wasm32-unknown-unknown`.
      * The syntax for aligned pointers has changed in LLVM IR and tests are updated
        to reflect this.
      * The `thumbv6m-none-eabi` target is disabled due to an [LLVM bug][llbug]
      
      Nowadays we've been mostly only upgrading whenever there's a major release of
      LLVM but enough changes have been happening on the wasm target that there's been
      growing motivation for quite some time now to upgrade out version of LLD. To
      upgrade LLD, however, we need to upgrade LLVM to avoid needing to build yet
      another version of LLVM on the builders.
      
      The revision of LLVM in use here is arbitrarily chosen. We will likely need to
      continue to update it over time if and when we discover bugs. Once LLVM 7 is
      fully released we can switch to that channel as well.
      
      [llbug]: https://bugs.llvm.org/show_bug.cgi?id=37382
      42eb8500
  25. 06 7月, 2018 1 次提交
  26. 28 6月, 2018 1 次提交
  27. 16 8月, 2017 1 次提交
  28. 03 10月, 2016 1 次提交
  29. 03 9月, 2016 1 次提交
  30. 02 4月, 2016 1 次提交
    • M
      Make the rendering process less pass-aware · b1543a1a
      mitaa 提交于
      Instead of hardcoding knowledge about the strip-private pass into the
      rendering process we represent (some) stripped items as `ItemEnum::StrippedItem`.
      
      Rustdoc will, for example, generate redirect pages for public items
      contained in private modules which have been re-exported to somewhere
      externally reachable - this will now not only work for the `strip-private`
      pass, but for other passes as well, such as the `strip-hidden` pass.
      b1543a1a
  31. 05 3月, 2016 2 次提交
  32. 13 12月, 2015 1 次提交
  33. 08 4月, 2015 1 次提交
  34. 12 3月, 2015 1 次提交