summary refs log tree commit diff
path: root/src/librustdoc/json
AgeCommit message (Collapse)AuthorLines
2023-10-20Hide host effect params from docsOli Scherer-7/+9
(cherry picked from commit c4e61faf2e078dc30b62488326404137600e5e11)
2023-09-07Auto merge of #114855 - Urgau:rustdoc-typedef-inner-variants, r=GuillaumeGomezbors-1/+1
rustdoc: show inner enum and struct in type definition for concrete type This PR implements the [Display enum variants for generic enum in type def page](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Display.20enum.20variants.20for.20generic.20enum.20in.20type.20def.20page) #rustdoc/zulip proposal. This proposal comes from looking at [`TyKind`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/sty/type.TyKind.html) typedef from the compiler. On that page, the documentation is able to show the layout for each variant, but not the variants themselves. This proposal suggests showing the fields and variants for those "concrete type". This would mean that instead of having many unresolved generics, like in `IrTyKind`: ```rust Array(I::Ty, I::Const), Slice(I::Ty), RawPtr(I::TypeAndMut), Ref(I::Region, I::Ty, I::Mutability), FnDef(I::DefId, I::GenericArgsRef), ``` those would be resolved with direct links to the proper types in the `TyKind` typedef page: ```rust Array(Ty<'tcx>, Const<'tcx>), Slice(Ty<'tcx>), RawPtr(TypeAndMut<'tcx>), Ref(Region<'tcx>, Ty<'tcx>, Mutability<'tcx>), FnDef(DefId<'tcx>, GenericArgsRef<'tcx>), ``` Saving both time and confusion. ----- <details> <summary>Old description</summary> I've chosen to add the enums and structs under the "Show Aliased Type" details, as well as showing the variants and fields under the usual "Variants" and "Fields" sections. ~~*under new the `Inner Variants` and `Inner Fields` sections (except for their names, they are identical to the one found in the enum, struct and union pages). Those sections are complementary and do not replace anything else.*~~ This PR proposes the following condition for showing the aliased type (basically, has the aliased type some generics that are all of them resolved): - the typedef does NOT have any generics (modulo lifetimes) - AND the aliased type has some generics </details> ### Examples ```rust pub enum IrTyKind<'a, I: Interner> { /// Doc comment for AdtKind AdtKind(&'a I::Adt), /// and another one for TyKind TyKind(I::Adt, I::Ty), // no comment StructKind { a: I::Adt, }, } pub type TyKind<'a> = IrTyKind<'a, TyCtxt>; ``` ![TyKind](https://github.com/rust-lang/rust/assets/3616612/13307679-6d48-40d6-ad50-6db0b7f36ac7) <details> <summary>Old</summary> ![image](https://github.com/rust-lang/rust/assets/3616612/4147c049-d056-42d4-8a01-d43ebe747308) ![TyKind](https://user-images.githubusercontent.com/3616612/260988247-34831aa9-470d-4286-ad9f-3e8002153a92.png) ![TyKind](https://github.com/rust-lang/rust/assets/3616612/62381bb3-fa0f-4b05-926d-77759cf9115a) </details> ```rust pub struct One<T> { pub val: T, #[doc(hidden)] pub inner_tag: u64, __hidden: T, } /// `One` with `u64` as payload pub type OneU64 = One<u64>; ``` ![OneU64](https://github.com/rust-lang/rust/assets/3616612/d551b474-ce88-4f8c-bc94-5c88aba51424) <details> <summary>Old</summary> ![image](https://github.com/rust-lang/rust/assets/3616612/1a3f53c0-17bf-4aa7-894d-3fedc15b33da) ![OneU64](https://github.com/rust-lang/rust/assets/3616612/7b124a5b-e287-4efb-b9ca-fdcd1cdeeba8) ![OneU64](https://github.com/rust-lang/rust/assets/3616612/ddd962be-4f76-4ecd-81bd-531f3dd23832) </details> r? `@GuillaumeGomez`
2023-09-01Reuse const rendering from rustdoc in rmeta encodingBen Kimock-2/+2
2023-08-26rustdoc: show inner enum and struct in type definition for concrete typeUrgau-1/+1
2023-08-21rustdoc-json: Rename typedef to type aliasNoah Lev-7/+7
2023-08-21rustdoc: Rename `clean` items from typedef to type aliasNoah Lev-5/+5
2023-08-16Improve code readability by moving fmt args directly into the stringGuillaume Gomez-3/+3
2023-07-28Render generic const items in rustdocLeón Orell Valerian Liehr-2/+7
2023-05-30rustdoc: simplify `clean` by removing `FnRetTy`Michael Howell-4/+1
The default fn ret ty is always unit. Just use that. Looking back at the time when `FnRetTy` (then called `FunctionRetTy`) was first added to rustdoc, it seems to originally be there because `-> !` was a special form: the never type didn't exist back then. https://github.com/rust-lang/rust/commit/eb01b17b06eb35542bb80ff7456043b0ed5572ba#diff-384affc1b4190940f114f3fcebbf969e7e18657a71ef9001da6b223a036687d9L921-L924
2023-05-22rustdoc: Cleanup doc string collapsingVadim Petrochenkov-1/+1
2023-05-04IAT: Rustdoc integrationLeón Orell Valerian Liehr-1/+1
2023-05-02Make tools happyMichael Goulet-0/+4
2023-04-29Unify attributes retrieval for JSON and HTML renderingGuillaume Gomez-6/+1
2023-04-26rustdoc-json: Time serialization.Alona Enraght-Moony-1/+4
2023-04-16Spelling librustdocJosh Soref-2/+2
* associated * collected * correspondence * inlining * into * javascript * multiline * variadic Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2023-04-12remove some unneeded importsKaDiWa-1/+0
2023-03-30Replace doc(primitive) with rustc_doc_primitiveGuillaume Gomez-4/+2
2023-03-28rustdoc + rustdoc-json support for non_lifetime_bindersMichael Goulet-4/+30
2023-02-22rustdoc: reduce allocations when generating tooltipsMichael Howell-1/+1
An attempt to reduce the perf regression in https://github.com/rust-lang/rust/pull/108052#issuecomment-1430631861
2023-02-18Improve code readabilityGuillaume Gomez-10/+21
2023-02-18Fix bad handling of primitive typesGuillaume Gomez-30/+48
2023-02-18Allow reexports of items with same name but different types to both appearGuillaume Gomez-57/+60
2023-02-15Use more let chainGuillaume Gomez-6/+5
2023-02-08Fix small debug typoGuillaume Gomez-1/+1
2023-01-22rustdoc: Use `DefId(Map,Set)` instead of `FxHash(Map,Set)`Vadim Petrochenkov-8/+8
Not all uses are converted, a few cases iterating through maps/sets and requiring nontrivial changes are kept.
2023-01-10Remove unneeded ItemId::Primitive variantGuillaume Gomez-1/+0
2023-01-04Rollup merge of #106412 - ↵Matthias Krüger-8/+23
GuillaumeGomez:fix-links-to-primitive-rustdoc-json, r=aDotInTheVoid Fix link generation for local primitive types in rustdoc JSON output Fixes https://github.com/rust-lang/rust/issues/104064. As mentioned in the issue, I'm not super happy about this fix which is more a hack rather than a sound-proof solution. However I couldn't find a better way to fix it. r? `@aDotInTheVoid`
2023-01-04Remove unused match pattern for primitive typesGuillaume Gomez-1/+1
2023-01-03Fix link generation for local primitive types in rustdoc JSON outputGuillaume Gomez-7/+22
2023-01-01Rustdoc-Json: Report discriminant on all kinds of enum variant.Nixon Enraght-Moony-5/+7
Closes #106299
2023-01-01clean: Always store enum disriminant.Nixon Enraght-Moony-3/+6
2022-12-02Rustdoc-Json: Don't include foreign traitsNixon Enraght-Moony-52/+1
2022-12-01rustc_ast_lowering: Stop lowering imports into multiple itemsVadim Petrochenkov-1/+1
Lower them into a single item with multiple resolutions instead. This also allows to remove additional `NodId`s and `DefId`s related to those additional items.
2022-11-21Unreserve braced enum variants in value namespaceVadim Petrochenkov-5/+5
2022-11-16rustdoc JSON: Use `Function` everywhere and remove `Method`Martin Nordholts-22/+7
2022-11-13fix some typos in commentscui fliter-2/+2
Signed-off-by: cui fliter <imcusg@gmail.com>
2022-11-05rustdoc: use `ThinVec` and `Box<str>` to shrink `clean::ItemKind`Michael Howell-1/+1
2022-11-04Rollup merge of #103935 - GuillaumeGomez:remove-rustdoc-visibility-ty, ↵Matthias Krüger-6/+5
r=notriddle Remove rustdoc clean::Visibility type Fixes #90852. Follow-up of https://github.com/rust-lang/rust/pull/103690. This PR completely removes the rustdoc `clean::Visibility` type to use the `rustc_middle` one instead. I don't think there will be any impact on perf. r? `@notriddle`
2022-11-03Remove rustdoc clean::Visibility typeGuillaume Gomez-6/+5
2022-11-02rustdoc: remove unneeded Box from ItemKindMichael Howell-1/+1
2022-10-30Make rustdoc Item::visibility computed on-demandGuillaume Gomez-1/+2
2022-10-05rustdoc: render more cross-crate hrtbs properlyLeón Orell Valerian Liehr-2/+3
2022-09-27rustdoc: remove `clean::TraitWithExtraInfo`Michael Howell-1/+0
Instead, it gathers the extra info later, when it's actually requested.
2022-09-26 Rustdoc-Json: List impls for primitivesNixon Enraght-Moony-3/+11
Closes #101695
2022-09-13Rustdoc-Json: Don't loose subitems of foreign traits.Nixon Enraght-Moony-2/+13
2022-09-10Rustdoc-Json: Correcty handle intra-doc-links to items without HTML pageNixon Enraght-Moony-2/+9
Closes #101531
2022-09-07Rustdoc-Json: More accurate struct type.Nixon Enraght-Moony-25/+11
Closes #101489
2022-09-05Rustdoc-Json: Store Variant Fields as their own item.Nixon Enraght-Moony-11/+21
Closes #100587 Closes #92945
2022-09-05Auto merge of #101386 - aDotInTheVoid:rdj-discriminant, r=GuillaumeGomezbors-1/+13
Rustdoc-Json: Add enum discriminant Does the first part of #101337, by adding it to `clean`, but doesn't change HTML output, as 1. [No Consensus has appeared on the UI for this](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/Enum.20discriminant.20values.20in.20HTML.20output) 2. [When inlining across crates, information is lost](https://rust-lang.zulipchat.com/#narrow/stream/266220-rustdoc/topic/.60clean_variant_def.20.60vs.20.60clean_variant_data.60) JSON doesn't have either of these limitations. r? `@GuillaumeGomez`
2022-09-04rustdoc: Compute enum discriminant on demandNixon Enraght-Moony-8/+10