| Age | Commit message (Collapse) | Author | Lines |
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
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
|
|
|
|
[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:

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:

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`
|
|
|
|
|
|
|
|
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>;
```

<details>
<summary>Old</summary>



</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>;
```

<details>
<summary>Old</summary>



</details>
r? `@GuillaumeGomez`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
* associated
* collected
* correspondence
* inlining
* into
* javascript
* multiline
* variadic
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
|
|
|
|
|
|
|
|
An attempt to reduce the perf regression in
https://github.com/rust-lang/rust/pull/108052#issuecomment-1430631861
|
|
|
|
|
|
|
|
|
|
|
|
Not all uses are converted, a few cases iterating through maps/sets and requiring nontrivial changes are kept.
|
|
|
|
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`
|
|
|
|
|
|
Closes #106299
|
|
|
|
|
|
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.
|
|
|
|
|
|
Signed-off-by: cui fliter <imcusg@gmail.com>
|
|
|
|
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`
|
|
|