Commit Graph

263574 Commits

Author SHA1 Message Date
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
Guillaume Gomez
03118fa80a Simplify has_main_fn to be a boolean instead of a Option<Span> 2024-08-13 20:14:54 +02:00
Guillaume Gomez
010731d5b6 Add new run-make tests for doctests 2024-08-13 20:14:54 +02:00
Guillaume Gomez
2fd8d1c1ce Add/update rustdoc-ui tests to check new merged doctests 2024-08-13 20:14:54 +02:00
Guillaume Gomez
7ec3cabe17 Correctly handle doctests with invalid AST 2024-08-13 20:14:54 +02:00
Guillaume Gomez
59a9e0986d Correctly handle the case where there is no doctests to run 2024-08-13 20:14:54 +02:00
Guillaume Gomez
a0ae8ac861 If there is any AST error with a doctest, we make it a standalone test
To do so, AST error detection was improved in order to not filter out
too many doctests.
2024-08-13 20:14:54 +02:00
Guillaume Gomez
b7079c5c83 Prevent merged doctests to break stdin if the generated file is too big 2024-08-13 20:14:53 +02:00
Guillaume Gomez
23badff4fe Add documentation for the doctest standalone attribute 2024-08-13 20:14:53 +02:00
Guillaume Gomez
3147520d34 Add new doc codeblock standalone attribute 2024-08-13 20:14:53 +02:00
Guillaume Gomez
58cd70e062 Only merge doctests starting 2024 edition 2024-08-13 20:14:53 +02:00
Guillaume Gomez
6ae3524835 Split doctests into two categories: mergeable ones and standalone ones 2024-08-13 20:14:53 +02:00
Guillaume Gomez
96051f20e2 Split standalone and mergeable doctests 2024-08-13 20:14:53 +02:00
Guillaume Gomez
39f029a852 Split doctests between standalone and mergeable ones 2024-08-13 20:14:53 +02:00
Guillaume Gomez
7d72482431 Simplify doctest tests 2024-08-13 20:14:53 +02:00
Guillaume Gomez
5e244370fe Add DocTest type 2024-08-13 20:14:53 +02:00
Guillaume Gomez
05fbfde17d Clean up rustdoc make_test function code 2024-08-13 20:14:52 +02:00
Michael Howell
c6fb0f344e diagnostics: use DeepRejectCtxt for check
This makes more things match, particularly applicable blankets.
2024-08-13 10:01:13 -07:00
Jakub Beránek
87a4c325d2 Fix target triple in bootstrap 2024-08-13 18:08:30 +02:00
bors
f96e296927 Auto merge of #17880 - lnicola:sync-from-rust, r=lnicola
minor: sync from downstream
2024-08-13 15:01:50 +00:00
Laurențiu Nicola
28af7e0958 Merge from rust-lang/rust 2024-08-13 17:58:52 +03:00
Laurențiu Nicola
ddb8551e03 Preparing for merge from rust-lang/rust 2024-08-13 17:56:37 +03:00
bors
00423bb1d8 Auto merge of #17853 - ShoyuVanilla:min-exhaustive-pat, r=ShoyuVanilla
feat: `min-exhaustive-patterns`

Resolves #17851
2024-08-13 14:18:14 +00:00
Shoyu Vanilla
4ea0db907c Bump rustc_pattern_analysis 2024-08-13 23:15:37 +09:00
Shoyu Vanilla
6911d9f066 Temporarily remove non-working test case 2024-08-13 23:10:55 +09:00
Shoyu Vanilla
20971602d5 feat: `min-exhaustive-patterns 2024-08-13 23:10:55 +09:00
Guillaume Gomez
afbab80681 Update rustdoc-ui test for --generate-link-to-definition option 2024-08-13 15:08:07 +02:00
Guillaume Gomez
d2177d90b0 Emit a warning instead of an error if --generate-link-to-definition is used with other output formats than HTML 2024-08-13 15:07:26 +02:00
Guillaume Gomez
53e87d211c Remove duplicated rustdoc ui test 2024-08-13 15:03:18 +02:00
bors
80eb5a8e91 Auto merge of #129046 - matthiaskrgr:rollup-9x4xgak, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #128643 (Refactor `powerpc64` call ABI handling)
 - #128655 (std: refactor UNIX random data generation)
 - #128745 (Remove unused lifetime parameter from spawn_unchecked)
 - #128841 (bootstrap: don't use rustflags for `--rustc-args`)
 - #128983 (Slightly refactor `TargetSelection` in bootstrap)
 - #129026 (CFI: Move CFI ui tests to cfi directory)
 - #129040 (Fix blessing of rmake tests)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-08-13 11:43:20 +00:00
Zalathar
355f264d32 Remove a confusing comment
The JSON messages parsed by this file are from the _compiler_, not from
libtest.
2024-08-13 20:24:53 +10:00
Zalathar
2a000c8d70 Don't panic on unknown JSON-like output lines
This function is called for both compiler and non-compiler output, so if the
line isn't recognized as JSON from the compiler then just print it as-is.
2024-08-13 20:23:48 +10:00
Matthias Krüger
42f70c240a
Rollup merge of #129040 - Zalathar:bless-rmake, r=jieyouxu
Fix blessing of rmake tests

Fixes #129038.

When running in `--bless` mode, we now set the value of `RUSTC_BLESS_TEST` to the current test's source directory. This allows the diff helper in `run_make_support` to find the original snapshot file in the source directory and bless that, instead of unhelpfully blessing the temporary copy in `build`.

r? `@jieyouxu`
2024-08-13 12:12:25 +02:00
Matthias Krüger
41aa9631ef
Rollup merge of #129026 - rcvalle:rust-cfi-move-cfi-ui-tests-to-cfi-directory, r=compiler-errors
CFI: Move CFI ui tests to cfi directory

Move the CFI ui tests to the cfi directory and removes the cfi prefix from tests file names similarly to how the cfi codegen tests are organized.
2024-08-13 12:12:25 +02:00
Matthias Krüger
9d9c9acc6e
Rollup merge of #128983 - Kobzol:bootstrap-target, r=onur-ozkan
Slightly refactor `TargetSelection` in bootstrap

Mostly a drive-by refactoring of `TargetSelection` to reduce some manual "windows-gnu" detection and also accesses to the `triple` field.

r? `@onur-ozkan`
2024-08-13 12:12:24 +02:00
Matthias Krüger
0643c3b910
Rollup merge of #128841 - lqd:rustc-args, r=onur-ozkan
bootstrap: don't use rustflags for `--rustc-args`

r? `@onur-ozkan`

This is going to require a bit of context.

https://github.com/rust-lang/rust/pull/47558 has added `--rustc-args` to `./x test` to allow passing flags when building `compiletest` tests. It was made specifically because using `RUSTFLAGS` would rebuild the compiler/stdlib, which would in turn require the flag you want to build tests with to successfully bootstrap.

#113178 made the request that it also works for other tests and doctests. This is not trivial to support across the board for `library`/`compiler` unit-tests/doctests and across stages. This issue was closed in #113948 by using `RUSTFLAGS`, seemingly incorrectly since https://github.com/rust-lang/rust/pull/123489 fixed that part to make it work.

Unfortunately #123489/#113948 have regressed the goals of `--rustc-args`:
- now we can't use rustc args that don't bootstrap, to run the UI tests: we can't test incomplete features. The new trait solver doesn't bootstrap, in-progress borrowck/polonius changes don't bootstrap, some other features are similarly incomplete, etc.
- using the flag now rebuilds everything from scratch: stage0 stdlib, stage1 compiler, stage1 stdlib. You don't need to re-do all this to compile UI tests, you only need the latter to run stdlib tests with a new flag, etc. This happens for contributors, but also on CI today. (Not to mention that in doing that it will rebuild things with flags that are not meant to be used, e.g. stdlib cfgs that don't exist in the compiler; or you could also imagine that this silently enables flags that were not meant to be enabled in this way).

Since then, bd71c71ea0 has started using it to test a stdlib feature, relying on the fact that it now rebuilds everything. So #125011 also regressed CI times more than necessary because it rebuilds everything instead of just stage 1 stdlib.

It's not easy for me to know how to properly fix #113178 in bootstrap, but #113948/#123489 are not it since they regress the initial intent. I'd think bootstrap would have to know from the list of test targets that are passed that the `library` or `compiler` paths that are passed could require rebuilding these crates with different rustflags, probably also depending on stages. Therefore I would not be able to fix it, and will just try in this PR to unregress the situation to unblock the initial use-case.

It seems miri now also uses `./x miri --rustc-args` in this incorrect meaning to rebuild the `library` paths they support to run with the new args. I've not made any bootstrap changes related to `./x miri` in this PR, so `--rustc-args` wouldn't work there anymore. I'd assume this would need to use rustflags again but I don't know how to make that work properly in bootstrap, hence opening as draft, so you can tell me how to do that. I assume we don't want to break their use-case again now that it exists, even though there are ways to use `./x test` to do exactly that.

`RUSTFLAGS_NOT_BOOTSTRAP=flag ./x test library/std` is a way to run unit tests with a new flag without rebuilding everything, while with #123489 there is no way anymore to run tests with a flag that doesn't bootstrap.

---
edit: after review, this PR:
- renames `./x test --rustc-args` to `./x test --compiletest-rustc-args` as it only applies there, and cannot use rustflags for this purpose.
- fixes the regression that using these args rebuilt everything from scratch
- speeds up some CI jobs via the above point
- removes `./x miri --rustc-args` as only library tests are supported, needs to rebuild libstd, and `./x miri --compiletest-rustc-args` wouldn't work since compiletests are not supported.
2024-08-13 12:12:23 +02:00
Matthias Krüger
37b956787a
Rollup merge of #128745 - dtolnay:spawnunchecked, r=workingjubilee
Remove unused lifetime parameter from spawn_unchecked

Amanieu caught this when reviewing the stabilization proposal in https://github.com/rust-lang/rust/issues/55132.

The `'a` lifetime here is useless. The signature is asking the caller of `spawn_unchecked` to "give me any lifetime that is shorter than your F's and T's lifetime", which they can always to with no effect, because arbitrarily short lifetimes exist.
2024-08-13 12:12:23 +02:00
Matthias Krüger
c977deb24b
Rollup merge of #128655 - joboet:play_with_the_dice, r=ChrisDenton
std: refactor UNIX random data generation

This PR makes a number of changes to the UNIX randomness implementation:
* Use `io::Error` for centralized error handling
* Move the file-fallback logic out of the `getrandom`-specific module
* Stop redefining the syscalls on macOS and DragonFly, they have appeared in `libc`
* Add a `OnceLock` to cache the random device file descriptor
2024-08-13 12:12:22 +02:00
Matthias Krüger
00d040e50a
Rollup merge of #128643 - beetrees:ppc64-abi-fix, r=bjorn3
Refactor `powerpc64` call ABI handling

As the [specification](https://openpowerfoundation.org/specifications/64bitelfabi/) for the ELFv2 ABI states that returned aggregates are returned like arguments as long as they are at most two doublewords, I've merged the `classify_arg` and `classify_ret` functions to reduce code duplication. The only functional change is to fix #128579: the `classify_ret` function was incorrectly handling aggregates where `bits > 64 && bits < 128`. I've used the aggregate handling implementation from `classify_arg` which doesn't have this issue.

`@awilfox` could you test this on `powerpc64-unknown-linux-musl`? I'm only able to cross-test on `powerpc64-unknown-linux-gnu` and `powerpc64le-unknown-linux-gnu` locally at the moment, and as a tier 3 target `powerpc64-unknown-linux-musl` has zero CI coverage.

Fixes: #128579
2024-08-13 12:12:21 +02:00
Tobias Bucher
811d7dd113 #[deprecated_safe_2024]: Also use the // TODO: hint in the compiler error
This doesn't work for translated compiler error messages.
2024-08-13 11:32:47 +02:00
Tobias Bucher
399ef23d2b Allow to customize // TODO: comment for deprecated safe autofix
Relevant for the deprecation of `CommandExt::before_exit` in #125970.
2024-08-13 11:32:24 +02:00
bors
a2e1d154d5 Auto merge of #128962 - devnexen:fs_get_mode_haiku, r=workingjubilee
std::fs: get_mode implementation for all unix
2024-08-13 09:10:32 +00:00
Jakub Beránek
1c0c2c3ad6 Implement AsRef<Path> for TargetSelection 2024-08-13 10:40:45 +02:00
Jakub Beránek
0cfbfa9532 Create a TargetSelection method for recognizing *-windows-gnu targets 2024-08-13 10:39:35 +02:00
bors
acc2c5d67a Auto merge of #17876 - Veykril:semantics-include-simplify, r=Veykril
internal: Remove unreachable logic for include token mapping

Turns out https://github.com/rust-lang/rust-analyzer/pull/17863 made this obsolete 🎉
2024-08-13 07:48:55 +00:00