about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/rustdoc.rs
AgeCommit message (Collapse)AuthorLines
2025-08-28Add new `doc(attribute = "...")` attributeGuillaume Gomez-3/+3
2025-08-25use size_hint in attrs_to_doc_fragmentsbinarycat-2/+7
2025-07-22rustc_resolve: get rid of unused rustdoc::span_of_fragments_with_expansionbinarycat-13/+4
This function can cause false negatives if used incorrectly (usually "do any of the doc fragments come from a macro" is the wrong question to ask), and thus it is unused.
2025-07-17Improve path segment joining.Nicholas Nethercote-5/+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-03setup CI and tidy to use typos for spellchecking and fix few typosklensy-1/+1
2025-06-23Improve code and documentationGuillaume Gomez-15/+24
2025-06-23Do not emit `redundant_explicit_links` rustdoc lint if the doc comment comes ↵Guillaume Gomez-32/+50
from expansion
2025-06-21Add AttributeExt::doc_resolution_scopeDavid Tolnay-1/+6
2025-05-31source_span_for_markdown_range: fix utf8 violationbinarycat-2/+22
it is non-trivial to reproduce this bug through rustdoc, which uses this function less than clippy, so the regression test was added as a unit test instead of an integration test.
2025-05-23Rollup merge of #141376 - nnethercote:rename-kw-Empty, r=petrochenkovMatthias Krüger-3/+3
Rename `kw::Empty` as `sym::empty`. Because the empty string is not a keyword. r? `@petrochenkov`
2025-05-22rustdoc: improve diagnostics on raw doc fragmentsbinarycat-4/+47
1. rustdoc::bare_urls doesn't output invalid suggestions if source_span_for_markdown_range fails to find a span 2. source_span_for_markdown_range tries harder to return a span by applying an additional diagnostic fixes https://github.com/rust-lang/rust/issues/135851
2025-05-22Rename `kw::Empty` as `sym::empty`.Nicholas Nethercote-3/+3
Because the empty string is not a keyword.
2025-03-27rustc_resolve: prevent iteration of refids for completenessAugie Fackler-2/+3
This came up in review, and it should help some future author not introduce non-deterministic output here.
2025-03-18rustc_resolve: fix instability in lib.rmeta contentsAugie Fackler-1/+2
rust-lang/rust@23032f31c91f2 accidentally introduced some nondeterminism in the ordering of lib.rmeta files, which we caught in our bazel-based builds only recently due to being further behind than normal. In my testing, this fixes the issue.
2025-02-15rustdoc: improve refdef handling in the unresolved link lintMichael Howell-2/+16
This commit takes advantage of a feature in pulldown-cmark that makes the list of link definitions available to the consuming application. It produces unresolved link warnings for refdefs that aren't used, and can now produce exact spans for the dest even when it has escapes.
2025-01-19Run `clippy --fix` for `unnecessary_map_or` lintYotam Ofek-4/+1
2025-01-12Deny `clippy:;four_forward_slashes` and fix the only occurrenceJosh Triplett-1/+1
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-2/+1
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-12-17Auto merge of #134376 - jdonszelmann:fix-rustdoc-perf, r=jieyouxubors-2/+3
Try to fix perf regression in rustdoc after hir attributes Slight performance regression introduced in #131808 r? `@jieyouxu`
2024-12-16split attributesJonathan Dönszelmann-1/+1
2024-12-16try fix hir-attrs perfJonathan Dönszelmann-2/+3
2024-12-15Add hir::AttributeJonathan Dönszelmann-20/+19
2024-12-15Rename `value` field to `expr` to simplify later commits' diffsOli Scherer-2/+2
2024-12-02Add a helper method for extracting spans from AttrArgsEqOli Scherer-2/+2
2024-12-02Change `AttrArgs::Eq` into a struct variantOli Scherer-1/+1
2024-10-06Handle `librustdoc` cases of `rustc::potential_query_instability` lintismailarilik-3/+3
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-2/+2
2024-09-11Also fix if in elseMichael Goulet-5/+3
2024-09-02chore: Fix typos in 'compiler' (batch 2)Alexander Cyon-1/+1
2024-07-29Reformat `use` declarations.Nicholas Nethercote-2/+3
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
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-06-30rustdoc: update to pulldown-cmark 0.11Michael Howell-5/+9
2024-05-10Remove `#[macro_use] extern crate tracing` from `rustc_resolve`.Nicholas Nethercote-0/+1
Explicit imports are more standard nowadays and easier to read.
2024-04-28Fix the assertion crash from rustdoc document indent widthsyukang-11/+14
2024-03-29rustdoc: point at span in `include_str!`-ed md fileMichael Howell-7/+38
2024-03-15less symbols interner locksklensy-3/+4
2023-12-15NFC don't convert types to identical typesMatthias Krüger-2/+1
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-1/+1
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`. Then I had to remove a few unnecessary parens and muts that were exposed now.
2023-10-13Format all the let chains in compilerMichael Goulet-1/+3
2023-09-08Reuse rustdoc's doc comment handling in ClippyAlex Macleod-1/+88
2023-08-18narrow down the lint trigger constraintKyle Lin-6/+13
2023-08-18fomar filesKyle Lin-1/+8
2023-08-18Still resolving rustdoc resolution panickingKyle Lin-2/+4
2023-08-18Fix resolution cachingKyle Lin-8/+49
2023-04-18rustdoc: fix ICE from rustc_resolve and librustdoc parse divergenceMichael Howell-0/+1
2023-03-31Update doc(primitive) in rustc_resolveGuillaume Gomez-3/+5
2023-03-23rustdoc: Skip doc link resolution for non-exported itemsVadim Petrochenkov-1/+15
2023-03-21rustdoc: Cleanup parent module tracking for doc linksVadim Petrochenkov-8/+10
Keep ids of the documented items themselves, not their parent modules. Parent modules can be retreived from those ids when necessary.
2023-02-22rustdoc: reduce allocations when generating tooltipsMichael Howell-6/+10
An attempt to reduce the perf regression in https://github.com/rust-lang/rust/pull/108052#issuecomment-1430631861
2023-02-19Rollup merge of #108129 - ↵Guillaume Gomez-0/+1
GuillaumeGomez:correctly-handle-links-starting-with-whitespace, r=petrochenkov Correctly handle links starting with whitespace Part of https://github.com/rust-lang/rust/issues/107995. I just got this issue, wrote a fix and then saw the issue. So here's the PR. ^^' r? `@petrochenkov`