about summary refs log tree commit diff
path: root/src/librustdoc/html/render/mod.rs
AgeCommit message (Collapse)AuthorLines
2025-07-19Fix clippy lints in librustdocGuillaume Gomez-20/+19
2025-07-17Include ErrorGuaranteed in StableSince::Err.Camille GILLOT-1/+1
2025-07-17Improve path segment joining.Nicholas Nethercote-4/+5
There are many places that join path segments with `::` to produce a string. A lot of these use `join("::")`. Many in rustdoc use `join_with_double_colon`, and a few use `.joined("..")`. One in Clippy uses `itertools::join`. A couple of them look for `kw::PathRoot` in the first segment, which can be important. This commit introduces `rustc_ast::join_path_{syms,ident}` to do the joining for everyone. `rustc_ast` is as good a location for these as any, being the earliest-running of the several crates with a `Path` type. Two functions are needed because `Ident` printing is more complex than simple `Symbol` printing. The commit also removes `join_with_double_colon`, and `estimate_item_path_byte_length` with it. There are still a handful of places that join strings with "::" that are unchanged. They are not that important: some of them are in tests, and some of them first split a path around "::" and then rejoin with "::". This fixes one test case where `{{root}}` shows up in an error message.
2025-07-15rustdoc-json: Structured attributesAlona Enraght-Moony-3/+3
Implements https://www.github.com/rust-lang/rust/issues/141358. This has 2 primary benefits: 1. For rustdoc-json consumers, they no longer need to parse strings of attributes, but it's there in a structured and normalized way. 2. For rustc contributors, the output of HIR pretty printing is no longer a versioned thing in the output. People can work on https://github.com/rust-lang/rust/issues/131229 without needing to bump `FORMAT_VERSION`. (Over time, as the attribute refractor continues, I expect we'll add new things to `rustdoc_json_types::Attribute`. But this can be done separately to the rustc changes).
2025-07-13update issue number for `const_trait_impl`Deadbeef-2/+2
2025-07-03Auto merge of #143363 - jdonszelmann:rollup-7cv1kql, r=jdonszelmannbors-1/+1
Rollup of 6 pull requests Successful merges: - rust-lang/rust#134006 (setup typos check in CI) - rust-lang/rust#142876 (Port `#[target_feature]` to new attribute parsing infrastructure) - rust-lang/rust#143038 (avoid suggesting traits from private dependencies) - rust-lang/rust#143083 (Fix rustdoc not correctly showing attributes on re-exports) - rust-lang/rust#143283 (document optional jobs) - rust-lang/rust#143329 (minicore: use core's `diagnostic::on_unimplemented` messages) Failed merges: - rust-lang/rust#143237 (Port `#[no_implicit_prelude]` to the new attribute parsing infrastructure) r? `@ghost` `@rustbot` modify labels: rollup
2025-07-03setup CI and tidy to use typos for spellchecking and fix few typosklensy-1/+1
2025-06-29Lazy-ify some markdown renderingYotam Ofek-19/+16
2025-06-22Port `#[no_mangle]` to new attribute parsing infrastructureJonathan Brouwer-2/+2
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-05-30Auto merge of #141573 - nnethercote:rustdoc-alloc-cleanups, r=camelidbors-6/+6
rustdoc: cleanups relating to allocations These commits generally clean up the code a bit and also reduce allocation rates a bit. r? `@camelid`
2025-05-26Avoid some unnecessary cloning.Nicholas Nethercote-6/+6
2025-05-25Update to new APIGuillaume Gomez-1/+1
2025-05-25Improve codeGuillaume Gomez-6/+4
2025-05-25Tweak attribute rendering depending on wether or not it is a type aliasGuillaume Gomez-1/+21
2025-05-25Split `Item::attributes` method into threeGuillaume Gomez-2/+2
2025-05-20Replace some `unwrap`s with `?`s where possibleYotam Ofek-2/+2
2025-05-20Make some fns return `fmt::Result` to get rid of a few `unwrap`sYotam Ofek-16/+17
2025-05-18Remove rustc_attr_data_structures re-export from rustc_attr_parsingmejrs-1/+1
2025-04-24Make impl item info come before docGuillaume Gomez-11/+15
2025-04-17Rollup merge of #139846 - nnethercote:kw-Empty-rustdoc, r=GuillaumeGomezMatthias Krüger-1/+1
Remove `kw::Empty` uses in rustdoc Helps with #137978. r? ``@GuillaumeGomez``
2025-04-15Avoid using `kw::Empty` for param names in rustdoc.Nicholas Nethercote-1/+1
2025-04-10lazify `render_assoc_items_inner`Yotam Ofek-37/+54
2025-04-10make `doc_impl_item` and `render_default_items` receive `impl fmt::Write`Yotam Ofek-126/+108
2025-04-10make `AllTypes::print` return `impl fmt::Display`Yotam Ofek-29/+34
2025-04-10Rollup merge of #138605 - xizheyin:issue-138567, r=GuillaumeGomezMatthias Krüger-20/+17
Clean up librustdoc::html::render to be better encapsulated Closes #138567
2025-04-09librustdoc: remove IndexItem::new, use previous fields constructorxizheyin-44/+12
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-04-03Update to new rinja version (askama)Guillaume Gomez-1/+1
2025-03-24Clean up librustdoc::html::render to be better encapsulatedxizheyin-32/+61
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-03-23Rollup merge of #138574 - lolbinarycat:rustdoc-deref-24686-v2, r=GuillaumeGomezJacob Pratt-2/+14
rustdoc: be more strict about "Methods from Deref" fixes #137083 fixes #24686 Currently done: * [x] fix `render_assoc_items_inner * [x] fix sidebar logic * [x] port test from https://github.com/rust-lang/rust/pull/137564 * [x] add test for sidebar items Note that this does not yet fix the sidebar logic.
2025-03-22rustdoc: be more strict about "Methods from Deref"binarycat-2/+14
hack: is_doc_subtype_of always returns true for TyAlias it's worth noting that this function is only used in the handling of "Methods from Deref", and we were previously assuming all generic parameters were meaningless, so this is still an improvment from the status quo. this change means that we will have strictly less false positives without adding any new false negitives. Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2025-03-15refactor `notable_traits_button` to use iterator combinators instead of for loopYotam Ofek-21/+11
2025-03-04Adapt `librustdoc` to 2024 edition lifetieme capture rulesYotam Ofek-104/+99
Get rid of the `Captures` hack
2025-03-04`librustdoc`: 2024 edition! 🎊Yotam Ofek-3/+3
2025-02-23return `impl fmt::Display` in more places instead of writing to stringsYotam Ofek-715/+751
2025-02-14librustdoc: lazily format "read more" link in `document_short`Yotam Ofek-6/+15
2025-02-14librustdoc: lazily format list of aliases in `render_impl_summary`Yotam Ofek-6/+6
2025-02-14librustdoc: make `notable_traits_button` formatting lazyYotam Ofek-11/+14
2025-02-14librustdoc: make `assoc_href_attr` formatting lazyYotam Ofek-11/+33
2025-02-12Nuke `Buffer` abstraction from `librustdoc` 💣Yotam Ofek-159/+207
2025-01-30fix(rustdoc): always use a channel when linking to doc.rust-lang.orgAlexis (Poliorcetics) Bourget-2/+2
2025-01-22rustdoc: use std's (unstable) `fmt::from_fn` instead of open-coding itYotam Ofek-15/+14
2025-01-22rustdoc: pass around decoration info by refYotam Ofek-1/+1
2024-12-25Improve rustdoc codeGuillaume Gomez-1/+1
2024-12-20Rollup merge of #134321 - dtolnay:docassocconst, r=fmeaseJacob Pratt-21/+53
Hide `= _` as associated constant value inside impl blocks Closes #134320. ### Before: <img src="https://github.com/user-attachments/assets/19d28811-45d2-4563-9726-f40c6af411c6" width="300">&nbsp;<img src="https://github.com/user-attachments/assets/1ecf8764-97ce-47f0-87fa-3b174d2fc578" width="300"> ### After: <img src="https://github.com/user-attachments/assets/6408c4ca-b1c4-42e4-884b-248833a4865f" width="300">&nbsp;<img src="https://github.com/user-attachments/assets/df2f6981-16f6-409f-8abb-73c0a4a71d6b" width="300"> r? `@fmease`
2024-12-19Rename TyMethodItem -> RequiredMethodItemDavid Tolnay-4/+4
2024-12-19Rename TyAssocTypeItem -> RequiredAssocTypeItemDavid Tolnay-3/+3
2024-12-19Suppress `= _` on associated constants in implsDavid Tolnay-10/+40
2024-12-19Split AssocConstItem into ProvidedAssocConstItem and ImplAssocConstItemDavid Tolnay-3/+5
2024-12-19Rename TyAssocConstItem -> RequiredAssocConstItemDavid Tolnay-3/+3
2024-12-16rename rustc_attr to rustc_attr_parsing and create rustc_attr_data_structuresJonathan Dönszelmann-2/+3