about summary refs log tree commit diff
path: root/src/librustdoc/clean/inline.rs
AgeCommit message (Collapse)AuthorLines
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
2021-07-05Remove `impl Clean for {Ident, Symbol}`Joshua Nelson-1/+1
These were only used once, in a place where it was trivial to replace. Also, it's unclear what 'clean' would mean for these, so it seems better to be explicit.
2021-07-03Pretty-print macro matchers instead of using source codeNoah Lev-16/+12
The output is not quite as nice as it used to be, but it does work.
2021-06-26Auto merge of #84814 - Stupremee:properly-render-hrtbs, r=GuillaumeGomezbors-4/+7
Properly render HRTBs ```rust pub fn test<T>() where for<'a> &'a T: Iterator, {} ``` This will now render properly including the `for<'a>` ![image](https://user-images.githubusercontent.com/39732259/116808426-fe6ce600-ab38-11eb-9452-f33f554fbb8e.png) I do not know if this covers all cases, it only covers everything that I could think of that includes `for` and lifetimes in where bounds. Also someone need to mentor me on how to add a proper rustdoc test for this. Resolves #78482
2021-06-22Account for more casesDeadbeef-4/+4
2021-06-22Do not list impl when trait has doc(hidden)Deadbeef-1/+18
2021-06-18rustdoc: Render `for<'_>` lifetimes in front of where boundJustus K-4/+7
2021-06-02Restrict access to crate_name.Camille GILLOT-1/+1
Also remove original_crate_name, which had the exact same implementation
2021-06-01Revert "Reduce the amount of untracked state in TyCtxt"Camille Gillot-1/+1
2021-05-30Restrict access to crate_name.Camille GILLOT-1/+1
Also remove original_crate_name, which had the exact same implementation
2021-05-19rustdoc: render `<Self as X>::Y` type casts properlyJustus K-0/+1
2021-05-07Rollup merge of #84442 - jyn514:doc-cfg, r=petrochenkovDylan DPC-2/+2
Unify rustc and rustdoc parsing of `cfg()` This extracts a new `parse_cfg` function that's used between both. - Treat `#[doc(cfg(x), cfg(y))]` the same as `#[doc(cfg(x)] #[doc(cfg(y))]`. Previously it would be completely ignored. - Treat `#[doc(inline, cfg(x))]` the same as `#[doc(inline)] #[doc(cfg(x))]`. Previously, the cfg would be ignored. - Pass the cfg predicate through to rustc_expand to be validated Technically this is a breaking change, but doc_cfg is still nightly so I don't think it matters. Fixes https://github.com/rust-lang/rust/issues/84437. r? `````````@petrochenkov`````````
2021-05-04Add type to differentiate between fake and real DefId'sJustus K-4/+4
2021-05-03Unify rustc and rustdoc parsing of `cfg()`Joshua Nelson-2/+2
This extracts a new `parse_cfg` function that's used between both. - Treat `#[doc(cfg(x), cfg(y))]` the same as `#[doc(cfg(x)] #[doc(cfg(y))]`. Previously it would be completely ignored. - Treat `#[doc(inline, cfg(x))]` the same as `#[doc(inline)] #[doc(cfg(x))]`. Previously, the cfg would be ignored. - Pass the cfg predicate through to rustc_expand to be validated Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
2021-05-03Rollup merge of #84832 - Stupremee:dont-print-vis-in-external-traits, r=jyn514Dylan DPC-3/+13
Do not print visibility in external traits This PR fixes the bug that caused traits, which were re-exported, having visibility modifiers in front of methods, which is invalid. It would be nice to add a test for this, but I don't even know if tests with multiple crates are possible. Resolves #81274
2021-05-03Rollup merge of #84811 - scottmcm:rustdoc-trait-alias-fix, r=jyn514Dylan DPC-1/+1
RustDoc: Fix bounds linking trait.Foo instead of traitalias.Foo Fixes #84782 The code was assuming `Trait` when adding bounds to the cache, so add a check on the DefId to see what its kind really is. r? `@jyn514` Before: ![image](https://user-images.githubusercontent.com/18526288/116775611-6a751e80-aa53-11eb-84d0-ed6b7782be3c.png) After: ![image](https://user-images.githubusercontent.com/18526288/116802227-d19cdc80-ab00-11eb-8133-7b34dd750da2.png)
2021-05-02Do not print visibility in external traitsJustus K-3/+13
2021-05-01RustDoc: Fix bounds linking trait.Foo instead of traitalias.FooScott McMurray-1/+1
2021-04-30Remove unnecessary `provided_trait_methods` field from ImplJoshua Nelson-8/+1
It can be calculated on-demand.
2021-04-27Auto merge of #84494 - tdelabro:84304-bis, r=jyn514bors-19/+28
84304 - rustdoc: shrink Item::Attributes Helps with https://github.com/rust-lang/rust/issues/84304
2021-04-27cfg taken out of Attributes, put in ItemTimothée Delabrouille-18/+28
check item.is_fake() instead of self_id.is_some() Remove empty branching in Attributes::from_ast diverse small refacto after Josha review cfg computation moved in merge_attrs refacto use from_ast twice for coherence take cfg out of Attributes and move it to Item
2021-04-27Removed usage of Attributes in FnDecl and ExternalCrate. Relocate part of ↵Timothée Delabrouille-2/+1
the fields in Attributes, as functions in AttributesExt. refacto use from_def_id_and_attrs_and_parts instead of an old trick most of josha suggestions + check if def_id is not fake before using it in a query Removed usage of Attributes in FnDecl and ExternalCrate. Relocate part of the Attributes fields as functions in AttributesExt.
2021-04-25get rid of min_const_fn references in library/ and rustdocRalf Jung-2/+1
2021-04-24Get rid of `item.span`Joshua Nelson-3/+3
- Remove `span` field, adding `Item::span()` instead - Special-case `Impl` and `Module` items - Use dummy spans for primitive items
2021-04-24Do the hard part firstJoshua Nelson-1/+2
The only bit failing was the module, so change that before removing the `span` field.
2021-04-25Rollup merge of #84464 - jyn514:type-kind, r=CraftSpiderYuki Okushi-16/+16
rustdoc: Get rid of `clean::TypeKind` It does exactly the same thing as ItemType.