about summary refs log tree commit diff
path: root/src/librustdoc/html/markdown.rs
AgeCommit message (Collapse)AuthorLines
2025-09-23Remove `Tooltip::None` variant, use `Option::None`Yotam Ofek-13/+17
2025-09-23Make `render_example_with_highlighting` return an `impl fmt::Display`Yotam Ofek-9/+8
2025-07-19Fix clippy lints in librustdocGuillaume Gomez-2/+2
2025-06-29Lazy-ify some markdown renderingYotam Ofek-18/+13
2025-06-29Don't try to guess how much to pre-allocateYotam Ofek-2/+2
Removing this heuristic doesn't show up as a regression in perf run
2025-06-10Give more information into extracted doctest informationGuillaume Gomez-1/+2
2025-06-07Rollup merge of #140560 - Urgau:test_attr-module-level, r=GuillaumeGomezGuillaume Gomez-1/+0
Allow `#![doc(test(attr(..)))]` everywhere This PR adds the ability to specify [`#![doc(test(attr(..)))]`](https://doc.rust-lang.org/nightly/rustdoc/write-documentation/the-doc-attribute.html#testattr) ~~at module level~~ everywhere in addition to allowing it at crate-root. This is motivated by a recent PR #140323 (by ````@tgross35)```` where we have to duplicate 2 attributes to every single `f16` and `f128` doctests, by allowing `#![doc(test(attr(..)))]` at module level (and everywhere else) we can omit them entirely and just have (in both module): ```rust #![doc(test(attr(feature(cfg_target_has_reliable_f16_f128))))] #![doc(test(attr(expect(internal_features))))] ``` Those new attributes are appended to the one found at crate-root or at a previous module. Those "global" attributes are compatible with merged doctests (they already were before). Given the small addition that this is, I'm proposing to insta-stabilize it, but I can feature-gate it if preferred. Best reviewed commit by commit. r? ````@GuillaumeGomez````
2025-05-30Auto merge of #141573 - nnethercote:rustdoc-alloc-cleanups, r=camelidbors-1/+1
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-1/+1
2025-05-24rustdoc: use descriptive tooltip if doctest is conditionally ignoredbinarycat-2/+4
fixes https://github.com/rust-lang/rust/issues/141092
2025-05-22Collect and use `#![doc(test(attr(..)))]` at module level tooUrgau-1/+0
2025-05-02Create a builder for DocTestBuilder typeGuillaume Gomez-4/+6
2025-05-02Emit a warning if the doctest `main` function will not be runGuillaume Gomez-2/+4
2025-04-25Rollup merge of #137096 - ehuss:stabilize-doctest-xcompile, r=fmeaseMatthias Krüger-22/+8
Stabilize flags for doctest cross compilation This makes the following changes in preparation for supporting doctest cross-compiling in cargo: - Renames `--runtool` and `--runtool-arg` to `--test-runtool` and `--test-runtool-arg` to maintain consistency with other `--test-*` arguments. - Stabilizes the `--test-runtool` and `--test-runtool-arg`. These are needed in order to support cargo's `target.runner` option which specifies a runner to execute a cross-compiled doctest (for example, qemu). - Stabilizes the `--enable-per-target-ignores` flag by removing it and making it unconditionally enabled. This makes it possible to disable a doctest on a per-target basis, which I think will be helpful for rolling out this feature. These changes were suggested in https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/stabilizing.20doctest.20xcompile/near/409281127 The intent is to stabilize the doctest-xcompile feature in cargo. This will help ensure that for projects that do cross-compile testing that their doctests are also covered. Currently there is a somewhat surprising behavior that they are ignored. Closes https://github.com/rust-lang/rust/issues/64245 try-job: x86_64-msvc-1
2025-04-09rustdoc: Enable Markdown extensions when looking for doctestsNoah Lev-1/+1
We should enable these to avoid misinterpreting uses of the extended syntax as code blocks. This happens in practice with multi-paragraph footnotes, as discovered in #139064.
2025-03-28Rollup merge of #138678 - durin42:rmeta-stability, r=fmeaseMatthias Krüger-1/+2
rustc_resolve: fix instability in lib.rmeta contents 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-03-27Remove and stabilize --enable-per-target-ignoresEric Huss-22/+8
This removes the `--enable-per-target-ignores` and enables it unconditionally.
2025-03-27librustdoc: also stabilize iteration order hereAugie Fackler-1/+2
2025-03-25ignore doctests only in specified targetsTakayuki Maeda-4/+5
add necessary lines fix ui test error
2025-03-22Rollup merge of #138535 - yotamofek:pr/rustdoc/lang-string-parse-cleanup, ↵Matthias Krüger-44/+41
r=notriddle Cleanup `LangString::parse` Flatten some `if`s into match patterns Use `str::strip_prefix` instead of `starts_with`+indexing Avoid redundant tests for `extra.is_some()`
2025-03-16Suppress must_use in compiler and toolsMichael Goulet-1/+1
2025-03-15Cleanup `LangString::parse`Yotam Ofek-44/+41
Flatten some `if`s into match patterns Use `str::strip_prefix` instead of `starts_with`+indexing Avoid redundant tests for `extra.is_some()`
2025-03-07Rollup merge of #138107 - yotamofek:pr/rustdoc/clippy, r=GuillaumeGomezMatthias Krüger-1/+1
`librustdoc`: clippy fixes First commit is all machine-generated fixes, next two are some more lints fixed by hand/misc. cleanups Inspired by the redundant `.and_then()` added in https://github.com/rust-lang/rust/pull/137320 , and [this comment](https://github.com/rust-lang/rust/pull/138090#discussion_r1983111856) r? ```@GuillaumeGomez```
2025-03-06`x clippy src/librustdoc --fix`Yotam Ofek-1/+1
2025-03-06`librustdoc`: flatten nested ifsYotam Ofek-8/+7
2025-02-15rustdoc: improve refdef handling in the unresolved link lintMichael Howell-3/+67
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-02-12Rollup merge of #136927 - GuillaumeGomez:add-missing-hashtag-escape, r=notriddleJacob Pratt-3/+5
Correctly escape hashtags when running `invalid_rust_codeblocks` lint Fixes #136899. We forgot to use `map_line` when we wrote this lint. r? ``@notriddle``
2025-02-12Correctly escape hashtags when running `invalid_rust_codeblocks` lintGuillaume Gomez-3/+5
2025-02-12Nuke `Buffer` abstraction from `librustdoc` 💣Yotam Ofek-3/+2
2024-12-25Improve rustdoc codeGuillaume Gomez-3/+3
2024-12-17Fix intra doc links not generated inside footnote definitionsGuillaume Gomez-16/+50
2024-12-05Turn `markdown_split_summary_and_content` into a method of `Markdown`Guillaume Gomez-46/+49
2024-12-05Always display first line of impl blocks even when collapsedGuillaume Gomez-21/+74
2024-12-02Remove static HashSet for default IDs listGuillaume Gomez-60/+56
2024-12-01Store default ID map in a staticGuillaume Gomez-3/+7
2024-12-01Split ID maps in two parts: the constant one and the updated oneGuillaume Gomez-61/+57
2024-12-01Stop cloning `Context` so muchGuillaume Gomez-49/+64
2024-11-28Fix new clippy lintsGuillaume Gomez-18/+15
2024-11-13Fix duplicated footnote IDsGuillaume Gomez-16/+30
2024-10-19rustdoc: Extract footnote logic into it's own module.Alona Enraght-Moony-79/+5
2024-10-16rustdoc: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-1/+1
2024-10-08Auto merge of #131368 - GuillaumeGomez:rustdoc-dead-code, r=notriddlebors-48/+1
[rustdoc] Remove intra-doc links dead code While working on https://github.com/rust-lang/rust/pull/130278, I wondered what `resolve_display_text` was doing. I removed it and ran all rustdoc tests, and nothing failed. Are some intra-doc links tests missing or is it really dead code? Couldn't figure it out. r? `@notriddle`
2024-10-07Remove dead codeGuillaume Gomez-48/+1
2024-10-06Handle `librustdoc` cases of `rustc::potential_query_instability` lintismailarilik-4/+4
2024-09-29Rename doctest attribute `standalone-crate` into `standalone_crate` for ↵Guillaume Gomez-3/+3
coherency
2024-09-28Improve mistyped docblock attribute warning messagesGuillaume Gomez-31/+27
2024-09-28Add warning if `standalone-crate` is mistypedGuillaume Gomez-0/+14
2024-09-28Improve code for codeblock invalid attributesGuillaume Gomez-25/+18
2024-09-28Rename `standalone` doctest attribute into `standalone-crate`Guillaume Gomez-4/+4
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-2/+2