1. 19 11月, 2020 1 次提交
  2. 18 11月, 2020 2 次提交
    • J
      Add `from_def_id_and_kind` reducing duplication in rustdoc · fc4ca552
      Joshua Nelson 提交于
      - Add `Item::from_hir_id_and_kind` convenience wrapper
      - Make name parameter mandatory
      
        `tcx.opt_item_name` doesn't handle renames, so this is necessary
        for any item that could be renamed, which is almost all of them.
      
      - Override visibilities to be `Inherited` for enum variants
      
        `tcx.visibility` returns the effective visibility, not the visibility
        that was written in the source code. `pub enum E { A, B }` always has
        public variants `A` and `B`, so there's no sense printing `pub` again.
      
      - Don't duplicate handling of `Visibility::Crate`
      
        Instead, represent it as just another `Restricted` path.
      fc4ca552
    • J
      Use DefPath for clean::Visibility, not clean::Path · 6c28ffbe
      Joshua Nelson 提交于
      Visibility needs much less information than a full path, since modules
      can never have generics. This allows constructing a Visibility from only
      a DefId.
      
      Note that this means that paths are now normalized to their DefPath.
      In other words, `pub(self)` or `pub(super)` now always shows `pub(in
      path)` instead of preserving the original text.
      6c28ffbe
  3. 15 11月, 2020 1 次提交
  4. 13 11月, 2020 3 次提交
    • A
      Fix wrong XPath · 309d863e
      Alexis Bourget 提交于
      309d863e
    • J
      Handle and test wildcard arguments · 38127caf
      Joshua Nelson 提交于
      38127caf
    • J
      Don't reuse bindings for `ref mut` · 2baa0cef
      Joshua Nelson 提交于
      Reusing bindings causes errors later in lowering:
      
      ```
       error[E0596]: cannot borrow `vec` as mutable, as it is not declared as mutable
        --> /checkout/src/test/ui/async-await/argument-patterns.rs:12:20
         |
      LL | async fn b(n: u32, ref mut vec: A) {
         |                    ^^^^^^^^^^^
         |                    |
         |                    cannot borrow as mutable
         |                    help: consider changing this to be mutable: `mut vec`
      ```
      2baa0cef
  5. 12 11月, 2020 5 次提交
  6. 10 11月, 2020 1 次提交
  7. 03 11月, 2020 1 次提交
  8. 29 10月, 2020 1 次提交
  9. 27 10月, 2020 1 次提交
  10. 26 10月, 2020 1 次提交
  11. 14 10月, 2020 2 次提交
  12. 12 10月, 2020 2 次提交
  13. 10 10月, 2020 4 次提交
  14. 09 10月, 2020 1 次提交
    • C
      Allow generic parameters in intra-doc links · 4c765f66
      Camelid 提交于
      The contents of the generics will be mostly ignored (except for warning
      if fully-qualified syntax is used, which is currently unsupported in
      intra-doc links - see issue #74563).
      
      * Allow links like `Vec<T>`, `Result<T, E>`, and `Option<Box<T>>`
      * Allow links like `Vec::<T>::new()`
      * Warn on
        * Unbalanced angle brackets (e.g. `Vec<T` or `Vec<T>>`)
        * Missing type to apply generics to (`<T>` or `<Box<T>>`)
        * Use of fully-qualified syntax (`<Vec as IntoIterator>::into_iter`)
        * Invalid path separator (`Vec:<T>:new`)
        * Too many angle brackets (`Vec<<T>>`)
        * Empty angle brackets (`Vec<>`)
      
      Note that this implementation *does* allow some constructs that aren't
      valid in the actual Rust syntax, for example `Box::<T>new()`. That may
      not be supported in rustdoc in the future; it is an implementation
      detail.
      4c765f66
  15. 08 10月, 2020 2 次提交
    • J
      Use the new module information for intra-doc links · e39a8601
      Joshua Nelson 提交于
      - Make the parent module conditional on whether the docs are on a re-export
      - Make `resolve_link` take `&Item` instead of `&mut Item`
      
        Previously the borrow checker gave an error about multiple mutable
        borrows, because `dox` borrowed from `item`.
      
      - Fix `crate::` for re-exports
      
        `crate` means something different depending on where the attribute
        came from.
      
      - Make it work for `#[doc]` attributes too
      
        This required combining several attributes as one so they would keep
        the links.
      e39a8601
    • W
      Simplify doc-cfg rendering based on the current context · 6f0544ab
      Wim Looman 提交于
      For sub-items on a page don't show cfg that has already been rendered on
      a parent item. At its simplest this means not showing anything that is
      shown in the portability message at the top of the page, but also for
      things like fields of an enum variant if that variant itself is
      cfg-gated then don't repeat those cfg on each field of the variant.
      
      This does not touch trait implementation rendering, as that is more
      complex and there are existing issues around how it deals with doc-cfg
      that need to be fixed first.
      6f0544ab
  16. 27 9月, 2020 2 次提交
  17. 24 9月, 2020 3 次提交
    • J
      Unify primitive errors with other intra-link errors · 049d29ba
      Joshua Nelson 提交于
      Now that `PrimTy::name()` exists, there's no need to carry around the
      name of the primitive that failed to resolve. This removes the variants
      special-casing primitives in favor of `NotResolved`.
      
      - Remove `NoPrimitiveImpl` and `NoPrimitiveAssocItem`
      - Remove hacky `has_primitive` check in `resolution_failure()`
      - Fixup a couple tests that I forgot to `--bless` before
      049d29ba
    • J
      Fix intra-doc links for primitives · 472e52e5
      Joshua Nelson 提交于
      - Add `PrimTy::name` and `PrimTy::name_str`
      - Use those new functions to distinguish between the name in scope and
      the canonical name
      - Fix diagnostics for primitive types
      - Add tests for primitives
      472e52e5
    • J
      Perform most diagnostic lookups in `resolution_failure` · dd7b8c85
      Joshua Nelson 提交于
      Previously, these were spread throughout the codebase. This had two
      drawbacks:
      
      1. It caused the fast path to be slower: even if a link resolved,
      rustdoc would still perform various lookups for the error diagnostic.
      2. It was inconsistent and didn't always give all diagnostics (https://github.com/rust-lang/rust/issues/76925)
      
      Now, diagnostics only perform expensive lookups in the error case.
      Additionally, the error handling is much more consistent, both in
      wording and behavior.
      
      - Remove `CannotHaveAssociatedItems`, `NotInScope`, `NoAssocItem`, and `NotAVariant`
        in favor of the more general `NotResolved`
      
        `resolution_failure` will now look up which of the four above
        categories is relevant, instead of requiring the rest of the code to
        be consistent and accurate in which it picked.
      
      - Remove unnecessary lookups throughout the intra-doc link pass. These
      are now done by `resolution_failure`.
        + Remove unnecessary `extra_fragment` argument to `variant_field()`;
          it was only used to do lookups on failure.
        + Remove various lookups related to associated items
        + Remove distinction between 'not in scope' and 'no associated item'
      
      - Don't perform unnecessary copies
      - Remove unused variables and code
      - Update tests
      - Note why looking at other namespaces is still necessary
      - 'has no inner item' -> 'contains no item'
      
      bless tests
      dd7b8c85
  18. 13 9月, 2020 1 次提交
  19. 12 9月, 2020 2 次提交
  20. 04 9月, 2020 2 次提交
  21. 03 9月, 2020 1 次提交
  22. 02 9月, 2020 1 次提交
    • C
      Use "Fira Sans" for crate list font · c86d249e
      Camelid 提交于
      Fira Sans is what's used for module lists and other item lists.
      Previously, the default body font, "Source Serif Pro", was used for
      crate lists, which didn't visually match other item lists.
      c86d249e