Commit Graph

633 Commits

Author SHA1 Message Date
Jacob Pratt
584abbca87 Rollup merge of #160288 - mejrs:anon_const_attr_docs, r=GuillaumeGomez
rustdoc: use anonymous constant for primitives/keywords/attribute docs

For context: [#t-rustdoc > hiding fake_item modules. @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/266220-t-rustdoc/topic/hiding.20fake_item.20modules.2E/near/612115954)

r? @GuillaumeGomez

I've rendered the standard library docs and prims/kws/attrs all show up as normal.

However I could not figure out how to run some of the tests, so this may be a bit of CI-debugging for me :(
2026-08-13 18:16:03 -04:00
mejrs
6ef144dcb3 rustdoc: use anonymous constant for primitives/keywords/attribute docs 2026-08-13 14:49:49 +02:00
bors
ba28ff76f3 Auto merge of #161031 - jhpratt:rollup-XTZ644V, r=jhpratt
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#159593 (merge ambiguity errors that blame the same inference variable)
 - rust-lang/rust#160687 (Experiment: Add `core::cmp::smallest` and `core::cmp::largest`)
 - rust-lang/rust#160856 (Replace infers and non-rigid aliases with `Ty/Const::Error` if param env normalization fails)
 - rust-lang/rust#160961 (bootstrap: Overhaul matching of command-line selectors to steps)
 - rust-lang/rust#160975 (Remove target argument from get_proc_macros)
 - rust-lang/rust#161023 (bootstrap: Replace the `exit!` macro with a function `helpers::exit_process`)
 - rust-lang/rust#160932 (Make tidy::Version public)
 - rust-lang/rust#161029 (mailmap: Update my default email)
2026-08-13 10:24:48 +00:00
Jacob Pratt
1f0923d385 Rollup merge of #160856 - adwinwhite:param-env-norm-fail-with-err, r=lcnr
Replace infers and non-rigid aliases with `Ty/Const::Error` if param env normalization fails

Fixes rust-lang/rust#160196
Fixes rust-lang/rust#148630

Previously we use unnormalized param env if we fail to normalize it. This causes problem for places which expect normalized param env, like in lexical region solving.

I also sneak in a one-line change that we resolve regions with normalized param env in param env normalization now.
This fixes ICEs in `polkadot` and `zerocopy` which had non-rigid const aliases in type outlive env before. I can split it into another PR if that's preferred.

r? lcnr
2026-08-13 03:26:28 -04:00
Adwin White
51ef2f2f97 replace infers and non-rigid aliases with Ty/Const::Error 2026-08-13 11:44:34 +08:00
Jacob Pratt
42ef497d00 Rollup merge of #137858 - GuillaumeGomez:unused_footnote_def, r=notriddle
Add new `unused_footnote_definition` rustdoc lint

Follow-up of rust-lang/rust#137803 (where the two first commits come from).

It adds a new lint which checks for unused footnote definitions.

r? @notriddle
2026-08-12 20:17:29 -04:00
Guillaume Gomez
116fdd183a Fix tidy error 2026-08-12 14:59:31 +02:00
Guillaume Gomez
e73699643d Split doc comment so lints are always emitted in the right order 2026-08-12 14:43:00 +02:00
Michael Howell
7253b43d6d Fix backslashes and line breaks in footnote lint 2026-08-12 11:39:31 +02:00
Guillaume Gomez
92dcc5b490 Add extra "broken_footnote" lint ui test 2026-08-12 11:39:31 +02:00
Guillaume Gomez
261a21353e Improve description of new rustdoc lints 2026-08-12 11:39:31 +02:00
Guillaume Gomez
9f30b845d0 Add ui test for new unused_footnote_definition rustdoc lint 2026-08-12 11:39:31 +02:00
Guillaume Gomez
37b8c5389e Add ui test for rustdoc broken_footnote lint 2026-08-12 11:39:31 +02:00
Jacob Pratt
e5ee77d258 Rollup merge of #160878 - dronavallipranav:add-rust-analyzer-cfg, r=Urgau
Add rust_analyzer to check-cfg names

Add rust_analyzer as a known cfg name, set to expect no values
Add test to verify name is recognized and warned on setting a value

Fixes rust-lang/rust#160736

r? @Urgau
2026-08-11 21:18:28 -04:00
Pranav Dronavalli
0166f5056a Add rust_analyzer to check-cfg names 2026-08-10 16:55:50 -05:00
Jonathan Brouwer
db53f9c5a4 Rollup merge of #160500 - bb1yd:same-message-for-crate-and-pathroot, r=mejrs
Fix inaccurate description for crate and pathroot

Same as 8ab9fdff5a/compiler/rustc_resolve/src/diagnostics/impls.rs (L3027-L3035)
2026-08-10 19:02:04 +02:00
Jonathan Brouwer
408fecd121 Rollup merge of #159473 - notriddle:rename-parts-to-dep-meta, r=camelid
Fix, simplify, and document doc meta finalize mode

Follow up https://github.com/rust-lang/rust/pull/159415#discussion_r3605070232

Get rid of the mode where you can finalize the CCI and generate more docs at the same time. It isn't used in Cargo, and probably won't be used elsewhere?

Fixes a bug where the crate index, settings page, and help page aren’t generated at finalize time.

Update documentation.

Move CCI tests to run-make, so that we can test the finalize step’s CLI.
2026-08-05 21:55:45 +02:00
b1yd
26fba41cdb Fix inaccurate description for crate and pathroot 2026-08-05 16:31:12 +08:00
Cole Kauder-McMurrich
569e0bc92b Further minimize regression test for rustdoc ICE 2026-08-01 21:13:46 -04:00
Cole Kauder-McMurrich
ce8f41367b Add regression test for rustdoc ICE when checking if a generic arg can be elided 2026-07-31 19:35:48 -04:00
Jacob Pratt
f0a77d9434 Rollup merge of #159411 - GuillaumeGomez:show-coverage, r=Urgau,aDotInTheVoid
[rustdoc] Correctly handle output options with --show-coverage

Fixes https://github.com/rust-lang/rust/issues/158929.

The `-o` option was ignored with `--show-coverage`. This PR takes it into account and makes it closer to how these options are handled in the rest of rustdoc.

Considering `calculate_doc_coverage` was never really a pass and that I needed `RenderOptions` (for the `-o` option), I moved it out of passes.

r? @camelid
2026-07-29 20:48:14 -04:00
Nicholas Nethercote
51a9794468 Improve consistency of proc macro attribute error messages 2026-07-28 14:56:46 +10:00
Jonathan Brouwer
085f52778e Rollup merge of #159633 - nnethercote:attr-suggestions, r=JonathanBrouwer
Improve workings of attribute suggestions

`AttrItem` span tracking improved in rust-lang/rust#159587, which lets us slightly simplify the workings of attribute suggestions.

r? @JonathanBrouwer
2026-07-26 15:47:14 +02:00
Nicholas Nethercote
00fb38532c Make attribute suggestions work at the level of attr items
Similar to the commit before the last.
2026-07-26 22:25:19 +10:00
Jacob Pratt
3fc9b07570 Rollup merge of #158709 - notriddle:html-lint-interleaving, r=camelid,GuillaumeGomez
rustdoc: warn on improperly interleaved HTML/MD

Enhances the `rustdoc::invalid_html_tags` lint to warn in cases where pulldown-cmark will produce invalid HTML because the Markdown and HTML are improperly nested.

As an extreme example, this code does not do what it looks like it does, and it doesn't produce a warning under current nightly, either:

```markdown
Figure 1: an X
<svg viewBox="0 0 10 10">
<path
    d="M0 10L10 0M10 10L0 0"
    stroke="black"
>
</svg>
```

This pull request makes it warn:

```text
error: unopened HTML tag `svg`
  --> $DIR/invalid-html-tags.rs:285:5
   |
LL | /// <svg viewBox="0 0 10 10">
   |     ---- does not match this unclosed tag
...
LL | /// >
   |     - because the Markdown paragraph is interrupted by this block quote
LL | /// </svg>
   |     ^^^^^^ this unopened tag
```

See also: https://talk.commonmark.org/t/thoughts-on-changing-supported-html-syntax-to-include-the-dangling-closing-angle-bracket/3827
2026-07-26 00:21:40 -04:00
Michael Howell
e03942b6ce rustdoc: no --read-doc-meta-dir and --write-doc-meta-dir at once 2026-07-25 19:06:14 -07:00
Guillaume Gomez
098056ae19 Move rustdoc-ui --show-coverage tests into the coverage folder 2026-07-24 12:09:48 +02:00
Guillaume Gomez
65b6e98a10 Add small message to say where the output was generated 2026-07-24 12:03:08 +02:00
Nicholas Nethercote
c4621ddc66 Improve consistency of "malformed foo attribute input" error messages
Similar to the previous three commits.
2026-07-24 13:01:21 +10:00
uselessgoddess
8a07fcc3f6 fix base_urls with periods 2026-07-18 12:09:58 +03:00
Michael Howell
fe11f5ecfd rustdoc: lint MD in HTML script/style
This is probably not what the user wants:

    error: nested Markdown emphasis in HTML `style` tag
      --> $DIR/invalid-html-tags-correct-script-style.rs:11:16
       |
    LL | /// One <style>*emph*</style>
       |                ^^^^^^ Markdown translates this into HTML, but the browser parses it as CSS
       |
    help: to turn off Markdown parsing, put the tag at the start of the line
       |
    LL ~ /// One
    LL ~ /// <style>*emph*</style>
       |
2026-07-16 13:30:38 -07:00
Jana Dönszelmann
25745ee1f1 fix all tidy annotations 2026-07-13 10:54:53 +02:00
Jonathan Brouwer
ce7f185fd6 Rollup merge of #156618 - notriddle:rustdoc-lint-ignore-cli, r=lolbinarycat
rustdoc: test ignoring rustc lints in CLI

This works, but I couldn't find any tests for it.
2026-07-11 19:05:12 +02:00
Michael Howell
2200ed1c97 Add requested description comment 2026-07-10 21:13:04 -07:00
Jacob Pratt
9e7a9bad54 Rollup merge of #157561 - notriddle:do-not-destroy-function-name, r=lolbinarycat
rustdoc: do not include extra stuff in span

This change prevents our lints from returning a span with stuff in it that isn't actually part of the doc comment. When that happens, it returns `None` instead.

Fixes https://github.com/rust-lang/rust-clippy/issues/16169, since the bug was reported against the `clippy::doc_paragraphs_missing_punctuation` lint but is actually a bug in `source_span_for_markdown_range_inner`.
2026-07-09 20:09:09 -04:00
Michael Howell
015e8af7ec rustdoc: test ignoring rustc lints in CLI 2026-07-09 16:01:47 -07:00
Michael Howell
c9be91c624 Clean up and test paragraph and table warn 2026-07-09 09:53:04 -07:00
Alona Enraght-Moony
d2ee4ca892 rustdoc: Represent --output-format=json coverage and ir differently
`--output-format=json` does a few different things:

- By itself, it emits a JSON representation of a crate's API ("IR
  JSON").
- When used with `--show-coverage`, it prints the doc coverage as JSON,
  instead of an ASCII table ("Coverage JSON").

These two cases need to be handled entirely differently. There's no
overlapping code, they just are called the same way.

By making these separate variants, we don't need to check the
`show_coverage` variable each time we check `is_json`, which makes it
harder to write a bug that checks for IR JSON, and accidentally happens in
coverage JSON too.

Also, as a driveby, improves some instability error messages, and cleans
up their tests, and adds other related tests.
2026-07-07 23:39:12 +00:00
Jacob Pratt
1c4fe1a844 Rollup merge of #158346 - Jamesbarford:fix/auto-trait-impl, r=lcnr
Prevent rustdoc auto-trait ICEs with `-Znext-solver=globally`

- Ensure rustdoc with `-Znext-solver=globally` does not ICE.

r? @lcnr
2026-07-06 22:17:43 -04:00
bors
c4af71034e Auto merge of #158847 - jhpratt:rollup-MkjhKjV, r=jhpratt
Rollup of 24 pull requests

Successful merges:

 - rust-lang/rust#158377 (add `-Zforce-intrinsic-fallback` flag)
 - rust-lang/rust#158642 (Clarify some interning details)
 - rust-lang/rust#158694 (Positive test for closures needing expectations)
 - rust-lang/rust#158743 (Look for cdb location in the registry first)
 - rust-lang/rust#158775 (bootstrap: only encode RUSTFLAGS when a flag contains a space)
 - rust-lang/rust#158782 (Add and use cfg(target_has_threads) to enforce no_thread impl usage)
 - rust-lang/rust#158785 (hook intrinsic-test into aarch64-gnu)
 - rust-lang/rust#158819 (Put `InhabitedPredicate::NotInModule` earlier in disjunction since it can be a lot faster)
 - rust-lang/rust#157734 (Stabilize `local_key_cell_update`)
 - rust-lang/rust#158183 (std: allocate less memory in `current_exe` for OpenBSD)
 - rust-lang/rust#158310 (Remove unexpected usage of Unambig in non-infer variants)
 - rust-lang/rust#158671 (Move tests batch 17)
 - rust-lang/rust#158730 (Update `FIXME(static_mut_refs)` comments)
 - rust-lang/rust#158752 (Reorganize `tests/ui/issues` [18/N])
 - rust-lang/rust#158755 (Use `ThinVec` more in the AST)
 - rust-lang/rust#158757 (Fix incorrect tracking issue for `read_le`/`read_be`)
 - rust-lang/rust#158765 (Fix ICE on non-ident path in `doc(auto_cfg values)`)
 - rust-lang/rust#158771 (library: expand HashSet::extract_if coverage)
 - rust-lang/rust#158772 (rustc-dev-guide subtree update)
 - rust-lang/rust#158776 (fix: emit diagnostic for AVR target without target-cpu)
 - rust-lang/rust#158786 (Add regression test for builtin attr macro values)
 - rust-lang/rust#158810 (Add supplementary information for get_unchecked(mut))
 - rust-lang/rust#158825 (Fix typo)
 - rust-lang/rust#158838 (tidy: Use `empty_alternate = true` for triagebot mention glob check)
2026-07-06 18:54:19 +00:00
James Barford-Evans
84aa27d895 Tests for find_auto_trait_generics_next_solver path 2026-07-06 16:11:03 +01:00
Takayuki Maeda
e7408fbec6 Fix rustdoc ICE on deprecated note in inlined re-export chain
* add regression test for deprecated note on inlined reexport chain
* resolve deprecated-note links from the owning reexport
* add a comment to regression test
2026-07-06 10:10:28 +00:00
Jacob Pratt
2cabed241e Rollup merge of #158765 - TaKO8Ki:fix-doc-auto-cfg-values-non-ident, r=JonathanBrouwer
Fix ICE on non-ident path in `doc(auto_cfg values)`

Fixes rust-lang/rust#158744

`#[doc(auto_cfg(hide(a, values(::b))))]` could ICE while parsing `values(...)` because the malformed nested meta item did not have a single identifier, but the error path still called `unwrap()` on `sub_item.ident()`.
2026-07-06 04:33:18 -04:00
Mark Rousskov
26e35d93dc Add and use cfg(target_has_threads) to enforce no_thread impl usage
The standard library has fallback code for targets without threads
(e.g., using a Cell-based Mutex and similar). Today there's no
enforcement in std that those targets truly don't have threads which
makes that code potentially unsound. This will let us add a
static assertion that the target spec agrees that the target is
non-threaded.
2026-07-05 15:29:08 -04:00
Takayuki Maeda
4c7acb4cf8 add rustdoc-ui regression for non-ident doc auto_cfg values 2026-07-04 14:40:58 +09:00
Michael Howell
cb61eb4f92 rustdoc: add tests for MD/HTML interleaving 2026-07-03 00:08:01 -07:00
Michael Howell
3ffc0fbdd2 rustdoc: warn on improperly interleaved HTML/MD 2026-07-03 00:08:01 -07:00
Michael Howell
162a90c245 Handle block doc comments better 2026-06-26 09:50:53 -07:00
Michael Howell
9438aac0c2 Handle span failure in redundant_explicit_links 2026-06-26 09:50:53 -07:00
Michael Howell
84f289674c rustdoc: do not include extra stuff in span
This change prevents our lints from returning a span with stuff in it
that isn't actually part of the doc comment. When that happens, it
returns `None` instead.
2026-06-26 09:17:52 -07:00