bootstrap: Fix `./x check bootstrap` by moving `shared_helpers::tests`
Running `./x check bootstrap` currently doesn't work, because it builds the bootstrap shim binaries with `cfg(test)`, and those binaries can't find a `tests` submodule when they include `shared_helpers.rs` via `#[path]`.
This PR fixes that by taking the tests module and moving it to `super::tests::shared_helpers_tests` instead.
(The extra `tests` submodule prevents tidy from complaining about unit tests that aren't in a dedicated tests module.)
---
It would be nice to also run `./x check bootstrap compiletest` in CI, so that this and #134848 don't regress, but I didn't want to bundle that change with this fix.
bootstrap: Consolidate the macros for declaring compiletest test suites
Instead of using a dizzying assortment of different macros to declare these test suite steps, we can mostly just use one `test!` macro with a few optional named arguments.
I'm pretty sure that this doesn't change any behaviour, but please do double-check each of the individual declarations.
Avoid ICE in borrowck
Provide a fallback in `best_blame_constraint` when `find_constraint_paths_between_regions` doesn't have a result. This code is due a rework to avoid the letf-over `unwrap()`, but avoids the ICE caused by the repro.
Fix#133252.
This makes this step take ~25ms on my machine (M3 Max 64GB) for Zed repo instead of ~150ms. Additionally it takes down the time needed for a clean cargo build of ripgrep from ~6.1s to 5.9s.
This change is mostly relevant for crates with multiple large CGUs.
compiletest: Slightly simplify the handling of debugger directive prefixes
The `cdbg-` prefix is not used by any tests in `tests/debuginfo`, and perhaps there never were any tests that used it.
Getting rid of it also lets us get rid of the code for parsing multiple prefixes at the same time, since every debugger now has exactly one prefix.
- librustdoc::clean::clean_lifetime doesn't need a mut doc context
- librustdoc::clean::normalize doesn't need a mut doc context
- move Some() wrapping up into `clean_predicate()`
- simplify nested if in librustdoc::clean::record_extern_fqn()
bootstrap: Allow `./x check compiletest`
Did you know that bootstrap didn't support `./x check compiletest`? Well, now it does!
Manually add `"compiletest"` to your `rust-analyzer.check.overrideCommand` check command to get error/warning integration when modifying compiletest.
bootstrap: drop warning for top-level test suite path check due to false positives
The current top-level test suite directory does not exist warning logic doesn't quite handle the more exotic path suffix matches that test filters seem to accept (e.g. `library/test` can be matched with `--exclude test`), so avoid warning on non-existent top-level test suites for now. To avoid false positives, we probably need to query test `Step`s for their `should_run(exclude_filter)` logic.
This retains the fix for the Windows path handling (unlike #134843).
r? `@onur-ozkan`
Unify fs::copy and io::copy on Linux
Currently, `fs::copy` first tries a regular file copy (via copy_file_range) and then falls back to userspace read/write copying. We should use `io::copy` instead as it tries copy_file_range, sendfile, and splice before falling back to userspace copying. This was discovered here: https://github.com/SUPERCILEX/fuc/issues/40
Perf impact: `fs::copy` will now have two additional statx calls to decide which syscall to use. I wonder if we should get rid of the statx calls and only continue down the next fallback when the relevant syscalls say the FD isn't supported.
This doesn't quite handle the more exotic path suffix matches that test
filters seem to accept (e.g. `library/test` can be matched with
`--exclude test`), so avoid warning on non-existent top-level test
suites for now. A proper fix will need to possibly query test `Step`s
for their exclude logic.