about summary refs log tree commit diff
path: root/src/librustdoc
AgeCommit message (Collapse)AuthorLines
2024-10-07Auto merge of #131235 - ↵bors-25/+25
codemountains:rename-nestedmetaitem-to-metaitemlnner, r=nnethercote Rename `NestedMetaItem` to `MetaItemInner` Fixes #131087 r? `@nnethercote`
2024-10-07Convert `Option<&Lrc<T>>` return types to `Option<&T>`.Nicholas Nethercote-2/+2
It's simpler and more concise.
2024-10-06Rename NestedMetaItem to MetaItemInnercodemountains-25/+25
2024-10-06Handle `librustdoc` cases of `rustc::potential_query_instability` lintismailarilik-112/+111
2024-10-05Auto merge of #129244 - cjgillot:opaque-hir, r=compiler-errorsbors-21/+2
Make opaque types regular HIR nodes Having opaque types as HIR owner introduces all sorts of complications. This PR proposes to make them regular HIR nodes instead. I haven't gone through all the test changes yet, so there may be a few surprises. Many thanks to `@camelid` for the first draft. Fixes https://github.com/rust-lang/rust/issues/129023 Fixes #129099 Fixes #125843 Fixes #119716 Fixes #121422
2024-10-04Rollup merge of #131260 - notriddle:notriddle/disambiguator-error, ↵Jubilee-5/+16
r=GuillaumeGomez rustdoc: cleaner errors on disambiguator/namespace mismatches Resolves https://github.com/rust-lang/rust/pull/131224#pullrequestreview-2348407077 r? `@jyn514`
2024-10-04rm `ItemKind::OpaqueTy`Noah Lev-21/+2
This introduce an additional collection of opaques on HIR, as they can no longer be listed using the free item list.
2024-10-04Rollup merge of #131257 - GuillaumeGomez:fix-list-margins, r=notriddleJubilee-3/+6
[rustdoc] Fix list margins Fixes https://github.com/rust-lang/rust/issues/131106. Fixes #131223. Follow-up of #130933. This PR changes the display as follow: the margin between list items is reduced by half to ensure that they visually still seem part of the same list, while also being bigger than previously which improves display for list items with more than one paragragh. Paragraphs also get they bottom margin reduced to a little bit less than the list items bottom margin for two reasons: 1. The list items keep having the biggest bottom margin which makes it better for coherency. 2. The paragraphs are still visually separated but they don't "overcome" the list. | before | after | |-|-| | ![Screenshot from 2024-10-04 17-58-51](https://github.com/user-attachments/assets/3fdc1472-781e-435d-a0d7-012f43aa8fb8) | ![image](https://github.com/user-attachments/assets/0366313d-416f-4f04-b905-bb16c54f4528) | Can be tested [here](https://rustdoc.crud.net/imperio/fix-list-margins/doc/test_docs/long_list/index.html). r? ``@notriddle``
2024-10-04rustdoc: cleaner errors on disambiguator/namespace mismatchesMichael Howell-5/+16
2024-10-04Fix list marginsGuillaume Gomez-3/+6
2024-10-04Rollup merge of #131034 - Urgau:cfg-true-false, r=nnethercoteGuillaume Gomez-23/+45
Implement RFC3695 Allow boolean literals as cfg predicates This PR implements https://github.com/rust-lang/rfcs/pull/3695: allow boolean literals as cfg predicates, i.e. `cfg(true)` and `cfg(false)`. r? `@nnethercote` *(or anyone with parser knowledge)* cc `@clubby789`
2024-10-04Adjust rustdoc for literal boolean supportUrgau-23/+45
2024-10-03Rollup merge of #131183 - compiler-errors:opaque-ty-origin, r=estebankMatthias Krüger-2/+2
Refactoring to `OpaqueTyOrigin` Pulled out of a larger PR that uses these changes to do cross-crate encoding of opaque origin, so we can use them for edition 2024 migrations. These changes should be self-explanatory on their own, tho 😄
2024-10-03Rollup merge of #130419 - nnethercote:streamline-HirCollector, r=GuillaumeGomezMatthias Krüger-22/+10
Streamline `HirCollector` r? `@GuillaumeGomez`
2024-10-02Use named fields for OpaqueTyOriginMichael Goulet-1/+1
2024-10-02Remove redundant in_trait from hir::TyKind::OpaqueDefMichael Goulet-1/+1
2024-10-01Rollup merge of #130933 - lolbinarycat:rustdoc-li-p, r=GuillaumeGomez,notriddleMatthias Krüger-0/+7
rustdoc: lists items that contain multiple paragraphs are more clear fixes https://github.com/rust-lang/rust/issues/130622 before: ![before](https://github.com/user-attachments/assets/fe54d8ee-8a1a-45fc-9434-2737c5c6f4d5) after: ![after](https://github.com/user-attachments/assets/095be365-1bfc-4001-8664-59bc4125bb05)
2024-10-01Remove usage of `allow(unused)` attribute on `no_run` doctestsGuillaume Gomez-4/+0
2024-10-01Use environment variables instead of command line arguments for merged doctestsGuillaume Gomez-28/+17
2024-10-01Auto merge of #131076 - lukas-code:doc-stab2, r=notriddlebors-64/+107
rustdoc: rewrite stability inheritance as a doc pass Since doc inlining can almost arbitrarily change the module hierarchy, we can't just use the HIR ancestors of an item to compute its effective stability. This PR moves the stability inheritance that I implemented in https://github.com/rust-lang/rust/pull/130798 into a new doc pass `propagate-stability` that runs after doc inlining and uses the post-inlining ancestors of an item to correctly compute its effective stability. fixes https://github.com/rust-lang/rust/issues/131020 r? `@notriddle`
2024-10-01Auto merge of #130587 - coolreader18:field-variant-doclink-disambig, ↵bors-41/+54
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-30rustdoc: rewrite stability inheritance as a passLukas Markeffsky-60/+106
2024-09-30add `stable_since` convenienceLukas Markeffsky-4/+1
2024-09-30Rollup merge of #131023 - clubby789:doc-item-path, r=notriddleMatthias Krüger-5/+9
Copy correct path to clipboard for modules/keywords/primitives Fixes #131021
2024-09-29Auto merge of #131002 - steffahn:rustdoc-long-names-fix, r=notriddlebors-6/+12
In redesigned rustdoc toolbar: Adjust spacings and sizing to improve behavior with over-long names Fixes #130993. Some additional adjustments also fix more issues I’ve noticed such as: * on small screens, opening search made the 3 bottons move down very slightly (because the row with the crate picker got larger, enlarging the whole grid), this is fixed with a `min-height: 60px` on the toolbar * with long names in the “breadcrumps” area, wrapping was very broken * ![Screenshot_20240929_031831](https://github.com/user-attachments/assets/6f46bbb7-004b-4606-bf17-8a6f3289a8f7) * fixed: * ![Screenshot_20240929_035312](https://github.com/user-attachments/assets/4e2f8dd2-043e-4279-b588-0a72c7533f8e) * the left grid area has a minimal width (105px); like before, that leaves about enough space for crate names becoming as short as “all cra…”; to save even more space, there’s support for a little bit of extra squeezing of the buttons * ![Screenshot_20240929_034511](https://github.com/user-attachments/assets/7c6788ee-8ec1-4a38-b341-8d67704f5575) * ![Screenshot_20240929_034525](https://github.com/user-attachments/assets/e141756d-37a9-4205-bc4d-235ddd1c0609) * ![Screenshot_20240929_034535](https://github.com/user-attachments/assets/526447f3-48b6-47aa-8a60-e5b0d4d055f0) I’m really not super good with HTML or CSS stuff at all; there seem to be many magical numbers already, I’ve just used `px` values until things look right, I hope that’s okay 🤷‍♂️ r? `@GuillaumeGomez` cc `@notriddle`
2024-09-29rustdoc-json: `Id(String)` -> `Id(u32)`schvv31n-308/+305
2024-09-29Copy correct path to clipboard for modules/keywords/primitivesclubby789-5/+9
2024-09-29Rollup merge of #130931 - GuillaumeGomez:standalone-crate, r=notriddleMatthias Krüger-39/+42
Rename `standalone` doctest attribute into `standalone_crate` Following [zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/266220-t-rustdoc/topic/Renaming.20code.20block.20.22standalone.22.20attribute.3F) and poll results. r? `@notriddle`
2024-09-29Rename doctest attribute `standalone-crate` into `standalone_crate` for ↵Guillaume Gomez-3/+3
coherency
2024-09-29Rollup merge of #130537 - lolbinarycat:rustdoc-DocVisitor-docs, r=GuillaumeGomezGuillaume Gomez-2/+9
rustdoc: add doc comment to DocVisitor
2024-09-29Adjust spacings and sizing to improve behavior with over-long namesFrank Steffahn-6/+12
2024-09-28rustdoc: add doc comment to DocVisitorbinarycat-2/+9
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-6/+6
2024-09-27Rollup merge of #130826 - fmease:compiler-mv-obj-safe-dyn-compat, ↵Matthias Krüger-1/+1
r=compiler-errors Compiler: Rename "object safe" to "dyn compatible" Completed T-lang FCP: https://github.com/rust-lang/lang-team/issues/286#issuecomment-2338905118. Tracking issue: https://github.com/rust-lang/rust/issues/130852 Excludes `compiler/rustc_codegen_cranelift` (to be filed separately). Includes Stable MIR. Regarding https://github.com/rust-lang/rust/labels/relnotes, I guess I will manually open a https://github.com/rust-lang/rust/labels/relnotes-tracking-issue since this change affects everything (compiler, library, tools, docs, books, everyday language). r? ghost
2024-09-27rustdoc: lists items that contain multiple paragraphs are more clearbinarycat-0/+7
fixes https://github.com/rust-lang/rust/issues/130622
2024-09-27Auto merge of #130857 - lukas-code:no-clones-allowed, r=notriddlebors-44/+42
rustdoc perf: clone `clean::Item` less In https://github.com/rust-lang/rust/pull/130798, I caused a small perf regression for rustdoc (see https://github.com/rust-lang/rust/pull/130807#issuecomment-2373116917), so here is a small improvement to make up for it :smiley_cat:. This change is actually unrelated to the minor perf regression in `Item::stability` and instead fixes a more relevant perf problem that I found while investigating: For certain crates with many impls on type aliases, we unnecessarily cloned large `clean::Item`s multiple times -- now we just borrow them.
2024-09-26Rollup merge of #130706 - GuillaumeGomez:remove-unneeded-jinja-comments, ↵Jubilee-50/+50
r=notriddle [rustdoc] Remove unneeded jinja comments This is a follow-up of https://github.com/rust-lang/rust/pull/130585. Since we now check for the jinja comments we missed, we can now check for the jinja comments which are unneeded. It will make the parsing and therefore the compilation a tiny bit faster (well, if anyone sees a difference haha). The real goal is mostly to have easier to read template files. :wink: r? ``@notriddle``
2024-09-27Remove unneeded jinja comments in templatesGuillaume Gomez-50/+50
2024-09-26rustdoc: consolidate prefers-reduced-motion-gated rulesetszopsicle-6/+4
2024-09-26rustdoc: do not animate when user prefers reduced motionzopsicle-7/+14
This accessibility improvement gates the target flashing and tooltip fade-out behind an inverted prefers-reduced-motion media query.
2024-09-25don't clone `clean::Item` in `TypeImplCollector`Lukas Markeffsky-9/+9
2024-09-25rm higher-ranked lifetimes from `DocVisitor`Lukas Markeffsky-15/+15
This allows the visitor to borrow from the visitees.
2024-09-25de-rc external traitsLukas Markeffsky-21/+19
Don't keep the `external_traits` as shared mutable data between the `DocContext` and `clean::Crate`. Instead, move the data over when necessary. This allows us to get rid of a borrowck hack in the `DocVisitor`.
2024-09-25Compiler: Rename "object safe" to "dyn compatible"León Orell Valerian Liehr-1/+1
2024-09-25Remove `HirCollector::map`.Nicholas Nethercote-12/+4
Because `rustc_middle::hir::map::Map` is a trivial wrapper around `TyCtxt`, and `HirCollector` has a `TyCtxt` field.
2024-09-25Remove `HirCollector::sess`.Nicholas Nethercote-11/+7
It's redundant w.r.t. `HirCollector::tcx`. This removes the unnecessary `'a` lifetime.
2024-09-25Auto merge of #130803 - cuviper:file-buffered, r=joshtriplettbors-4/+4
Add `File` constructors that return files wrapped with a buffer In addition to the light convenience, these are intended to raise visibility that buffering is something you should consider when opening a file, since unbuffered I/O is a common performance footgun to Rust newcomers. ACP: https://github.com/rust-lang/libs-team/issues/446 Tracking Issue: #130804