Commit Graph

535 Commits

Author SHA1 Message Date
Guillaume Gomez
27e39c3ac6 Created tests/rustdoc/async subfolder to limit number of files at the top level 2025-05-05 17:49:12 +02:00
Guillaume Gomez
e14e19a67d Created tests/rustdoc/extern subfolder to limit number of files at the top level 2025-05-05 17:49:12 +02:00
Guillaume Gomez
e245c3bc6b Move primitive rustdoc tests into the primitive sub folder 2025-05-05 17:47:18 +02:00
Guillaume Gomez
4b6bc73507 Created tests/rustdoc/enum subfolder to limit number of files at the top level 2025-05-05 17:47:18 +02:00
Guillaume Gomez
fa2b9227a1 Created tests/rustdoc/assoc subfolder to limit number of files at the top level 2025-05-05 17:47:18 +02:00
Guillaume Gomez
b84f4cc39e Created tests/rustdoc/impl subfolder to limit number of files at the top level 2025-05-05 17:47:18 +02:00
Guillaume Gomez
be71d8b24f Created tests/rustdoc/doc-cfg subfolder to limit number of files at the top level 2025-05-05 17:47:18 +02:00
Guillaume Gomez
d1f4a0bcb6 Created tests/rustdoc/macro subfolder to limit number of files at the top level 2025-05-05 17:47:18 +02:00
Guillaume Gomez
eee6c97535 Created tests/rustdoc/private subfolder to limit number of files at the top level 2025-05-05 17:47:18 +02:00
Guillaume Gomez
a00b39961a Move intra-doc tests into the expected subfolder 2025-05-05 17:47:18 +02:00
Guillaume Gomez
9db7de5915 Created tests/rustdoc/jump-to-def subfolder to limit number of files at the top level 2025-05-05 17:47:18 +02:00
Guillaume Gomez
ff971d001d Created tests/rustdoc/auto subfolder to limit number of files at the top level 2025-05-05 17:47:18 +02:00
Guillaume Gomez
b374996ab8 Created tests/rustdoc/anchors subfolder to limit number of files at the top level 2025-05-05 17:47:18 +02:00
Guillaume Gomez
099f730dcf Created tests/rustdoc/source-code-pages subfolder to limit number of files at the top level 2025-05-05 17:47:17 +02:00
Guillaume Gomez
b796179f98 Created tests/rustdoc/reexports subfolder to limit number of files at the top level 2025-05-05 17:47:17 +02:00
Matthias Krüger
610ed826e3 Rollup merge of #137096 - ehuss:stabilize-doctest-xcompile, r=fmease
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-25 00:53:58 +02:00
Matthias Krüger
cbf26629c4 Rollup merge of #139913 - fmease:rustdoc-fix-fn-param-handling, r=GuillaumeGomez
rustdoc/clean: Fix lowering of fn params (fixes correctness & HIR vs. middle parity regressions)

**(0)** PR #136411 aimed to stop rendering unnamed params of fn ptr types as underscores in the common case (e.g., `fn(_: i32)` → `fn(i32)`) to make the rendered output stylistically more conventional.

**(0.a)** However, since the cleaning fn that the PR modified is also used for lowering the HIR params of foreign fns and required assoc fns in traits, it accidentally butchered the rendering of the latter two:

```rs
pub trait Trait { fn assoc_fn(_: i32); } // as well as (Rust 2015 only): fn assoc_fn(i32);
unsafe extern "C" { pub fn foreign_fn(_: i32); }

// Since 1.86 the fns above gets mis-rendered as:
pub fn assoc_fn(: i32) // <-- BUTCHERED
pub unsafe extern "C" fn foreign_fn(: i32) // <-- BUTCHERED
```

**(0.b)** Furthermore, it broke parity with middle cleaning (which includes inlined cross-crate re-exports) re-regressing parts of #44306 I once fixed in PR #103885.

**(1)** Lastly, PR #139035 introduced an ICE triggered by the following input file:

```rs
trait Trait { fn anon(()) {} } // internal error: entered unreachable code
```

---

This PR fixes all of these regressions and in the first commit renames several types and fns to be more ~~correct~~ descriptive and legible.

~~It also refactors `Param.name` to be of type `Option<Symbol>` instead `Symbol` (where `None` ~ `kw::Empty`), so rendering mistakes like that can no longer creep in like that (ignoring tests). CC #137978.~~ Independently done in PR #139846 a day prior.
2025-04-18 05:16:31 +02:00
León Orell Valerian Liehr
82ff0a0e6a rustdoc: Properly clean fn params in all contexts 2025-04-17 08:55:53 +02:00
León Orell Valerian Liehr
9f548e298d Support inlined cross-crate re-exported trait aliases 2025-04-17 02:35:05 +02:00
Pietro Albini
cd371b90e2 replace //@ compile-flags: --edition with //@ edition 2025-04-10 09:56:37 +02:00
Eric Huss
6441701e5c Stabilize --test-runtool and --test-runtool-arg 2025-03-27 19:04:56 -07:00
Eric Huss
ec25e3300b Rename --runtool and --runtool-arg
This renames `--runtool` and `--runtool-arg` to `--test-runtool` and
`--test-runtool-arg` to maintain consistency with other `--test-*`
arguments.
2025-03-27 19:04:56 -07:00
Eric Huss
0340a865b9 Add test for doctest runtool 2025-03-27 19:04:56 -07:00
Guillaume Gomez
123ea25542 Correctly handle line comments in attributes and generate extern crates
outside of wrapping function
2025-03-27 11:18:43 +01:00
binarycat
b46412f6d7 rustdoc: be more strict about "Methods from Deref"
hack: is_doc_subtype_of always returns true for TyAlias

it's worth noting that this function is only used in
the handling of "Methods from Deref", and we were previously
assuming all generic parameters were meaningless,
so this is still an improvment from the status quo.

this change means that we will have strictly less false positives
without adding any new false negitives.

Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
2025-03-22 12:47:05 -05:00
Michael Goulet
e3ac1fa81a Add RTN support to rustdoc 2025-03-15 18:13:27 +00:00
Michael Goulet
00132141c7 Rollup merge of #137764 - compiler-errors:always-applicable-negative-impl, r=lcnr
Ensure that negative auto impls are always applicable

r? lcnr (or reassign if you dont want to review)

https://github.com/rust-lang/rust/issues/68318#issuecomment-2689265030
2025-03-06 12:22:16 -05:00
Michael Goulet
cc5d90cbad Rollup merge of #137534 - xizheyin:issue-137342, r=GuillaumeGomez
[rustdoc] hide item that is not marked as doc(inline) and whose src is doc(hidden)

Part of #137342

![image](https://github.com/user-attachments/assets/68b4649a-a64a-43b2-8a73-6ac92b486e9e)
2025-03-06 12:22:12 -05:00
Michael Goulet
05a80608b3 Make rustdoc tests use always applicable negative auto impls 2025-03-04 18:04:07 +00:00
xizheyin
133705c402 [rustdoc] hide item that is not marked as doc(inline) and whose src is doc(hidden)
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-03-04 01:35:48 +08:00
Yotam Ofek
0881dba5d3 Move "unused_exter_crate" test from rustdoc-ui to rustdoc 2025-02-27 13:22:46 +00:00
León Orell Valerian Liehr
ef539221f6 Rollup merge of #137320 - tapanprakasht:fix-doc-version-stability, r=notriddle
fix(rustdoc): Fixed stability version in rustdoc

Tries to fix https://github.com/rust-lang/rust/issues/137141
Fixed by adding checks glob exports
2025-02-26 04:15:03 +01:00
Ralf Jung
6eea027aa9 remove support for rustc_intrinsic_must_be_overridden from the compiler 2025-02-24 07:53:59 +01:00
Tapan Prakash
afc89a1e02 Fixed tidy error 2025-02-23 22:24:00 +05:30
Tapan Prakash
6fc19785f7 fixed by differentiating glob export 2025-02-23 22:17:18 +05:30
Yotam Ofek
2c1f48970c fix rustdoc test directives that were accidentally ignored
replace "// @" with "//@ ", and fix the tests so they actually pass, after directives are checked
2025-02-16 19:34:50 +00:00
Guillaume Gomez
9e0c8b67e9 Add regression test for source line numbers 2025-02-11 14:29:58 +01:00
Guillaume Gomez
673fd23dff Update rustdoc tests 2025-02-11 14:29:58 +01:00
Matthias Krüger
a8ecb79d19 Rollup merge of #136274 - compiler-errors:sized-wf, r=lcnr
Check Sizedness of return type in WF

Still need to clean this up a bit. This should fix https://github.com/rust-lang/trait-system-refactor-initiative/issues/150.

r? lcnr
2025-02-04 18:49:37 +01:00
bors
8a8b464175 Auto merge of #136525 - matthiaskrgr:rollup-m8kqlek, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #134807 (fix(rustdoc): always use a channel when linking to doc.rust-lang.org)
 - #134814 (Add `kl` and `widekl` target features, and the feature gate)
 - #135836 (bootstrap: only build `crt{begin,end}.o` when compiling to MUSL)
 - #136022 (Port ui/simd tests to use the intrinsic macro)
 - #136309 (set rustc dylib on manually constructed rustc command)
 - #136462 (mir_build: Simplify `lower_pattern_range_endpoint`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-04 06:04:42 +00:00
Matthias Krüger
f8f31faeb7 Rollup merge of #134807 - poliorcetics:ab/push-skpynvsmwkll, r=camelid
fix(rustdoc): always use a channel when linking to doc.rust-lang.org

Closes #131971

I manually checked the resulting links

One issue is that this will create `nightly/...` links in places that formerly linked to stable, is that ok ? (the `slice` and `array` links in the search help notably)
2025-02-04 06:13:57 +01:00
Michael Goulet
36839759ce Add missing lang items in no_core tests in rustdoc 2025-02-04 01:05:31 +00:00
Matthias Krüger
2c6c7f8ef2 Rollup merge of #136411 - dtolnay:fnptr, r=notriddle
Omit argument names from function pointers that do not have argument names

This matches the style used for the vast majority of function pointer types in real-world code, in my experience. Prefixing `_: ` to every argument does not improve clarity.

**Before:**

<img src="https://github.com/user-attachments/assets/f07efa8b-d57e-4897-aa97-40db7d207862">

**After:**

<img src="https://github.com/user-attachments/assets/8405e08b-d6d2-4904-bcc3-a3eb866cecf0">
2025-02-03 21:11:34 +01:00
Ralf Jung
3320e91575 rustc_allowed_through_unstable_modules: require deprecation message 2025-02-02 12:36:12 +01:00
David Tolnay
b866debf3c Omit argument names from function pointers that do not have argument names 2025-02-01 15:04:19 -08:00
David Tolnay
5f447a1ca6 Add test of fn pointer without argument name 2025-02-01 14:36:42 -08:00
Alexis (Poliorcetics) Bourget
a063cf5f1c fix(rustdoc): always use a channel when linking to doc.rust-lang.org 2025-01-30 21:12:50 +01:00
Michael Howell
c17d5689da Direct link 108459 to issues -> pull redirect 2025-01-30 12:09:33 -07:00
Michael Howell
a1a55a2e0a Give 104145, 103463, and 31948 more descriptive names 2025-01-30 12:05:31 -07:00
Michael Howell
eb457da5ca rustdoc: rename issue-\d+.rs tests to have meaningful names 2025-01-29 11:38:15 -07:00