about summary refs log tree commit diff
path: root/src/doc/rustdoc
AgeCommit message (Collapse)AuthorLines
2025-09-27Improve code and fix typoGuillaume Gomez-21/+21
2025-09-27Update book for `doc_cfg` featureGuillaume Gomez-0/+268
2025-09-27Remove `doc_cfg` related content from rustdoc book unstable features chapterGuillaume Gomez-82/+0
2025-09-26Mention `tyalias` in intra-doc link rustdoc book chapterGuillaume Gomez-1/+1
2025-09-25Auto merge of #147037 - matthiaskrgr:rollup-xtgqzuu, r=matthiaskrgrbors-5/+15
Rollup of 8 pull requests Successful merges: - rust-lang/rust#116882 (rustdoc: hide `#[repr]` if it isn't part of the public ABI) - rust-lang/rust#135771 ([rustdoc] Add support for associated items in "jump to def" feature) - rust-lang/rust#141032 (avoid violating `slice::from_raw_parts` safety contract in `Vec::extract_if`) - rust-lang/rust#142401 (Add proper name mangling for pattern types) - rust-lang/rust#146293 (feat: non-panicking `Vec::try_remove`) - rust-lang/rust#146859 (BTreeMap: Don't leak allocators when initializing nodes) - rust-lang/rust#146924 (Add doc for `NonZero*` const creation) - rust-lang/rust#146933 (Make `render_example_with_highlighting` return an `impl fmt::Display`) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-25rustdoc: hide `#[repr(...)]` if it isn't part of the public ABILeón Orell Valerian Liehr-5/+15
2025-09-25rustdoc: Fix documentation for `--doctest-build-arg`León Orell Valerian Liehr-21/+5
2025-08-28Add documentation for `doc(attribute = "...")` attributeGuillaume Gomez-1/+18
2025-08-26Rollup merge of #145596 - lumiscosity:optimize-png-files, r=davidtwcoGuillaume Gomez-0/+0
Losslessly optimize PNG files Losslessly optimizes all of the PNG files in the repo. Done with: ``` oxipng -o max -a -s oxipng -o max --zopfli -a -s ```
2025-08-23Update rustdoc-gui testsGuillaume Gomez-1/+1
2025-08-23Add documentation for `--generate-macro-expansion`Guillaume Gomez-0/+4
2025-08-21Losslessly optimize PNG fileslumiscosity-0/+0
Losslessly optimizes all of the PNG files in the repo. Done with: ``` oxipng -o max -a -s oxipng -o max --zopfli -a -s ```
2025-08-13Add another example for escaped `#` character in doctest in rustdoc bookGuillaume Gomez-0/+14
2025-07-28Support multiple crate versions in --extern-html-root-urlKornel-0/+6
2025-06-29Update the-doc-attribute.md (#1)Eeshvar Das-1/+1
2025-06-11Update extracted-doctest feature documentationGuillaume Gomez-5/+19
2025-06-07Rollup merge of #140560 - Urgau:test_attr-module-level, r=GuillaumeGomezGuillaume Gomez-9/+23
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-24rustdoc book: add argument explanation for `html_playground_url`xizheyin-2/+4
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-05-22Allow `#![doc(test(attr(..)))]` at every levelUrgau-28/+23
2025-05-22Allow `#![doc(test(attr(..)))]` at module level tooUrgau-0/+19
2025-05-12update version placeholdersPietro Albini-1/+1
2025-04-25Rollup merge of #140290 - styvane:patch0001-fix-typo-in-rusdoc-search, ↵Matthias Krüger-1/+1
r=GuillaumeGomez rustdoc: fix typo change from equivelent to equivalent This PR fixes a typo in the search section in `rustdoc` book.
2025-04-25rustdoc: fix typo change from equivelent to equivalentSede Soukossi-1/+1
2025-03-27Try to more clearly specify exactly what the runtool flags doEric Huss-3/+8
2025-03-27Show an example of using multiple ignore attributesEric Huss-0/+9
2025-03-27Remove and stabilize --enable-per-target-ignoresEric Huss-35/+28
This removes the `--enable-per-target-ignores` and enables it unconditionally.
2025-03-27Stabilize --test-runtool and --test-runtool-argEric Huss-19/+17
2025-03-27Rename `--runtool` and `--runtool-arg`Eric Huss-3/+3
This renames `--runtool` and `--runtool-arg` to `--test-runtool` and `--test-runtool-arg` to maintain consistency with other `--test-*` arguments.
2025-02-27Add missing case explanation for doc inlined re-export of doc hidden itemGuillaume Gomez-1/+16
2025-02-21Rollup merge of #132876 - lolbinarycat:rustdoc-document-hidden-items, ↵Matthias Krüger-4/+23
r=GuillaumeGomez rustdoc book: acknowledge --document-hidden-items
2025-02-20rustdoc book: acknowlage --document-hidden-itemsbinarycat-4/+23
2025-02-01rustdoc-book: Clean up section on `--output-format`Alona Enraght-Moony-5/+11
2025-01-29Add documentation for `--output-format=doctest`Guillaume Gomez-0/+64
2025-01-16Treat other items as functions for the purpose of type-based searchbinarycat-1/+13
constants and statics are nullary functions, and struct fields are unary functions. functions (along with methods and trait methods) are prioritized over other items, like fields and constants.
2024-12-29docs: fix typosdxsullivan-1/+1
2024-12-20Add test to ensure passing `--doctest_compilation_args` multiple times workGuillaume Gomez-1/+1
2024-12-20Add explanations on how arguments are splitGuillaume Gomez-0/+19
2024-12-20Add explanations about `--doctest-compilation-args` in rustdoc bookGuillaume Gomez-18/+76
2024-12-17Rollup merge of #134202 - nnethercote:rm-existing_doc_keyword, r=GuillaumeGomezJacob Pratt-1/+1
Remove `rustc::existing_doc_keyword` lint The check doesn't require a lint. r? ``@GuillaumeGomez``
2024-12-17Remove `rustc::existing_doc_keyword` lint.Nicholas Nethercote-1/+1
`CheckAttrVisitor::check_doc_keyword` checks `#[doc(keyword = "..")]` attributes to ensure they are on an empty module, and that the value is a non-empty identifier. The `rustc::existing_doc_keyword` lint checks these attributes to ensure that the value is the name of a keyword. It's silly to have two different checking mechanisms for these attributes. This commit does the following. - Changes `check_doc_keyword` to check that the value is the name of a keyword (avoiding the need for the identifier check, which removes a dependency on `rustc_lexer`). - Removes the lint. - Updates tests accordingly. There is one hack: the `SelfTy` FIXME case used to used to be handled by disabling the lint, but now is handled with a special case in `is_doc_keyword`. That hack will go away if/when the FIXME is fixed. Co-Authored-By: Guillaume Gomez <guillaume1.gomez@gmail.com>
2024-12-13rustdoc-search: update documentation with notes about unboxingMichael Howell-7/+18
2024-11-30Extend documentation for `missing_doc_code_examples` rustdoc lint in the ↵Guillaume Gomez-0/+4
rustdoc book
2024-11-22Stabilize the 2024 editionEric Huss-1/+1
2024-11-18rustdoc book: Move `--test-builder(--wrapper)?` docs to unstable section.Alona Enraght-Moony-29/+33
2024-11-11Auto merge of #127589 - notriddle:notriddle/search-sem-3, r=GuillaumeGomezbors-5/+7
rustdoc-search: simplify rules for generics and type params **Heads up!**: This PR is a follow-up that depends on #124544. It adds 12dc24f46007f82b93ed85614347a42d47580afa, a change to the filtering behavior, and 9900ea48b566656fb12b5fcbd0a1b20aaa96e5ca, a minor ranking tweak. Part of https://github.com/rust-lang/rust-project-goals/issues/112 This PR overturns https://github.com/rust-lang/rust/pull/109802 ## Preview * no results: [`Box<[A]> -> Vec<B>`](http://notriddle.com/rustdoc-html-demo-12/search-sem-3/std/index.html?search=Box%3C%5BA%5D%3E%20-%3E%20Vec%3CB%3E) * results: [`Box<[A]> -> Vec<A>`](http://notriddle.com/rustdoc-html-demo-12/search-sem-3/std/index.html?search=Box%3C%5BA%5D%3E%20-%3E%20Vec%3CA%3E) * [`T -> U`](http://notriddle.com/rustdoc-html-demo-12/search-sem-3/std/index.html?search=T%20-%3E%20U) * [`Cx -> TyCtxt`](http://notriddle.com/rustdoc-html-demo-12/search-sem-3-compiler/rustdoc/index.html?search=Cx%20-%3E%20TyCtxt) ![image](https://github.com/user-attachments/assets/015ae28c-7469-4f7f-be03-157d28d7ec97) ## Description This commit is a response to feedback on the displayed type signatures results, by making generics act stricter. - Order within generics is significant. This means `Vec<Allocator>` now matches only with a true vector of allocators, instead of matching the second type param. It also makes unboxing within generics stricter, so `Result<A, B>` only matches if `B` is in the error type and `A` is in the success type. The top level of the function search is unaffected. - Generics are only "unboxed" if a type is explicitly opted into it. References and tuples are hardcoded to allow unboxing, and Box, Rc, Arc, Option, Result, and Future are opted in with an unstable attribute. Search result unboxing is the process that allows you to search for `i32 -> str` and get back a function with the type signature `&Future<i32> -> Box<str>`. - Instead of ranking by set overlap, it ranks by the number of items in the type signature. This makes it easier to find single type signatures like transmute. ## Find the discussion on * <https://rust-lang.zulipchat.com/#narrow/stream/393423-t-rustdoc.2Fmeetings/topic/meeting.202024-07-08/near/449965149> * <https://github.com/rust-lang/rust/pull/124544#issuecomment-2204272265> * <https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/deciding.20on.20semantics.20of.20generics.20in.20rustdoc.20search>
2024-11-02Rename target triple to target tuple in many places in the compilerNoratrieb-1/+1
This changes the naming to the new naming, used by `--print target-tuple`. It does not change all locations, but many.
2024-10-30rustdoc-search: simplify rules for generics and type paramsMichael Howell-5/+7
This commit is a response to feedback on the displayed type signatures results, by making generics act stricter. Generics are tightened by making order significant. This means `Vec<Allocator>` now matches only with a true vector of allocators, instead of matching the second type param. It also makes unboxing within generics stricter, so `Result<A, B>` only matches if `B` is in the error type and `A` is in the success type. The top level of the function search is unaffected. Find the discussion on: * <https://rust-lang.zulipchat.com/#narrow/stream/393423-t-rustdoc.2Fmeetings/topic/meeting.202024-07-08/near/449965149> * <https://github.com/rust-lang/rust/pull/124544#issuecomment-2204272265> * <https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/deciding.20on.20semantics.20of.20generics.20in.20rustdoc.20search/near/476841363>
2024-10-01Auto merge of #130587 - coolreader18:field-variant-doclink-disambig, ↵bors-2/+2
r=notriddle,jyn514 Add `field@` and `variant@` doc-link disambiguators I'm not sure if this is big enough to need an fcp or not, but this is something I found missing when trying to refer to a field in macro-generated docs, not knowing if a method might be defined as well. Obviously, there are definitely other uses. In the case where it's not disambiguated, methods (and I suppose other associated items in the value namespace) still take priority, which `@jyn514` said was an oversight but I think is probably the desired behavior 99% of the time anyway - shadowing a field with an accessor method is a very common pattern. If fields and methods with the same name started conflicting, it would be a breaking change. Though, to quote them: > jyn: maybe you can break this only if both [the method and the field] are public > jyn: rustc has some future-incompat warning level > jyn: that gets through -A warnings and --cap-lints from cargo That'd be out of scope of this PR, though. Fixes #80283
2024-09-29Rename doctest attribute `standalone-crate` into `standalone_crate` for ↵Guillaume Gomez-2/+2
coherency
2024-09-28Rename `standalone` doctest attribute into `standalone-crate`Guillaume Gomez-2/+2