Commit Graph

263452 Commits

Author SHA1 Message Date
许杰友 Jieyou Xu (Joe)
59ad2aec49
Rollup merge of #128828 - lcnr:search-graph-11, r=compiler-errors
`-Znext-solver` caching

This PR has two major changes while also fixing multiple issues found via fuzzing.

The main optimization is the ability to not discard provisional cache entries when popping the highest cycle head the entry depends on. This fixes the hang in Fuchsia with `-Znext-solver=coherence`.

It also bails if the result of a fixpoint iteration is ambiguous, even without reaching a fixpoint. This is necessary to avoid exponential blowup if a coinductive cycle results in ambiguity, e.g. due to unknowable candidates in coherence.

Updating stack entries pretty much exclusively happens lazily now, so `fn check_invariants` ended up being mostly useless and I've removed it. See https://gist.github.com/lcnr/8de338fdb2685581e17727bbfab0622a for the invariants we would be able to assert with it.

For a general overview, see the in-process update of the relevant rustc-dev-guide chapter: https://hackmd.io/1ALkSjKlSCyQG-dVb_PUHw

r? ```@compiler-errors```
2024-08-14 21:43:07 +08:00
许杰友 Jieyou Xu (Joe)
196d256b20
Rollup merge of #128570 - folkertdev:stabilize-asm-const, r=Amanieu
Stabilize `asm_const`

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

reference PR: https://github.com/rust-lang/reference/pull/1556

this will probably require some CI wrangling (and a rebase), so let's get that over with even though the final required PR is not merged yet.

r? `@ghost`
2024-08-14 21:43:07 +08:00
bors
fbce03b195 Auto merge of #129060 - matthiaskrgr:rollup-s72gpif, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #122884 (Optimize integer `pow` by removing the exit branch)
 - #127857 (Allow to customize `// TODO:` comment for deprecated safe autofix)
 - #129034 (Add `#[must_use]` attribute to `Coroutine` trait)
 - #129049 (compiletest: Don't panic on unknown JSON-like output lines)
 - #129050 (Emit a warning instead of an error if `--generate-link-to-definition` is used with other output formats than HTML)
 - #129056 (Fix one usage of target triple in bootstrap)
 - #129058 (Add mw back to review rotation)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-14 06:43:26 +00:00
bors
9859bf27fd Auto merge of #129076 - matthiaskrgr:rollup-rg8mi2x, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #128410 (Migrate `remap-path-prefix-dwarf` `run-make` test to rmake)
 - #128759 (alloc: add ToString specialization for `&&str`)
 - #128873 (Add windows-targets crate to std's sysroot)
 - #129001 (chore(lib): Enhance documentation for core::fmt::Formatter's write_fm…)
 - #129061 (Use `is_lang_item` more)
 - #129062 (Remove a no-longer-true assert)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-14 04:17:13 +00:00
Matthias Krüger
e01d6141a4
Rollup merge of #129062 - Nadrieril:fix-129009, r=compiler-errors
Remove a no-longer-true assert

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

The assert was simply no longer true. I thought my test suite was thorough but I had not noticed these `let`-specific diagnostics codepaths.

r? `@compiler-errors`
2024-08-14 05:05:53 +02:00
Matthias Krüger
cd6852b9ea
Rollup merge of #129061 - compiler-errors:lang-item, r=Urgau
Use `is_lang_item` more

Few places that I missed since introducing `TyCtxt::is_lang_item`.
2024-08-14 05:05:52 +02:00
Matthias Krüger
a4261a0bc0
Rollup merge of #129001 - cblh:fix/128713, r=Noratrieb
chore(lib): Enhance documentation for core::fmt::Formatter's write_fm…

fix: #128713
2024-08-14 05:05:52 +02:00
Matthias Krüger
f4c860a996
Rollup merge of #128873 - ChrisDenton:windows-targets, r=Mark-Simulacrum
Add windows-targets crate to std's sysroot

With this PR, when backtrace is used as a crate from crates.io it will (once updated) use the real [windows-targets](https://crates.io/crates/windows-targets) crate. But when used from std it'll use std's replacement version.

This allows sharing our customized `windows_tagets::link!` macro between std proper and the backtrace crate when used as part of std, ensuring a consistent linking story. This will be especially important once we move to using [`raw-dylib`](https://doc.rust-lang.org/reference/items/external-blocks.html#dylib-versus-raw-dylib) by default.
2024-08-14 05:05:51 +02:00
Matthias Krüger
85180cd365
Rollup merge of #128759 - notriddle:notriddle/spec-to-string, r=workingjubilee,compiler-errors
alloc: add ToString specialization for `&&str`

Fixes #128690
2024-08-14 05:05:51 +02:00
Matthias Krüger
2cb59087db
Rollup merge of #128410 - Oneirical:dwarf-fortestress, r=jieyouxu
Migrate `remap-path-prefix-dwarf` `run-make` test to rmake

Part of #121876 and the associated [Google Summer of Code project](https://blog.rust-lang.org/2024/05/01/gsoc-2024-selected-projects.html).

Possibly my proudest branch name yet.

try-job: aarch64-apple
try-job: armhf-gnu
try-job: test-various
try-job: x86_64-gnu-llvm-18
2024-08-14 05:05:50 +02:00
bors
e9c965df7b Auto merge of #128812 - nnethercote:shrink-TyKind-FnPtr, r=compiler-errors
Shrink `TyKind::FnPtr`.

By splitting the `FnSig` within `TyKind::FnPtr` into `FnSigTys` and `FnHeader`, which can be packed more efficiently. This reduces the size of the hot `TyKind` type from 32 bytes to 24 bytes on 64-bit platforms. This reduces peak memory usage by a few percent on some benchmarks. It also reduces cache misses and page faults similarly, though this doesn't translate to clear cycles or wall-time improvements on CI.

r? `@compiler-errors`
2024-08-14 00:56:53 +00: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
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
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