summary refs log tree commit diff
path: root/src/librustdoc/clean/inline.rs
AgeCommit message (Collapse)AuthorLines
2022-03-29Remember mutability in `DefKind::Static`.Camille GILLOT-1/+1
This allows to compute the `BodyOwnerKind` from `DefKind` only, and removes a direct dependency of some MIR queries onto HIR. As a side effect, it also simplifies metadata, since we don't need 4 flavours of `EntryKind::*Static` any more.
2022-03-29Remove header field from clean::FunctionGuillaume Gomez-8/+1
2022-03-12Remove needless use of `Into`Noah Lev-2/+2
2022-03-11Improve `AdtDef` interning.Nicholas Nethercote-1/+1
This commit makes `AdtDef` use `Interned`. Much the commit is tedious changes to introduce getter functions. The interesting changes are in `compiler/rustc_middle/src/ty/adt.rs`.
2022-03-04Auto merge of #94009 - compiler-errors:gat-rustdoc, r=GuillaumeGomezbors-1/+1
Support GATs in Rustdoc Implements: 1. Rendering GATs in trait definitions and impl blocks 2. Rendering GATs in types (e.g. in the return type of a function) Fixes #92341 This is my first rustdoc PR, so I have absolutely no idea how to produce tests for this. Advice from the rustdoc team would be wonderful! I tested locally and things looked correct: ![image](https://user-images.githubusercontent.com/3674314/153988325-9732cbf3-0645-4e1a-9e64-ddfd93877b55.png)
2022-03-03make generic projection types print correctlyMichael Goulet-1/+1
2022-03-01Rollup merge of #93385 - CraftSpider:rustdoc-ty-fixes, r=camelidDylan DPC-1/+1
Rustdoc ty consistency fixes Changes to make rustdoc cleaning of ty more consistent with hir, and hopefully use it in more places. r? `@camelid`
2022-02-09Ensure that queries only return Copy types.Camille GILLOT-1/+1
2022-01-26Don't use is_local to determine function cleaning method call intentRune Tynan-1/+1
2022-01-14rustdoc: avoid many `Symbol` to `String` conversions.Nicholas Nethercote-6/+3
Particularly when constructing file paths and fully qualified paths. This avoids a lot of allocations, speeding things up on almost all examples.
2022-01-09Auto merge of #92690 - matthiaskrgr:rollup-rw0oz05, r=matthiaskrgrbors-1/+2
Rollup of 8 pull requests Successful merges: - #92055 (Add release notes for 1.58) - #92490 (Move crate drop-down to search results page) - #92510 (Don't resolve blocks in foreign functions) - #92573 (expand: Refactor InvocationCollector visitor for better code reuse) - #92608 (rustdoc: Introduce a resolver cache for sharing data between early doc link resolution and later passes) - #92657 (Implemented const casts of raw pointers) - #92671 (Make `Atomic*::from_mut` return `&mut Atomic*`) - #92673 (Remove useless collapse toggle on "all items" page) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-01-09rustc_metadata: Rename `item_children(_untracked)` to ↵Vadim Petrochenkov-1/+1
`module_children(_untracked)` And `each_child_of_item` to `for_each_module_child`
2022-01-07rustdoc: Introduce a resolver cache for sharing data between early doc link ↵Vadim Petrochenkov-1/+2
resolution and later passes
2022-01-01Rustdoc: use ThinVec for GenericArgs bindingsJakub Beránek-1/+2
2021-12-23Rustdoc: use `is_doc_hidden` method on more placesJakub Beránek-4/+4
2021-12-18hir: Do not introduce dummy type names for `extern` blocks in def pathsVadim Petrochenkov-3/+3
Use a separate nameless `DefPathData` variant instead
2021-12-03Remove a Clean impl for a tuple (7)Noah Lev-3/+3
2021-12-03Remove a Clean impl for a tuple (3)Noah Lev-10/+13
2021-11-28Take a LocalDefId in expect_*item.Camille GILLOT-7/+4
2021-11-21Auto merge of #90844 - camelid:cleanup-vis, r=jyn514bors-7/+2
rustdoc: Finish transition to computed visibility This finishes the transition to using computed visibility in rustdoc.
2021-11-19Rollup merge of #90750 - camelid:rm-tuple-impls-1, r=jyn514Yuki Okushi-0/+1
rustdoc: Replace where-bounded Clean impl with simple function This is the first step in removing the Clean impls for tuples. Either way, this significantly simplifies the code since it reduces the amount of "trait magic". (To clarify, I'm referring to impls like `impl Clean for (A, B)`, not Clean impls that work on tuples in the user's program.) cc ``@jyn514``
2021-11-17rustdoc: Clean `Visibility` outside of `display_macro_source`Noah Lev-7/+2
This change should make the code a bit clearer and easier to change.
2021-11-09Add comments ensuring that generics are cleaned before argsNoah Lev-0/+1
Otherwise, rustdoc panics with messages like this: thread 'rustc' panicked at 'assertion failed: cx.impl_trait_bounds.is_empty()', src/librustdoc/clean/utils.rs:462:5 This ordering requirement is unrelated to the `clean_fn_decl_with_args` refactoring, but the requirement was uncovered as part of that change. I'm not sure if *all* of these places have the requirement, but I added comments to them just in case.
2021-11-09Add `ty::Visibility::is_public()`inquisitivecrystal-2/+2
2021-11-07Remove Clean impl for `Vec<T>`Noah Lev-6/+4
2021-11-07Remove Clean impl for `IndexVec<T>`Noah Lev-1/+1
2021-11-07Remove Clean impl for `Option<T>`Noah Lev-1/+1
2021-11-07rustdoc: Use `ty::ImplPolarity` instead of custom enumNoah Lev-1/+1
2021-11-07Use an enum to record polarity in `clean::Impl`Noah Lev-1/+1
2021-11-07rustdoc: Refactor `Impl.{synthetic,blanket_impl}` into enumNoah Lev-3/+4
This change has two advantages: 1. It makes the possible states clearer, and it makes it impossible to construct invalid states, such as a blanket impl that is also an auto trait impl. 2. It shrinks the size of `Impl` a bit, since now there is only one field, rather than two.
2021-11-06rustdoc: Remove redundant `Impl.span` fieldNoah Lev-1/+0
It can be computed on-demand in `Item::span()`.
2021-10-27Improve perf measurements of `build_extern_trait_impl`Noah Lev-0/+2
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.
2021-10-22Fix another place that used `def_id_no_primitives()`Noah Lev-1/+1
2021-10-22Rename `Type::def_id_full()` to `Type::def_id()`Noah Lev-2/+2
It should be preferred over `def_id_no_primitives()`, so it should have a shorter name. I also put it before `def_id_no_primitives()` so that it shows up first in the docs.
2021-10-22Rename `Type::def_id()` to `Type::def_id_no_primitives()`Noah Lev-1/+5
The old name was confusing because it's easy to assume that using `def_id()` is fine, but in some situations it's incorrect. In general, `def_id_full()` should be preferred, so `def_id_full()` should have a shorter name. That will happen in the next commit.
2021-10-22Use `def_id_full()` where easily possibleNoah Lev-2/+2
In general, it should be preferred over `Type::def_id()`. See each method's docs for more.
2021-10-22Replace `GetDefId` with inherent methodsNoah Lev-3/+1
Now that it's only implemented for `Type`, using inherent methods instead means that imports are no longer necessary. Also, `GetDefId` is only meant to be used with `Type`, so it shouldn't be a trait.
2021-10-21Fix docs for `inline::build_impl`Noah Lev-1/+1
Based on looking at the source code, it looks like the `did` needs to be for an impl, not functions in an impl.
2021-10-09Auto merge of #88379 - camelid:cleanup-clean, r=jyn514bors-27/+25
rustdoc: Cleanup various `clean` types Cleanup various `clean` types.
2021-10-05Allow adding a set of cfg's to hide from being implicitly doc(cfg)'dWim Looman-2/+2
By adding #![doc(cfg_hide(foobar))] to the crate attributes the cfg #[cfg(foobar)] (and _only_ that _exact_ cfg) will not be implicitly treated as a doc(cfg) to render a message in the documentation.
2021-10-05Make cfg implicitly imply doc(cfg)Wim Looman-2/+2
This is only active when the `doc_cfg` feature is active. The implicit cfg can be overridden via #[doc(cfg(...))], so e.g. to hide a #[cfg] you can use something like: ```rust #[cfg(unix)] #[doc(cfg(all()))] pub struct Unix; ``` (since `all()` is always true, it is never shown in the docs)
2021-10-02Replace all uses of `path.res.def_id()` with `path.def_id()`Noah Lev-4/+4
2021-09-30Remove temporary `GetDefId` impl for `Path`Noah Lev-2/+2
2021-09-30Avoid unnecessary matches by changing `Clean` implNoah Lev-4/+1
2021-09-30Use `Path` instead of `Type` in `PolyTrait`Noah Lev-21/+23
The change to `impl Clean<Path> for hir::TraitRef<'_>` was necessary to fix a test failure for `src/test/rustdoc/trait-alias-mention.rs`. Here's why: The old code path was through `impl Clean<Type> for hir::TraitRef<'_>`, which called `resolve_type`, which in turn called `register_res`. Now, because `PolyTrait` uses a `Path` instead of a `Type`, the impl of `Clean<Path>` was being run, which did not call `register_res`, causing the trait alias to not be recorded in the `external_paths` cache.
2021-09-30Make `Impl.trait_` a `Path`, not a `Type`Noah Lev-1/+1
It should only ever be a `ResolvedPath`, so this (a) enforces that, and (b) reduces the size of `Impl`. I had to update a test because the order of the rendered auto trait impl bounds changed. I think the order changed because rustdoc sorts auto trait bounds using their `Debug` output.
2021-09-30Remove `Path.global`Noah Lev-1/+0
2021-09-26Elaborate commentHirochika Matsumoto-1/+1
Co-authored-by: Joshua Nelson <github@jyn.dev>
2021-09-25rustdoc: Don't show hidden trait methodsHirochika Matsumoto-1/+33
By skipping trait items whose attributes include `hidden`, we void showing such trait methods.
2021-09-21Revert the rustdoc box syntax removalest31-12/+6
It turned out to cause (minor) perf regressions.