summary refs log tree commit diff
path: root/src/librustdoc/html/format.rs
AgeCommit message (Collapse)AuthorLines
2025-03-15Add RTN support to rustdocMichael Goulet-0/+3
2025-03-10make precise capturing args in rustdoc Json typedmorine0122-1/+1
2025-03-06Manual, post-`clippy --fix` cleanupsYotam Ofek-5/+5
2025-03-06`x clippy src/librustdoc --fix`Yotam Ofek-6/+4
2025-03-04Adapt `librustdoc` to 2024 edition lifetieme capture rulesYotam Ofek-99/+45
Get rid of the `Captures` hack
2025-03-04`librustdoc`: 2024 edition! šŸŽŠYotam Ofek-1/+1
2025-02-23return `impl fmt::Display` in more places instead of writing to stringsYotam Ofek-8/+8
2025-02-14librustdoc: lazily format some pathsYotam Ofek-19/+26
2025-02-14librustdoc: create `MaybeDisplay` helper for `Option<T: Display>` typesYotam Ofek-1/+1
2025-02-12Nuke `Buffer` abstraction from `librustdoc` šŸ’£Yotam Ofek-114/+9
2025-02-04librustdoc: create a helper for separating elements of an iterator instead ↵Yotam Ofek-155/+105
of implementing it multiple times
2025-02-01Omit argument names from function pointers that do not have argument namesDavid Tolnay-1/+3
2025-01-22rustdoc: use std's (unstable) `fmt::from_fn` instead of open-coding itYotam Ofek-53/+37
2025-01-15Treat safe target_feature functions as unsafe by defaultOli Scherer-0/+1
2025-01-14Add hir::HeaderSafety to make follow up commits simplerOli Scherer-0/+8
2024-12-31Unsafe binder support in rustdocMichael Goulet-5/+12
2024-12-16rename rustc_attr to rustc_attr_parsing and create rustc_attr_data_structuresJonathan Dƶnszelmann-1/+1
2024-12-14Add some convenience helper methods on `hir::Safety`Oli Scherer-4/+1
2024-11-28Fix new clippy lintsGuillaume Gomez-13/+18
2024-11-23do not to_string, use displayklensy-1/+1
2024-11-13rustdoc: Treat decl macros like other itemsLeón Orell Valerian Liehr-41/+0
2024-11-01rustdoc: Directly use rustc_abi instead of reexportsJubilee Young-3/+3
rustc_target reexports a lot of things that are in rustc_abi, but that will be over soon and now is probably a good time to switch. Uses of rustc_target remain where they inquire about the target tuple.
2024-10-29update toolslcnr-3/+2
2024-10-26expand: Stop using artificial `ast::Item` for macros loaded from metadataVadim Petrochenkov-5/+3
2024-10-24rustdoc: Extend fake_variadic to "wrapped" tuplesTau GƤrtli-0/+18
This allows impls such as `impl QueryData for OneOf<(T,)>` to be displayed as variadic: `impl QueryData for OneOf<(T₁, Tā‚‚, …, Tā‚™)>`. See question on zulip: <https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/Make.20.60.23.5Bdoc.28fake_variadic.29.5D.60.20more.20useful>
2024-10-22Represent TraitBoundModifiers as distinct parts in HIRMichael Goulet-7/+7
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-2/+2
2024-08-31Rollup merge of #129774 - nnethercote:rm-extern-crate-tracing-remainder, ↵Matthias Krüger-0/+1
r=GuillaumeGomez Remove `#[macro_use] extern crate tracing` from rustdoc and rustfmt A follow-up to #129767 and earlier PRs doing this for `rustc_*` crates. r? ```@GuillaumeGomez```
2024-08-30Remove `#[macro_use] extern crate tracing` from rustdoc.Nicholas Nethercote-0/+1
2024-08-29Rollup merge of #129743 - GuillaumeGomez:fix-rustdoc-clippy, r=notriddleGuillaume Gomez-10/+9
Fix rustdoc clippy lints Ran clippy on rustdoc and fixed the errors. r? `@notriddle`
2024-08-29Fix clippy lintsGuillaume Gomez-10/+9
2024-08-24rustdoc: clean up tuple <-> primitive conversion docsMichael Howell-40/+74
This adds a minor missing feature to `fake_variadic`, so that it can render `impl From<(T,)> for [T; 1]` correctly.
2024-08-10Stop showing impl items for negative implsGuillaume Gomez-3/+2
2024-08-04rustdoc: Delete `ReceiverTy` (formerly known as `SelfTy`)Noah Lev-17/+10
It was barely used, and the places that used it are actually clearer without it since they were often undoing some of its work. This also avoids an unnecessary clone of the receiver type and removes a layer of logical indirection in the code.
2024-08-04rustdoc: Create `SelfTy` to replace `Generic(kw::SelfUpper)`Noah Lev-0/+1
Rustdoc often has to special-case `Self` because it is, well, a special type of generic parameter (although it also behaves as an alias in concrete impls). Instead of spreading this special-casing throughout the code base, create a new variant of the `clean::Type` enum that is for `Self` types. This is a refactoring that has almost no impact on rustdoc's behavior, except that `&Self`, `(Self,)`, `&[Self]`, and other similar occurrences of `Self` no longer link to the wrapping type (reference primitive, tuple primitive, etc.) as regular generics do. I felt this made more sense since users would expect `Self` to link to the containing trait or aliased type (though those are usually expanded), not the primitive that is wrapping it. For an example of the change, see the docs for `std::alloc::Allocator::by_ref`.
2024-08-04rustdoc: Rename `SelfTy` to `ReceiverTy`Noah Lev-1/+1
`SelfTy` makes it sound like it is literally the `Self` type, whereas in fact it may be `&Self` or other types. Plus, I want to use the name `SelfTy` for a new variant of `clean::Type`. Having both causes resolution conflicts or at least confusion.
2024-07-29rustdoc: word wrap CamelCase in the item list tableMichael Howell-1/+2
This is an alternative to ee6459d6521cf6a4c2e08b6e13ce3c6ce5d55ed0. That is, it fixes the issue that affects the very long type names in https://docs.rs/async-stripe/0.31.0/stripe/index.html#structs. This is, necessarily, a pile of nasty heuristics. We need to balance a few issues: - Sometimes, there's no real word break. For example, `BTreeMap` should be `BTree<wbr>Map`, not `B<wbr>Tree<wbr>Map`. - Sometimes, there's a legit word break, but the name is tiny and the HTML overhead isn't worth it. For example, if we're typesetting `TyCtx`, writing `Ty<wbr>Ctx` would have an HTML overhead of 50%. Line breaking inside it makes no sense.
2024-07-29Reformat `use` declarations.Nicholas Nethercote-10/+6
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-27rustdoc: use strategic ThinVec/Box to shrink `clean::ItemKind`Michael Howell-1/+1
2024-07-19Avoid ref when using format! in compilerYuri Astrakhan-1/+1
Clean up a few minor refs in `format!` macro, as it has a performance cost. Apparently the compiler is unable to inline `format!("{}", &variable)`, and does a run-time double-reference instead (format macro already does one level referencing).Ā  Inlining format args prevents accidental `&` misuse.
2024-07-12Add rustdoc support for use<> in (local) RPITsMichael Goulet-0/+14
2024-06-04Use checked_subSergi-Ferrez-6/+7
2024-06-04Update code format and testsSergi-Ferrez-2/+2
2024-06-04Include trailing commas in functionsSergi-Ferrez-10/+12
2024-05-31Rollup merge of #125635 - fmease:mv-type-binding-assoc-item-constraint, ↵Matthias Krüger-8/+8
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-8/+8
2024-05-26rustdoc: Show "const" for const-unstable if also overall unstableNoah Lev-11/+18
If a const function is unstable overall (and thus, in all circumstances I know of, also const-unstable), we should show the option to use it as const. You need to enable a feature to use the function at all anyway. If the function is stabilized without also being const-stabilized, then we do not show the const keyword and instead show "const: unstable" in the version info.
2024-05-17Rename Unsafe to SafetySantiago Pastorino-5/+5
2024-05-08Simplify `use crate::rustc_foo::bar` occurrences.Nicholas Nethercote-2/+2
They can just be written as `use rustc_foo::bar`, which is far more standard. (I didn't even know that a `crate::` prefix was valid.)
2024-04-08Thread pattern types through the HIROli Scherer-0/+4