summary refs log tree commit diff
path: root/src/librustdoc/clean/inline.rs
AgeCommit message (Collapse)AuthorLines
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.
2021-04-23Take ItemType instead of TypeKind in record_extern_fqnJoshua Nelson-16/+16
2021-04-23rustdoc: Remove unnecessary `is_crate` field from doctree::Module and ↵Joshua Nelson-1/+1
clean::Module It can be calculated on-demand even without a TyCtxt. This also changed `from_item_kind` to take a whole item, which avoids having to add more and more parameters.
2021-04-02rustdoc: Rename internal uses of `spotlight`Camelid-1/+1
I didn't make these renames in #80965 because I didn't want the PR to conflict with #80914.
2021-04-02Auto merge of #80965 - camelid:rename-doc-spotlight, r=jyn514bors-1/+1
Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]` Fixes #80936. "spotlight" is not a very specific or self-explaining name. Additionally, the dialog that it triggers is called "Notable traits". So, "notable trait" is a better name. * Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]` * Rename `#![feature(doc_spotlight)]` to `#![feature(doc_notable_trait)]` * Update documentation * Improve documentation r? `@Manishearth`
2021-03-24Split clean::Constant enum into a struct and an enumGuillaume Gomez-1/+4
2021-03-24Rename clean::Constant did fields to def_idGuillaume Gomez-2/+2
2021-03-24Improve new Constant variants' nameGuillaume Gomez-1/+1
2021-03-24Rework rustdoc const typeGuillaume Gomez-13/+6
2021-03-21Rename `clean::Item.source` to `span`Camelid-1/+1
Its type is called `clean::Span`, and also the name in the rest of rustdoc and rustc for this kind of field is `span`.
2021-03-15Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]`Camelid-1/+1
"spotlight" is not a very specific or self-explaining name. Additionally, the dialog that it triggers is called "Notable traits". So, "notable trait" is a better name. * Rename `#[doc(spotlight)]` to `#[doc(notable_trait)]` * Rename `#![feature(doc_spotlight)]` to `#![feature(doc_notable_trait)]` * Update documentation * Improve documentation
2021-03-01Remove the dummy cache in `DocContext`Joshua Nelson-6/+7
The same information is available everywhere; the only reason the dummy cache was needed is because it waas previously stored in three different places. This consolidates the info a bit so the cache in `DocContext` is used throughout. As a bonus, it means `renderinfo` is used much much less. - Return a `Cache` from `run_global_ctxt`, not `RenderInfo` - Remove the unused `render_info` from `run_renderer` - Remove RefCell around `inlined` - Add intra-doc links
2021-02-25Auto merge of #82265 - GuillaumeGomez:cleanup-attrs-twice, r=jyn514bors-5/+6
Prevent to compute Item attributes twice I came across this case when working on another part of rustdoc. Not a game changer but a nice little improvement. cc `@camelid` r? `@jyn514`
2021-02-24Prevent to compute Item attributes twiceGuillaume Gomez-5/+6
2021-02-23Improve code readabilityGuillaume Gomez-7/+5
2021-02-23Put clean::Trait extra information into a new struct to make it more coherentGuillaume Gomez-3/+7
2021-02-23Remove is_spotlight field from `Trait`Guillaume Gomez-3/+3
2021-02-22Remove many RefCells from DocContextCamelid-11/+10
I left some of them so this change doesn't balloon in size and because removing the RefCell in `DocContext.resolver` would require compiler changes. Thanks to `@jyn514` for making this a lot easier with #82020!
2021-02-16Make `Clean` take &mut DocContextJoshua Nelson-18/+22
- Take `FnMut` in `rustc_trait_selection::find_auto_trait_generics` - Take `&mut DocContext` in most of `clean` - Collect the iterator in auto_trait_impls instead of iterating lazily; the lifetimes were really bad. - Changes `fn sess` to properly return a borrow with the lifetime of `'tcx`, not the mutable borrow.
2021-02-11clean up clean::Static structGuillaume Gomez-1/+1