Commit Graph

264147 Commits

Author SHA1 Message Date
Weihang Lo 822961f292
Update cargo 2024-08-13 19:05:05 -04:00
Ben Kimock b89d1976d1 Require gdb version on some tests 2024-08-13 18:20:48 -04:00
bors e5b3e68abf Auto merge of #126245 - GuillaumeGomez:doctest-improvement-v2, r=t-rustdoc
Greatly speed up doctests by compiling compatible doctests in one file

Fixes #75341.

Take 2 at https://github.com/rust-lang/rust/pull/123974. It should now be much simpler to review since it's based on https://github.com/rust-lang/rust/pull/125798.

I split the changes as much as possible to make it as easy as possible to review (even though it's a huge lot of code changes...).

The following tests are not included into the combined doctests:
 * `compile_fail`
 * If there are crate attributes (`deny`/`allow`/`warn` are ok)
 * have invalid AST
 * `test_harness`
 * no capture
 * `--show-output` (because the output is nicer without the extra code surrounding it)

Everything else is merged into one file. If this one file fails to compile, we go back to the current strategy: compile each doctest separately.

Because of the `edition` codeblock attribute, I couldn't make them all into one file directly so I grouped them by edition, but it should be pretty anecdotic.

In case the users want a specific doctest to be opted-out from this doctest merge, I added the `standalone` codeblock attribute:

```rust
/// ```rust,standalone
/// // This doctest will be run in its own process!
/// ```
```

Now the interesting part, I ran it on a few crates and here are the results (with `cargo test --doc` to only include doctests):

| crate | nb doctests | before this PR | with this PR |
| - | - | - | - |
| sysinfo | 227 | 4.6s | 1.11s |
| geos | 157 | 3.95s | 0.45s |
| core | 4604 | 54.08s | 13.5s (merged: 0.9s, standalone: 12.6s) |
| std | 1147 | 12s | 3.56s (merged: 2.1s, standalone: 1.46s) |

r? `@camelid`

try-job: x86_64-msvc
try-job: aarch64-apple
2024-08-13 22:10:35 +00:00
Folkert 8419c0956e stabilize `asm_const` 2024-08-13 23:18:31 +02:00
Nadrieril 249a588cad Remove a no-longer-true `assert` 2024-08-13 23:00:42 +02:00
Michael Goulet bac19686a5 Use is_lang_item more 2024-08-13 16:44:53 -04:00
Josh Stone 0a34ce49ce Add and use `IndexVec::append` 2024-08-13 13:40:05 -07:00
Michael Goulet 5df13af56f Use the right type when coercing fn items to pointers 2024-08-13 16:23:20 -04:00
Michael Goulet 850bcbdc2e Test showing previous behavior 2024-08-13 16:23:18 -04:00
Matthias Krüger 24a46c57ae
Rollup merge of #129058 - michaelwoerister:mwback082024, r=jackh726
Add mw back to review rotation
2024-08-13 21:11:15 +02:00
Matthias Krüger c013e2c3df
Rollup merge of #129056 - Kobzol:fix-target-triple, r=onur-ozkan
Fix one usage of target triple in bootstrap

This bug was introduced in https://github.com/rust-lang/rust/pull/128983. In this one case, the `TargetSelection` was also used as `Display` (not just as `Path`), which I did not notice in the original PR. If the target contained a custom file, it would be included in its `Display` formatting, even though only the triple should be used.

Found [here](https://github.com/rust-lang/rust/pull/128983#issuecomment-2286601889).

r? `@onur-ozkan`
2024-08-13 21:11:15 +02:00
Matthias Krüger 5ef33d4c61
Rollup merge of #129050 - GuillaumeGomez:generate-link-to-definition-warning, r=notriddle
Emit a warning instead of an error if `--generate-link-to-definition` is used with other output formats than HTML

Fixes https://github.com/rust-lang/docs.rs/issues/2581.

It's a bit weird to emit an error in this case anyway, a warning is more than enough.

r? ``@notriddle``
2024-08-13 21:11:14 +02:00
Matthias Krüger 65054ed35e
Rollup merge of #129049 - Zalathar:json-like, r=jieyouxu
compiletest: Don't panic on unknown JSON-like output lines

The `json::extract_rendered` function is called for both compiler output and non-compiler output, so it's inappropriate to panic just because a line starting with `{` didn't contain a compiler output message.

It is called from two places: when checking the output of a `ui` test process, and when printing the output of an arbitrary non-passing `ProcRes`. So unfortunately there's currently no easy way to know for sure whether it is seeing compiler output or not. Fortunately, neither call site appears to be relying on this panic; it's just an overzealous internal check.

Fixes #126373.
2024-08-13 21:11:14 +02:00
Matthias Krüger d4f5a89f6e
Rollup merge of #129034 - henryksloan:coroutine-must-use, r=joboet
Add `#[must_use]` attribute to `Coroutine` trait

[Coroutines tracking issue](https://github.com/rust-lang/rust/issues/43122)

Like closures (`FnOnce`, `AsyncFn`, etc.), coroutines are lazy and do nothing unless called (resumed). Closure traits like `FnOnce` have `#[must_use = "closures are lazy and do nothing unless called"]` to catch likely bugs for users of APIs that produce them. This PR adds such a `#[must_use]` attribute to `trait Coroutine`.
2024-08-13 21:11:13 +02:00
Matthias Krüger f68a28d95c
Rollup merge of #127857 - tbu-:pr_deprecated_safe_todo, r=petrochenkov
Allow to customize `// TODO:` comment for deprecated safe autofix

Relevant for the deprecation of `CommandExt::before_exit` in #125970.

Tracking:
- #124866
2024-08-13 21:11:12 +02:00
Matthias Krüger bc9c31df69
Rollup merge of #122884 - mzabaluev:pow-remove-exit-branch, r=Amanieu
Optimize integer `pow` by removing the exit branch

The branch at the end of the `pow` implementations is redundant with multiplication code already present in the loop. By rotating the exit check, this branch can be largely removed, improving code size and reducing instruction cache misses.

Testing on my machine (`x86_64`, 11th Gen Intel Core i5-1135G7 @ 2.40GHz), the `num::int_pow` benchmarks improve by some 40% for the unchecked operations and show some slight improvement for the checked operations as well.
2024-08-13 21:11:12 +02:00
beetrees fe4fa2f1da
Use the `enum2$` Natvis visualiser for repr128 C-style enums 2024-08-13 19:53:21 +01:00
Michael Woerister 5082e25263 Add mw back to review rotation 2024-08-13 20:16:14 +02:00
Guillaume Gomez 05fb8ff4f5 Fix intra-doc link 2024-08-13 20:14:58 +02:00
Guillaume Gomez 1d75f78ea2 Ignore cross compile check for `tests/run-make/doctests-keep-binaries-2024` test 2024-08-13 20:14:57 +02:00
Guillaume Gomez 488614d2dd Update `tests/run-make/doctests-keep-binaries-2024/rmake.rs` test to new run-make API 2024-08-13 20:14:57 +02:00
Guillaume Gomez f1c1c49216 Run fmt 2024-08-13 20:14:57 +02:00
Guillaume Gomez a708d0bc77 Fix commands syntax in rustdoc-ui tests 2024-08-13 20:14:57 +02:00
Guillaume Gomez 903d2db4d2 Only keep "useful" code in `tests/rustdoc-ui/2024-doctests-checks.rs` 2024-08-13 20:14:57 +02:00
Guillaume Gomez 7dcb841de0 Add doctest to ensure that doctests with crate-level attributes are not part of merged doctest 2024-08-13 20:14:57 +02:00
Guillaume Gomez cbf6fe05e7 Add more merged doctests tests 2024-08-13 20:14:57 +02:00
Guillaume Gomez c9f730e223 Improve documentation for internal doctest API 2024-08-13 20:14:57 +02:00
Guillaume Gomez baf8ce83b8 Move `is_multiple_tests` argument into `RunnableDocTest` 2024-08-13 20:14:57 +02:00
Guillaume Gomez ab3d90e037 Unify naming of `DocTest` 2024-08-13 20:14:57 +02:00
Guillaume Gomez 4b1db071d1 Don't special-case if there is only one merged doctest 2024-08-13 20:14:56 +02:00
Guillaume Gomez 72aeffa78c Remove need for `unsafe` code in merged doctests 2024-08-13 20:14:56 +02:00
Guillaume Gomez a3bc2c7478 Improve code readability 2024-08-13 20:14:56 +02:00
Guillaume Gomez 0fbc32ce42 If there are crate attributes, we prevent doctest to be merged with others 2024-08-13 20:14:56 +02:00
Guillaume Gomez ffc18c5cfb Rename `DocTest` into `DocTestBuilder` 2024-08-13 20:14:56 +02:00
Guillaume Gomez 1e1743a379 Reduce merged doctest source code size 2024-08-13 20:14:56 +02:00
Guillaume Gomez d512438435 Run mergeable doctest as part of standalone doctests if there is only one 2024-08-13 20:14:56 +02:00
Guillaume Gomez bfabf1db44 Add documentation on `DocTest` and `RunnableDoctest` structs 2024-08-13 20:14:56 +02:00
Guillaume Gomez 6d552ba446 Improve code by removing unneeded function arguments 2024-08-13 20:14:56 +02:00
Guillaume Gomez 84d9b67dab Add 2024 edition doctests to cover corner cases 2024-08-13 20:14:55 +02:00
Guillaume Gomez 14f80f9e69 Correctly handle macros using `$crate` in merged doctests 2024-08-13 20:14:55 +02:00
Guillaume Gomez 112e44740e Disable merged doctests by default 2024-08-13 20:14:55 +02:00
Guillaume Gomez 0bd2c99ce8 Only show rustdoc doctest compilation output if `nocapture` is used 2024-08-13 20:14:55 +02:00
Guillaume Gomez c5ae545fbd If no argument is provided to merged doctests binary, they will be run in the same process (needed for miri) 2024-08-13 20:14:55 +02:00
Guillaume Gomez ec4d910190 Correctly handle `internal_features` attribute 2024-08-13 20:14:55 +02:00
Guillaume Gomez 475824d811 Mark location doctest as standalone since file information will not work in merged doctest file 2024-08-13 20:14:55 +02:00
Guillaume Gomez 995858eed3 Don't change indent in merged doctests 2024-08-13 20:14:55 +02:00
Guillaume Gomez 0f0681e941 Make merged doctests run in their own process 2024-08-13 20:14:54 +02:00
Guillaume Gomez dcc77b4cbc Fix weird memory allocation failure in merged doctests by storing doctest list into a const 2024-08-13 20:14:54 +02:00
Guillaume Gomez b6831bbdda Don't merge doctests with `#[global_allocator]` 2024-08-13 20:14:54 +02:00
Guillaume Gomez 6eabffbaec Greatly improve handling of doctests attributes, making it possible to merge doctests more efficiently 2024-08-13 20:14:54 +02:00