Commit Graph

677 Commits

Author SHA1 Message Date
Jonathan Brouwer
ff6bd7bedb Rollup merge of #162835 - notriddle:notriddle/parens-bare-url, r=lolbinarycat
rustdoc: account for nested parens and split text events in bare urls lint

Improve the `rustdoc::bare_urls` lint handling of underscores and parenthesis.

This re-does https://github.com/rust-lang/rust/pull/162381, but it has more test cases, and it handles nesting correctly.

r? @lolbinarycat

Fixes https://github.com/rust-lang/rust/issues/162345
2026-09-21 10:16:08 +02:00
Esteban Küber
f1e9e5e4aa When error from local macro, include macro def span
- mention `-Zmacro-backtrace` only for non-local macros
- include span for local macro encompassing error
2026-09-20 04:11:09 +00:00
Michael Howell
a83dd65fd1 Account for URLs with accidental formatting 2026-09-17 01:41:05 -07:00
Michael Howell
459ba37b44 Account for the separator between host and path 2026-09-17 01:32:31 -07:00
Michael Howell
8e4f28735b Account for nested parens in bare urls lint 2026-09-15 19:33:48 -07:00
Michael Howell
01da50fc26 Account for split text events in bare urls lint
Co-authored-by: malezjaa <poreba.kris@gmail.com>
2026-09-15 18:44:09 -07:00
binarycat
711a32b1bd rustdoc: Revert "fix bare urls split text"
This reverts commit d4e6b8f246.

Reverted commit contains incorrect comments,
does not implement all the functionality it claims to,
and lacks test coverage.
2026-09-14 15:33:13 -04:00
bors
9c99d05505 Auto merge of #162517 - khyperia:yeet-type-const, r=BoxyUwU
yeet `type const`



tracking issue: https://github.com/rust-lang/rust/issues/132980

zulip thread context (design decussion of future of gca): [#project-const-generics > talkies at last @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/260443-project-const-generics/topic/talkies.20at.20last/near/620368825)

this PR does two things:

- implement `#[rustc_always_gca]` (bikeshed name thread: [#project-const-generics > #&#91;always_gca&#93; bikeshed](https://rust-lang.zulipchat.com/#narrow/channel/260443-project-const-generics/topic/.23.5Balways_gca.5D.20bikeshed/with/622249110) )
- remove `type const` syntax

it also migrates the test suite to the syntax introduced in https://github.com/rust-lang/rust/pull/162179 i.e. the new way to write `type const` is now `const ITEM: T = core::direct_const_arg!(V);` (ouch my hands, that took a while)

r? @BoxyUwU
2026-09-12 07:18:22 +00:00
Jonathan Brouwer
53b596e487 Rollup merge of #162446 - GuillaumeGomez:rustdoc-ui-should-fail, r=jieyouxu
Prevent `should-fail` to be used in `rustdoc-ui` testsuite

Follow-up of https://github.com/rust-lang/rust/pull/162030 and discussion with @fmease.

There is no reason to use `should-fail` for `rustdoc-ui` (or `rustdoc-html`) testsuite, so let's prevent it.

r? @fmease
2026-09-11 21:15:03 +02:00
khyperia
0c35264566 migrate tests 2026-09-11 17:08:12 +02:00
Guillaume Gomez
c03ff79486 Prevent should-fail to be used in rustdoc-ui testsuite 2026-09-11 14:42:46 +02:00
Jonathan Brouwer
5c8e527d22 Rollup merge of #162099 - mejrs:doc_values, r=JonathanBrouwer
small refactor of doc attribute arguments warnings
2026-09-11 12:45:05 +02:00
Jonathan Brouwer
71a523b7fd Move the expect-item-after-attribute.rs test to the correct directory 2026-09-08 23:04:10 +02:00
Jonathan Brouwer
44d8afc24b Rollup merge of #162386 - JonathanBrouwer:doctest-attribute, r=mejrs
Add a regression test for trailing attributes in doctests

Adds a regression test for https://github.com/rust-lang/rust/issues/162131, https://github.com/rust-lang/rust/issues/162129, https://github.com/rust-lang/rust/issues/162349, and https://github.com/rust-lang/rust/issues/162352

It seems likely this breakage is going to be accepted, so let's add a test in nightly so we can at least track this behavior in the feature
2026-09-07 17:08:12 +02:00
Jonathan Brouwer
e9c8a6d0cb Add more regression tests 2026-09-07 14:06:41 +02:00
Jonathan Brouwer
a158531a5d Add a regression test for trailing attributes in doctests 2026-09-07 12:44:49 +02:00
malezjaa
d4e6b8f246 fix bare urls split text 2026-09-06 20:17:40 +02:00
Jacob Pratt
d6c2a035c4 Rollup merge of #162030 - GuillaumeGomez:forbid-test-rustdoc-html, r=fmease
Prevent `--test` to be used in `rustdoc-html` testsuite

As [promised](https://github.com/rust-lang/rust/pull/162014#issuecomment-5469387848).

CI will fail until https://github.com/rust-lang/rust/pull/162014 is merged though.

r? @fmease
2026-09-05 23:54:24 -04:00
Guillaume Gomez
ad035bc467 Fix tidy errors 2026-09-05 17:24:37 +02:00
Guillaume Gomez
d4f576d07d Fix/move newly failing rustdoc tests 2026-09-05 17:24:32 +02:00
Guillaume Gomez
c7a87d0c15 Limit new rustdoc-ui tests to linux to prevent backtrace paths mismatch 2026-09-02 21:55:28 +02:00
Guillaume Gomez
2de1645660 Fix more ui tests 2026-09-02 12:32:02 +02:00
Guillaume Gomez
09db86657d Add missing rustdoc-ui test output 2026-09-01 21:32:43 +02:00
Guillaume Gomez
5ba810f065 Normalize more rustdoc-ui doctest output 2026-09-01 16:19:00 +02:00
mejrs
797b6c94cc remove deprecated/remove/rustdoc_internal doc attributes from suggestions 2026-09-01 01:09:11 +02:00
Guillaume Gomez
614d9ea42c Fix invalid compile-args ui tests argument 2026-08-31 14:27:35 +02:00
Guillaume Gomez
41258df413 Move more rustdoc-html tests using --test into the right folder 2026-08-31 11:47:23 +02:00
Guillaume Gomez
ce7aa01e65 Rollup merge of #161978 - GuillaumeGomez:cleanup-ui-doctest, r=fmease
Move rustdoc ui doctests into the right testsuite

When working on https://github.com/rust-lang/rust/pull/161944#discussion_r3886415477, I realized that a lot of doctests in `rustdoc-html` testsuite were not in the correct testsuite, so moving them in the right location.

Because you're the one who made me realize it, here goes @fmease (thanks!) :p

r? @fmease
2026-08-29 22:46:04 +02:00
Guillaume Gomez
ceefdc75ad Rollup merge of #161514 - mejrs:move_doc_feature_gating, r=jonathanbrouwer
rework handling of doc attributes on macro calls

 rust-lang/rust#160904 but with the fcw changes removed

r? @JonathanBrouwer
2026-08-29 22:46:01 +02:00
Guillaume Gomez
0feecd60a5 Move rustdoc ui doctests into the right testsuite 2026-08-29 21:34:38 +02:00
mejrs
9529e2dbf3 rework handling of doc attributes on macro calls 2026-08-28 21:33:40 +02:00
qaijuang
0f08915b3e do not load macro metadata for local definitions in rustdoc 2026-08-27 12:53:14 -04:00
qaijuang
a1fb7b3cb8 add test 2026-08-27 12:49:57 -04:00
Yukang
fa36454ef0 Enhance suggestions for unresolved links with typos path 2026-08-25 21:42:16 +08:00
Guillaume Gomez
3e5db1a5d0 Rollup merge of #159583 - GuillaumeGomez:unescaped_pipe_in_table_cell, r=Urgau,notriddle,camelid
Add new `invalid_markdown_table` rustdoc lint

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

r? @Urgau
2026-08-25 00:33:39 +02:00
Guillaume Gomez
e1fdd1e6f9 Rollup merge of #156009 - qaijuang:rustdoc-redundant-explicit-links-url, r=GuillaumeGomez
Check `redundant_explicit_links` against generated URLs

Fixes rust-lang/rust#155458.

`rustdoc::redundant_explicit_links` checked explicit link destinations by resolving both the label and the destination as intra-doc paths. That misses links written as local rustdoc page URLs, such as `struct.B.html`, because those URLs do not appear in `doc_link_resolutions`.

This PR keeps the existing path-resolution check and falls back to comparing the explicit destination with the local href that rustdoc would generate for the resolved label.
2026-08-25 00:33:37 +02:00
qaijuang
1f5e36d905 rustdoc: check redundant explicit links against generated URLs 2026-08-24 15:12:48 -04:00
León Orell Valerian Liehr
a83329a803 rustdoc: Nuke --passes=list 2026-08-24 19:45:28 +02:00
Guillaume Gomez
aeb0d4a35a Update lint to new rustdoc table lint 2026-08-24 16:19:21 +02:00
Michael Howell
df734af6ae rustdoc: clean up some unneeded table lint code
The essential problem is that, with this table:

```text
one |
----|
  a | b | c
  a | b |
  a | b
  a |
```

And this logic:

```rust
let too_many_pipes = divider_count > expected_cells + 1;
```

`expected_cells + 1` winds up as 2, so you get this warning:

```text
error: unused content after last table cell
  --> $DIR/invalid_markdown_table.rs:81:14
   |
LL |     //!   a | b | c
   |              ^^^^^^ this content is discarded

error: unused content after last table cell
  --> $DIR/invalid_markdown_table.rs:83:14
   |
LL |     //!   a | b |
   |              ^^^^ this content is discarded

error: unused content after last table cell
  --> $DIR/invalid_markdown_table.rs:85:14
   |
LL |     //!   a | b
   |              ^^ this content is discarded
```

We really want our warning to give the suggest-escaping flow, like this:

```text
error: table row has too many columns
  --> $DIR/invalid_markdown_table.rs:81:13
   |
LL |     //!   a | b | c
   |             ^ any content after this column divider is discarded
   |
   = help: to escape `|` characters in tables, add a `\` before them like `\|`

error: table row has too many columns
  --> $DIR/invalid_markdown_table.rs:83:13
   |
LL |     //!   a | b |
   |             ^ any content after this column divider is discarded
   |
   = help: to escape `|` characters in tables, add a `\` before them like `\|`

error: unused content after last table cell
  --> $DIR/invalid_markdown_table.rs:85:14
   |
LL |     //!   a | b
   |              ^^ this content is discarded
```

By only scanning the text between the end of the last cell and the row,
instead of doing the entire row, we don't have to re-implement as much
of pulldown-cmark's logic.
2026-08-24 15:37:47 +02:00
Guillaume Gomez
67bfe3ad49 Also warn in case there is content after the last table cell 2026-08-24 15:37:47 +02:00
Guillaume Gomez
fe90bb22b8 Rename lint unescaped_pipe_in_table_cell into invalid_markdown_table 2026-08-24 15:37:45 +02:00
Guillaume Gomez
dbe2c8ec57 Add ui regression test for new rustdoc unescaped_pipe_in_table_cell lint 2026-08-24 15:37:24 +02:00
Josh Stone
a4f8366871 tests/rustdoc-ui: relax the version regex 2026-08-14 16:18:27 -07:00
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