summary refs log tree commit diff
path: root/src/librustdoc/clean/inline.rs
AgeCommit message (Collapse)AuthorLines
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.
2021-09-12Rollup merge of #88677 - petrochenkov:exportid, r=davidtwcoManish Goregaokar-6/+5
rustc: Remove local variable IDs from `Export`s Local variables can never be exported.
2021-09-12downgrade some loggingJoshua Nelson-2/+2
2021-09-10rustc: Remove local variable IDs from `Export`sVadim Petrochenkov-6/+5
Local variables can never be exported.
2021-09-09Ignore automatically derived impls of `Clone` and `Debug` in dead code analysisFabian Wolff-2/+0
2021-08-29rustdoc: Stop using resolver for macro loadingVadim Petrochenkov-3/+3
2021-08-18remove box_syntax uses from cranelift and toolsMarcel Hellwig-6/+12
2021-08-05* Rename Span::from_rustc_span to Span::newGuillaume Gomez-1/+1
* Rename Span::wrap to Span::wrap_raw * Improve documentation for Span::wrap_raw
2021-07-07Fix reexports visibilityGuillaume Gomez-12/+25
2021-07-07Unify macro source displayGuillaume Gomez-31/+7
2021-07-07Fix rendering of reexported macros 2.0Guillaume Gomez-9/+27
2021-07-06Auto merge of #86644 - Stupremee:replace-fakedefids-with-itemid, r=jyn514bors-3/+4
rustdoc: Replace `FakeDefId` with new `ItemId` type Follow up from #84707 `@Manishearth` [suggested](https://github.com/rust-lang/rust/pull/84707#issuecomment-831994669) that there should be a new `ItemId` type that can distinguish between auto traits, normal ids, and blanket impls instead of using `FakeDefId`s. This type is introduced by this PR. There are still some `FIXME`s left, because I was unsure what the best solution for them would be. Especially the naming in general now is a bit weird right now and needs to be cleaned up. Now there are no "fake" ids so the `is_fake` method on `Item` does not really make sense and maybe the methods on `ItemId` should be renamed too? Also, we need to represent the new item ids in the JSON backend somehow.
2021-07-05rustdoc: Add `PrimitiveType` to `ItemId::Primitive`Justus K-2/+3
2021-07-05rustdoc: Replace `FakeDefId` with new `ItemId` typeJustus K-2/+2