about summary refs log tree commit diff
path: root/src/librustdoc/json
AgeCommit message (Collapse)AuthorLines
2024-05-31Rollup merge of #125635 - fmease:mv-type-binding-assoc-item-constraint, ↵Matthias Krüger-11/+11
r=compiler-errors Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanup Rename `hir::TypeBinding` and `ast::AssocConstraint` to `AssocItemConstraint` and update all items and locals using the old terminology. Motivation: The terminology *type binding* is extremely outdated. "Type bindings" not only include constraints on associated *types* but also on associated *constants* (feature `associated_const_equality`) and on RPITITs of associated *functions* (feature `return_type_notation`). Hence the word *item* in the new name. Furthermore, the word *binding* commonly refers to a mapping from a binder/identifier to a "value" for some definition of "value". Its use in "type binding" made sense when equality constraints (e.g., `AssocTy = Ty`) were the only kind of associated item constraint. Nowadays however, we also have *associated type bounds* (e.g., `AssocTy: Bound`) for which the term *binding* doesn't make sense. --- Old terminology (HIR, rustdoc): ``` `TypeBinding`: (associated) type binding ├── `Constraint`: associated type bound └── `Equality`: (associated) equality constraint (?) ├── `Ty`: (associated) type binding └── `Const`: associated const equality (constraint) ``` Old terminology (AST, abbrev.): ``` `AssocConstraint` ├── `Bound` └── `Equality` ├── `Ty` └── `Const` ``` New terminology (AST, HIR, rustdoc): ``` `AssocItemConstraint`: associated item constraint ├── `Bound`: associated type bound └── `Equality`: associated item equality constraint OR associated item binding (for short) ├── `Ty`: associated type equality constraint OR associated type binding (for short) └── `Const`: associated const equality constraint OR associated const binding (for short) ``` r? compiler-errors
2024-05-30Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanupLeón Orell Valerian Liehr-11/+11
2024-05-29Make `body_owned_by` return the body directly.Oli Scherer-1/+4
Almost all callers want this anyway, and now we can use it to also return fed bodies
2024-05-17Rename Unsafe to SafetySantiago Pastorino-5/+5
2024-04-08Actually create ranged int types in the type system.Oli Scherer-3/+4
2024-04-08Thread pattern types through the HIROli Scherer-0/+3
2024-02-15rustdoc: cross-crate re-exports: correctly render late-bound params in ↵León Orell Valerian Liehr-14/+11
source order even if early-bound params are present
2023-12-27Introduce `const Trait` (always-const trait bounds)León Orell Valerian Liehr-0/+3
2023-12-23Add `is_object_safe` information for traits in JSON outputGuillaume Gomez-0/+2
2023-11-15Re-format code with new rustfmtMark Rousskov-10/+11
2023-10-30Descriptive variant name deprecation versions outside the standard libraryDavid Tolnay-1/+1
2023-10-30Represent absence of 'since' attribute as a variant of DeprecatedSinceDavid Tolnay-4/+4
2023-10-30Add a DeprecatedSince::Err variant for versions that fail to parseDavid Tolnay-1/+8
2023-10-29Store version of `deprecated` attribute in structured formDavid Tolnay-2/+1
2023-10-22rustdoc: wrap Type with Box instead of GenericsMichael Howell-3/+3
When these `Box<Generics>` types were introduced, `Generics` was made with `Vec` and much larger. Now that it's made with `ThinVec`, `Type` is bigger and should be boxed instead.
2023-10-14Rollup merge of #115439 - fmease:rustdoc-priv-repr-transparent-heuristic, ↵Matthias Krüger-1/+2
r=GuillaumeGomez rustdoc: hide `#[repr(transparent)]` if it isn't part of the public ABI Fixes #90435. This hides `#[repr(transparent)]` when the non-1-ZST field the struct is "transparent" over is private. CC `@RalfJung` Tentatively nominating it for the release notes, feel free to remove the nomination. `@rustbot` label needs-fcp relnotes A-rustdoc-ui
2023-10-12Hide host effect params from docsOli Scherer-7/+9
2023-10-09Auto merge of #116142 - GuillaumeGomez:enum-variant-display, r=fmeasebors-1/+1
[rustdoc] Show enum discrimant if it is a C-like variant Fixes https://github.com/rust-lang/rust/issues/101337. We currently display values for associated constant items in traits: ![image](https://github.com/rust-lang/rust/assets/3050060/03e566ec-c670-47b4-8ca2-b982baa7a0f4) And we also display constant values like [here](file:///home/imperio/rust/rust/build/x86_64-unknown-linux-gnu/doc/std/f32/consts/constant.E.html). I think that for coherency, we should display values of C-like enum variants. With this change, it looks like this: ![image](https://github.com/rust-lang/rust/assets/3050060/b53fbbe0-bdb1-4289-8537-f2dd4988e9ac) As for the display of the constant value itself, I used what we already have to keep coherency. We display the C-like variants value in the following scenario: 1. It is a C-like variant with a value set => all the time 2. It is a C-like variant without a value set: All other variants are C-like variants and at least one them has its value set. Here is the result in code: ```rust // Ax and Bx value will be displayed. enum A { Ax = 12, Bx, } // Ax and Bx value will not be displayed enum B { Ax, Bx, } // Bx value will not be displayed enum C { Ax(u32), Bx, } // Bx value will not be displayed, Cx value will be displayed. #[repr(u32)] enum D { Ax(u32), Bx, Cx = 12, } ``` r? `@notriddle`
2023-10-03rustdoc: fix & clean up handling of cross-crate higher-ranked lifetimesLeón Orell Valerian Liehr-3/+2
2023-09-25Show enum variant value if it is a C-like variantGuillaume Gomez-1/+1
2023-09-18rustdoc: hide repr(transparent) if it isn't part of the public ABILeón Orell Valerian Liehr-1/+2
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