about summary refs log tree commit diff
path: root/src/librustdoc/html/format.rs
AgeCommit message (Collapse)AuthorLines
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
2024-03-14inlineManish Goregaokar-5/+9
2024-03-14print doc(hidden)Manish Goregaokar-5/+14
2024-03-14Refactor visibility_print_with_space to directly take an itemManish Goregaokar-7/+5
2024-02-27Fix link generation for locate foreign macro in jump to definition featureGuillaume Gomez-1/+1
2024-02-24Rustdoc: include crate name in links for local primitivesGurinder Singh-2/+7
It makes the link easier to use in cases in which the path of the page where it will be embedded is not known beforehand such as when we generate impls dynamically from `register_type_impls` method in `main.js` Earlier for local primitives we would generate a path that was relative to the current page depth passed in `cx.current` . e.g if the current page was `std::simd::prelude::Simd` the generated path would be `../../primitive.<prim>.html` After this change the path will first take you to the the wesite root and add the crate name. e.g. for `std::simd::prelude::Simd` the path now will be `../../../std/primitive.<prim>.html`
2024-02-16rustdoc: fix and refactor HTML rendering a bitLeón Orell Valerian Liehr-281/+173
2024-02-09Unify item relative path computation in one functionGuillaume Gomez-24/+2
2024-02-09Correctly generate path for non-local items in source code pagesGuillaume Gomez-52/+140
2023-12-27Introduce `const Trait` (always-const trait bounds)León Orell Valerian Liehr-2/+2
2023-11-30rustdoc: `div.where` instead of fmt-newline classMichael Howell-1/+1
This is about equally readable, a lot more terse, and stops special-casing functions and methods. ```console $ du -hs doc-old/ doc-new/ 671M doc-old/ 670M doc-new/ ```
2023-11-26rustdoc: Remove space from fake-variadic fn ptr implsMaybe Waffle-1/+1
before: `for fn (T₁, T₂, …, Tₙ) -> Ret` after: `for fn(T₁, T₂, …, Tₙ) -> Ret`
2023-11-15Re-format code with new rustfmtMark Rousskov-24/+33
2023-10-21rustdoc: avoid allocating strings primitive link printingMichael Howell-26/+51
This is aimed at hitting the allocator less in a function that gets called a lot.
2023-10-12Hide host effect params from docsOli Scherer-2/+1
2023-10-03rustdoc: fix & clean up handling of cross-crate higher-ranked lifetimesLeón Orell Valerian Liehr-2/+1
2023-09-21Record asyncness span in HIRMichael Goulet-1/+1
2023-08-16Use more named format argsGuillaume Gomez-19/+32
2023-08-16Improve code readability by moving fmt args directly into the stringGuillaume Gomez-30/+25
2023-08-11rustc: Move `features` from `Session` to `GlobalCtxt`Vadim Petrochenkov-1/+1
Removes two pieces of mutable state. Follow up to #114622.
2023-07-27Rollup merge of #114059 - fmease:rustdoc-fix-x-crate-impl-sized, ↵Guillaume Gomez-11/+24
r=GuillaumeGomez rustdoc: fix cross-crate `impl Sized` & `impl ?Sized` Previously, cross-crate impl-Trait (APIT, RPIT, etc.) that only consists of a single `Sized` bound (modulo outlives-bounds) and ones that are `?Sized` were incorrectly rendered. To give you a taste (before vs. after): ```diff - fn sized(x: impl ) -> impl + fn sized(x: impl Sized) -> impl Sized - fn sized_outlives<'a>(x: impl 'a) -> impl 'a + fn sized_outlives<'a>(x: impl Sized + 'a) -> impl Sized + 'a - fn maybe_sized(x: &impl ) -> &impl + fn maybe_sized(x: &impl ?Sized) -> &impl ?Sized - fn debug_maybe_sized(x: &impl Debug) -> &impl ?Sized + Debug + fn debug_maybe_sized(x: &(impl Debug + ?Sized)) -> &(impl Debug + ?Sized) ``` Moreover, we now surround impl-Trait that has multiple bounds with parentheses if they're the pointee of a reference or raw pointer type. This affects both local and cross-crate docs. The current output isn't correct (rustc would emit the error *ambiguous `+` in a type* if we fed the rendered code back to it). --- Best reviewed commit by commit :) `@rustbot` label A-cross-crate-reexports
2023-07-26rustdoc: fix cross-crate impl-SizedLeón Orell Valerian Liehr-11/+24
2023-07-22fix doc links on `extern crate` itemsLukas Markeffsky-1/+9
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-3/+4
2023-06-28rustdoc: Reduce internal function visibility.Alona Enraght-Moony-1/+1
As suggested in https://github.com/rust-lang/rust/pull/112113/files/1862fcb1df05b116443ad3b27028616a180ffadb#r1211200570.
2023-06-24rustdoc: get rid of extra line when line-wrapping fn decls with empty arg listLeón Orell Valerian Liehr-1/+1
2023-06-22Fix indentation for where clause in rustdoc pagesGuillaume Gomez-5/+12
2023-05-30rustdoc: simplify `clean` by removing `FnRetTy`Michael Howell-21/+18
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-04IAT: Rustdoc integrationLeón Orell Valerian Liehr-11/+35
2023-05-02Make tools happyMichael Goulet-0/+1
2023-04-29fix rustdoc and core testDeadbeef-1/+1
2023-04-10Fix typos in librustdocDaniPopes-2/+2
2023-04-08Auto merge of #109925 - notriddle:notriddle/item-union, r=GuillaumeGomezbors-4/+0
rustdoc: migrate item_union to an Askama template
2023-04-05rustdoc: migrate `item_union` to an Askama templateMichael Howell-4/+0
2023-04-04rustdoc: escape GAT args in more casesLeón Orell Valerian Liehr-16/+15
2023-03-28rustdoc + rustdoc-json support for non_lifetime_bindersMichael Goulet-2/+2
2023-03-20Rollup merge of #109269 - klensy:rdoc-s, r=notriddleMatthias Krüger-1/+1
rustdoc: cleanup some intermediate allocs First commit self contained, second one use `display_fn` for `extra_info_tags`
2023-03-17rustdoc: reduce allocations in `visibility_to_src_with_space`Michael Howell-7/+7
2023-03-16clean up few allocklensy-1/+1
2023-03-15rustdoc: remove `std::` from primitive intra-doc link tooltipsMichael Howell-0/+6
2023-03-11rustdoc: reduce allocs in FnDecl::inner_full_printJacob Hoffman-Andrews-65/+71
Instead of maintaining parallel buffers for both HTML and non-HTML output, follow the idiom from the rest of format.rs that f.alternate() == true means textual output. Also, add an argument to control line wrapping explicitly. This allows the caller to render once with textual output and no line wrapping, to decide whether line wrapping should be applied in the final HTML output. Also, remove some format! and " ".repeat calls, and remove a dependency on calling `String::replace` to switch from newlines to spaces. This coincidentally fixes some minor bugs where the old code was undercounting the number of characters for a declaration in text mode.
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-1/+0
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.