From 40ba0e84d53f605ccf01836e9c2d27892728ae81 Mon Sep 17 00:00:00 2001
From: Albert Larsan <74931857+albertlarsan68@users.noreply.github.com>
Date: Thu, 5 Jan 2023 09:45:44 +0100
Subject: [PATCH] Change `src/test` to `tests` in source files, fix tidy and
 tests

---
 .github/workflows/ci.yml                      |   4 +-
 .gitignore                                    |   4 +-
 Cargo.toml                                    |   2 +-
 compiler/rustc_ast_lowering/src/expr.rs       |   4 +-
 compiler/rustc_borrowck/src/consumers.rs      |   2 +-
 .../src/diagnostics/conflict_errors.rs        |   2 +-
 .../src/region_infer/opaque_types.rs          |   2 +-
 .../scripts/test_rustc_tests.sh               | 132 +++++++++---------
 compiler/rustc_codegen_gcc/test.sh            |  16 +--
 .../check_consts/post_drop_elaboration.rs     |   2 +-
 .../rustc_hir_analysis/src/astconv/errors.rs  |   2 +-
 compiler/rustc_hir_typeck/src/coercion.rs     |   2 +-
 compiler/rustc_hir_typeck/src/demand.rs       |   2 +-
 compiler/rustc_hir_typeck/src/fallback.rs     |   2 +-
 .../rustc_hir_typeck/src/fn_ctxt/_impl.rs     |   4 +-
 .../src/generator_interior/mod.rs             |   2 +-
 .../rustc_hir_typeck/src/method/confirm.rs    |   2 +-
 compiler/rustc_hir_typeck/src/method/probe.rs |   2 +-
 compiler/rustc_hir_typeck/src/upvar.rs        |   2 +-
 compiler/rustc_infer/src/infer/combine.rs     |   2 +-
 .../src/infer/error_reporting/mod.rs          |   4 +-
 .../src/unreachable_prop.rs                   |   2 +-
 compiler/rustc_privacy/src/lib.rs             |   2 +-
 .../rustc_resolve/src/build_reduced_graph.rs  |   2 +-
 .../src/traits/coherence.rs                   |   2 +-
 .../src/traits/project.rs                     |   2 +-
 .../rustc_trait_selection/src/traits/wf.rs    |   4 +-
 compiler/rustc_ty_utils/src/abi.rs            |   2 +-
 .../sys/unix/process/process_unix/tests.rs    |   2 +-
 rustfmt.toml                                  |   2 +-
 src/bootstrap/README.md                       |   4 +-
 src/bootstrap/builder.rs                      |   6 +-
 src/bootstrap/builder/tests.rs                |   2 +-
 src/bootstrap/compile.rs                      |   2 +-
 src/bootstrap/configure.py                    |   2 +-
 src/bootstrap/flags.rs                        |   8 +-
 src/bootstrap/mk/Makefile.in                  |   4 +-
 src/bootstrap/native.rs                       |   6 +-
 src/bootstrap/setup.rs                        |   2 +-
 src/bootstrap/test.rs                         |  68 ++++-----
 .../dist-i586-gnu-i586-i686-musl/Dockerfile   |   2 +-
 .../host-x86_64/dist-various-1/Dockerfile     |   2 +-
 src/ci/docker/host-x86_64/i686-gnu/Dockerfile |   2 +-
 .../host-x86_64/test-various/Dockerfile       |  12 +-
 .../host-x86_64/x86_64-gnu-debug/Dockerfile   |   2 +-
 .../x86_64-gnu-llvm-13-stage1/Dockerfile      |   2 +-
 .../host-x86_64/x86_64-gnu-llvm-13/Dockerfile |   4 +-
 .../host-x86_64/x86_64-gnu-tools/Dockerfile   |   2 +-
 src/ci/github-actions/ci.yml                  |   4 +-
 src/ci/scripts/should-skip-this.sh            |   2 +-
 src/doc/rustc/src/platform-support/fuchsia.md |   4 +-
 .../src/compiler-flags/codegen-backend.md     |   2 +-
 .../src/language-features/plugin.md           |   2 +-
 src/librustdoc/html/static/css/rustdoc.css    |   2 +-
 src/tools/clippy/tests/ui/crashes/ice-6254.rs |   2 +-
 src/tools/clippy/tests/ui/crashes/ice-6255.rs |   2 +-
 src/tools/clippy/tests/ui/crashes/ice-6256.rs |   2 +-
 src/tools/compiletest/src/common.rs           |   2 +-
 src/tools/compiletest/src/main.rs             |   2 +-
 src/tools/compiletest/src/runtest.rs          |  10 +-
 .../macro_expansion_tests/mbe/meta_syntax.rs  |   2 +-
 .../crates/ide-db/src/generated/lints.rs      |   2 +-
 src/tools/rustdoc-gui/tester.js               |   2 +-
 src/tools/rustfmt/tests/source/issue-2445.rs  |   4 +-
 src/tools/rustfmt/tests/target/issue-2445.rs  |   4 +-
 src/tools/tidy/src/debug_artifacts.rs         |   8 +-
 src/tools/tidy/src/edition.rs                 |   5 +-
 src/tools/tidy/src/error_codes.rs             |   8 +-
 src/tools/tidy/src/features.rs                |  11 +-
 src/tools/tidy/src/main.rs                    |  22 ++-
 src/tools/tidy/src/mir_opt_tests.rs           |   4 +-
 src/tools/tidy/src/style.rs                   |   9 +-
 src/tools/tidy/src/target_specific_tests.rs   |   3 +-
 src/tools/tidy/src/ui_tests.rs                |   8 +-
 src/tools/tidy/src/unit_tests.rs              |   2 +-
 tests/assembly/target-feature-multiple.rs     |   2 +-
 tests/codegen/match-optimized.rs              |   2 +-
 tests/codegen/match-unoptimized.rs            |   2 +-
 tests/codegen/target-feature-overrides.rs     |   2 +-
 tests/mir-opt/remove_never_const.rs           |   2 +-
 tests/pretty/block-comment-wchar.pp           |   2 +-
 tests/pretty/block-comment-wchar.rs           |   2 +-
 .../alloc-no-oom-handling/Makefile            |   2 +-
 tests/run-make-fulldeps/alloc-no-rc/Makefile  |   2 +-
 .../run-make-fulldeps/alloc-no-sync/Makefile  |   2 +-
 .../core-no-fp-fmt-parse/Makefile             |   2 +-
 .../obtain-borrowck/Makefile                  |   2 +-
 .../run-make/coverage/compiletest-ignore-dir  |   2 +-
 tests/run-make/repr128-dwarf/Makefile         |   2 +-
 tests/run-make/static-pie/Makefile            |   2 +-
 tests/run-make/thumb-none-cortex-m/Makefile   |   2 +-
 tests/run-make/thumb-none-qemu/Makefile       |   2 +-
 tests/rustdoc-gui/README.md                   |   6 +-
 tests/rustdoc-ui/cfg-test.rs                  |   2 +-
 tests/rustdoc-ui/check-cfg-test.rs            |   4 +-
 tests/rustdoc-ui/coverage/basic.stdout        |   2 +-
 tests/rustdoc-ui/coverage/empty.stdout        |   2 +-
 tests/rustdoc-ui/coverage/enums.stdout        |   2 +-
 tests/rustdoc-ui/coverage/exotic.stdout       |   2 +-
 tests/rustdoc-ui/coverage/private.stdout      |   2 +-
 tests/rustdoc-ui/coverage/traits.stdout       |   2 +-
 tests/rustdoc-ui/display-output.rs            |   2 +-
 .../rustdoc-ui/doc-comment-multi-line-attr.rs |   2 +-
 .../doc-comment-multi-line-cfg-attr.rs        |   2 +-
 tests/rustdoc-ui/doc-test-doctest-feature.rs  |   2 +-
 tests/rustdoc-ui/doc-test-rustdoc-feature.rs  |   2 +-
 .../doctest-multiline-crate-attribute.rs      |   2 +-
 tests/rustdoc-ui/doctest-output.rs            |   2 +-
 .../rustdoc-ui/failed-doctest-compile-fail.rs |   2 +-
 .../failed-doctest-extra-semicolon-on-item.rs |   2 +-
 .../failed-doctest-missing-codes.rs           |   2 +-
 .../failed-doctest-output-windows.rs          |   2 +-
 tests/rustdoc-ui/failed-doctest-output.rs     |   2 +-
 .../rustdoc-ui/failed-doctest-should-panic.rs |   2 +-
 tests/rustdoc-ui/issue-80992.rs               |   2 +-
 tests/rustdoc-ui/issue-81662-shortness.rs     |   2 +-
 tests/rustdoc-ui/issue-91134.rs               |   2 +-
 tests/rustdoc-ui/no-run-flag.rs               |   2 +-
 tests/rustdoc-ui/nocapture-fail.rs            |   4 +-
 tests/rustdoc-ui/nocapture.rs                 |   2 +-
 tests/rustdoc-ui/run-directory.rs             |   2 +-
 tests/rustdoc-ui/test-no_std.rs               |   2 +-
 tests/rustdoc-ui/test-type.rs                 |   2 +-
 tests/rustdoc-ui/unparseable-doc-test.rs      |   2 +-
 .../homogenous-floats-target-feature-mixup.rs |   2 +-
 .../auxiliary/ver-cfg-rel.rs                  |   2 +-
 tests/ui/crate-loading/crateresolve1.rs       |   2 +-
 tests/ui/error-codes/E0464.rs                 |   2 +-
 tests/ui/error-codes/E0711.rs                 |   2 +-
 .../closure-expected-type/README.md           |   2 +-
 tests/ui/generator/drop-control-flow.rs       |   2 +-
 .../print/generator-print-verbose-1.rs        |   2 +-
 tests/ui/hashmap/hashmap-memory.rs            |   2 +-
 tests/ui/intrinsics/intrinsic-unreachable.rs  |   2 +-
 tests/ui/let-else/let-else-bindings.rs        |   2 +-
 tests/ui/save-analysis/issue-89066.rs         |   2 +-
 triagebot.toml                                |  18 +--
 137 files changed, 315 insertions(+), 311 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 23d3e71424b..82048f800d0 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -342,7 +342,7 @@ jobs:
             os: macos-12-xl
           - name: x86_64-apple-1
             env:
-              SCRIPT: "./x.py --stage 2 test --exclude src/test/ui --exclude src/test/rustdoc --exclude src/test/run-make-fulldeps"
+              SCRIPT: "./x.py --stage 2 test --exclude tests/ui --exclude tests/rustdoc --exclude tests/run-make-fulldeps"
               RUST_CONFIGURE_ARGS: "--build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false"
               RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
               MACOSX_DEPLOYMENT_TARGET: 10.8
@@ -353,7 +353,7 @@ jobs:
             os: macos-12-xl
           - name: x86_64-apple-2
             env:
-              SCRIPT: "./x.py --stage 2 test src/test/ui src/test/rustdoc src/test/run-make-fulldeps"
+              SCRIPT: "./x.py --stage 2 test tests/ui tests/rustdoc tests/run-make-fulldeps"
               RUST_CONFIGURE_ARGS: "--build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false"
               RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
               MACOSX_DEPLOYMENT_TARGET: 10.8
diff --git a/.gitignore b/.gitignore
index 37972532b36..e5ca3e50313 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,7 +26,7 @@ Session.vim
 .valgrindrc
 .cargo
 # Included because it is part of the test case
-!/src/test/run-make/thumb-none-qemu/example/.cargo
+!/tests/run-make/thumb-none-qemu/example/.cargo
 
 ## Configuration
 /config.toml
@@ -74,6 +74,6 @@ package-lock.json
 package.json
 
 ## Rustdoc GUI tests
-src/test/rustdoc-gui/src/**.lock
+tests/rustdoc-gui/src/**.lock
 
 # Before adding new lines, see the comment at the top.
diff --git a/Cargo.toml b/Cargo.toml
index ce08d4edb56..15cbb2659c9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -51,7 +51,7 @@ exclude = [
   "compiler/rustc_codegen_cranelift",
   "compiler/rustc_codegen_gcc",
   "src/bootstrap",
-  "src/test/rustdoc-gui",
+  "tests/rustdoc-gui",
   # HACK(eddyb) This hardcodes the fact that our CI uses `/checkout/obj`.
   "obj",
   # The `x` binary is a thin wrapper that calls `x.py`, which initializes
diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs
index 3634e6e47ce..14f082be9ba 100644
--- a/compiler/rustc_ast_lowering/src/expr.rs
+++ b/compiler/rustc_ast_lowering/src/expr.rs
@@ -689,8 +689,8 @@ impl<'hir> LoweringContext<'_, 'hir> {
         // call (like the identity function), as otherwise type and lifetime
         // inference have a hard time figuring things out.
         // Without this, we would get:
-        // E0720 in src/test/ui/impl-trait/in-trait/default-body-with-rpit.rs
-        // E0700 in src/test/ui/self/self_lifetime-async.rs
+        // E0720 in tests/ui/impl-trait/in-trait/default-body-with-rpit.rs
+        // E0700 in tests/ui/self/self_lifetime-async.rs
 
         // `future::identity_future`:
         let identity_future =
diff --git a/compiler/rustc_borrowck/src/consumers.rs b/compiler/rustc_borrowck/src/consumers.rs
index becc04bbdab..055b281bc2e 100644
--- a/compiler/rustc_borrowck/src/consumers.rs
+++ b/compiler/rustc_borrowck/src/consumers.rs
@@ -25,7 +25,7 @@ pub use super::{
 ///     can, for example, happen when requesting a body of a `const` function
 ///     because they are evaluated during typechecking. The panic can be avoided
 ///     by overriding the `mir_borrowck` query. You can find a complete example
-///     that shows how to do this at `src/test/run-make/obtain-borrowck/`.
+///     that shows how to do this at `tests/run-make/obtain-borrowck/`.
 ///
 /// *   Polonius is highly unstable, so expect regular changes in its signature or other details.
 pub fn get_body_with_borrowck_facts(
diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
index eda5588a4d5..6658ee89ad6 100644
--- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
@@ -1737,7 +1737,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
 
                 /// We check that there's a single level of block nesting to ensure always correct
                 /// suggestions. If we don't, then we only provide a free-form message to avoid
-                /// misleading users in cases like `src/test/ui/nll/borrowed-temporary-error.rs`.
+                /// misleading users in cases like `tests/ui/nll/borrowed-temporary-error.rs`.
                 /// We could expand the analysis to suggest hoising all of the relevant parts of
                 /// the users' code to make the code compile, but that could be too much.
                 struct NestedStatementVisitor {
diff --git a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs
index 4fe14c7af2f..767f9fe39c6 100644
--- a/compiler/rustc_borrowck/src/region_infer/opaque_types.rs
+++ b/compiler/rustc_borrowck/src/region_infer/opaque_types.rs
@@ -262,7 +262,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
             return self.tcx.ty_error();
         }
 
-        // Only check this for TAIT. RPIT already supports `src/test/ui/impl-trait/nested-return-type2.rs`
+        // Only check this for TAIT. RPIT already supports `tests/ui/impl-trait/nested-return-type2.rs`
         // on stable and we'd break that.
         let OpaqueTyOrigin::TyAlias = origin else {
             return definition_ty;
diff --git a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh
index 04ad77ec97e..12ecb8cf4e1 100755
--- a/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh
+++ b/compiler/rustc_codegen_cranelift/scripts/test_rustc_tests.sh
@@ -10,118 +10,118 @@ pushd rust
 
 command -v rg >/dev/null 2>&1 || cargo install ripgrep
 
-rm -r src/test/ui/{extern/,unsized-locals/,lto/,linkage*} || true
-for test in $(rg --files-with-matches "lto|// needs-asm-support|// needs-unwind" src/test/{ui,incremental}); do
+rm -r tests/ui/{extern/,unsized-locals/,lto/,linkage*} || true
+for test in $(rg --files-with-matches "lto|// needs-asm-support|// needs-unwind" tests/{ui,incremental}); do
   rm $test
 done
 
-for test in $(rg -i --files-with-matches "//(\[\w+\])?~[^\|]*\s*ERR|// error-pattern:|// build-fail|// run-fail|-Cllvm-args" src/test/ui); do
+for test in $(rg -i --files-with-matches "//(\[\w+\])?~[^\|]*\s*ERR|// error-pattern:|// build-fail|// run-fail|-Cllvm-args" tests/ui); do
   rm $test
 done
 
-git checkout -- src/test/ui/issues/auxiliary/issue-3136-a.rs # contains //~ERROR, but shouldn't be removed
-git checkout -- src/test/ui/proc-macro/pretty-print-hack/
+git checkout -- tests/ui/issues/auxiliary/issue-3136-a.rs # contains //~ERROR, but shouldn't be removed
+git checkout -- tests/ui/proc-macro/pretty-print-hack/
 
 # missing features
 # ================
 
 # requires stack unwinding
-rm src/test/incremental/change_crate_dep_kind.rs
-rm src/test/incremental/issue-80691-bad-eval-cache.rs # -Cpanic=abort causes abort instead of exit(101)
+rm tests/incremental/change_crate_dep_kind.rs
+rm tests/incremental/issue-80691-bad-eval-cache.rs # -Cpanic=abort causes abort instead of exit(101)
 
 # requires compiling with -Cpanic=unwind
-rm -r src/test/ui/macros/rfc-2011-nicer-assert-messages/
-rm -r src/test/run-make/test-benches
+rm -r tests/ui/macros/rfc-2011-nicer-assert-messages/
+rm -r tests/run-make/test-benches
 
 # vendor intrinsics
-rm src/test/ui/sse2.rs # cpuid not supported, so sse2 not detected
-rm src/test/ui/intrinsics/const-eval-select-x86_64.rs # requires x86_64 vendor intrinsics
-rm src/test/ui/simd/array-type.rs # "Index argument for `simd_insert` is not a constant"
-rm src/test/ui/simd/intrinsic/generic-bitmask-pass.rs # simd_bitmask unimplemented
-rm src/test/ui/simd/intrinsic/generic-as.rs # simd_as unimplemented
-rm src/test/ui/simd/intrinsic/generic-arithmetic-saturating-pass.rs # simd_saturating_add unimplemented
-rm src/test/ui/simd/intrinsic/float-math-pass.rs # simd_fcos unimplemented
-rm src/test/ui/simd/intrinsic/generic-gather-pass.rs # simd_gather unimplemented
-rm src/test/ui/simd/intrinsic/generic-select-pass.rs # simd_select_bitmask unimplemented
-rm src/test/ui/simd/issue-85915-simd-ptrs.rs # simd_gather unimplemented
-rm src/test/ui/simd/issue-89193.rs # simd_gather unimplemented
-rm src/test/ui/simd/simd-bitmask.rs # simd_bitmask unimplemented
+rm tests/ui/sse2.rs # cpuid not supported, so sse2 not detected
+rm tests/ui/intrinsics/const-eval-select-x86_64.rs # requires x86_64 vendor intrinsics
+rm tests/ui/simd/array-type.rs # "Index argument for `simd_insert` is not a constant"
+rm tests/ui/simd/intrinsic/generic-bitmask-pass.rs # simd_bitmask unimplemented
+rm tests/ui/simd/intrinsic/generic-as.rs # simd_as unimplemented
+rm tests/ui/simd/intrinsic/generic-arithmetic-saturating-pass.rs # simd_saturating_add unimplemented
+rm tests/ui/simd/intrinsic/float-math-pass.rs # simd_fcos unimplemented
+rm tests/ui/simd/intrinsic/generic-gather-pass.rs # simd_gather unimplemented
+rm tests/ui/simd/intrinsic/generic-select-pass.rs # simd_select_bitmask unimplemented
+rm tests/ui/simd/issue-85915-simd-ptrs.rs # simd_gather unimplemented
+rm tests/ui/simd/issue-89193.rs # simd_gather unimplemented
+rm tests/ui/simd/simd-bitmask.rs # simd_bitmask unimplemented
 
 # exotic linkages
-rm src/test/ui/issues/issue-33992.rs # unsupported linkages
-rm src/test/incremental/hashes/function_interfaces.rs # same
-rm src/test/incremental/hashes/statics.rs # same
+rm tests/ui/issues/issue-33992.rs # unsupported linkages
+rm tests/incremental/hashes/function_interfaces.rs # same
+rm tests/incremental/hashes/statics.rs # same
 
 # variadic arguments
-rm src/test/ui/abi/mir/mir_codegen_calls_variadic.rs # requires float varargs
-rm src/test/ui/abi/variadic-ffi.rs # requires callee side vararg support
+rm tests/ui/abi/mir/mir_codegen_calls_variadic.rs # requires float varargs
+rm tests/ui/abi/variadic-ffi.rs # requires callee side vararg support
 
 # unsized locals
-rm -r src/test/run-pass-valgrind/unsized-locals
+rm -r tests/run-pass-valgrind/unsized-locals
 
 # misc unimplemented things
-rm src/test/ui/intrinsics/intrinsic-nearby.rs # unimplemented nearbyintf32 and nearbyintf64 intrinsics
-rm src/test/ui/target-feature/missing-plusminus.rs # error not implemented
-rm src/test/ui/fn/dyn-fn-alignment.rs # wants a 256 byte alignment
-rm -r src/test/run-make/emit-named-files # requires full --emit support
-rm src/test/ui/abi/stack-probes.rs # stack probes not yet implemented
-rm src/test/ui/simd/intrinsic/ptr-cast.rs # simd_expose_addr intrinsic unimplemented
-rm -r src/test/run-make/repr128-dwarf # debuginfo test
-rm src/test/codegen-units/item-collection/asm-sym.rs # requires support for sym in asm!()
+rm tests/ui/intrinsics/intrinsic-nearby.rs # unimplemented nearbyintf32 and nearbyintf64 intrinsics
+rm tests/ui/target-feature/missing-plusminus.rs # error not implemented
+rm tests/ui/fn/dyn-fn-alignment.rs # wants a 256 byte alignment
+rm -r tests/run-make/emit-named-files # requires full --emit support
+rm tests/ui/abi/stack-probes.rs # stack probes not yet implemented
+rm tests/ui/simd/intrinsic/ptr-cast.rs # simd_expose_addr intrinsic unimplemented
+rm -r tests/run-make/repr128-dwarf # debuginfo test
+rm tests/codegen-units/item-collection/asm-sym.rs # requires support for sym in asm!()
 
 # optimization tests
 # ==================
-rm src/test/ui/codegen/issue-28950.rs # depends on stack size optimizations
-rm src/test/ui/codegen/init-large-type.rs # same
-rm src/test/ui/issues/issue-40883.rs # same
-rm -r src/test/run-make/fmt-write-bloat/ # tests an optimization
+rm tests/ui/codegen/issue-28950.rs # depends on stack size optimizations
+rm tests/ui/codegen/init-large-type.rs # same
+rm tests/ui/issues/issue-40883.rs # same
+rm -r tests/run-make/fmt-write-bloat/ # tests an optimization
 
 # backend specific tests
 # ======================
-rm src/test/incremental/thinlto/cgu_invalidated_when_import_{added,removed}.rs # requires LLVM
-rm src/test/ui/abi/stack-protector.rs # requires stack protector support
+rm tests/incremental/thinlto/cgu_invalidated_when_import_{added,removed}.rs # requires LLVM
+rm tests/ui/abi/stack-protector.rs # requires stack protector support
 
 # giving different but possibly correct results
 # =============================================
-rm src/test/ui/mir/mir_misc_casts.rs # depends on deduplication of constants
-rm src/test/ui/mir/mir_raw_fat_ptr.rs # same
-rm src/test/ui/consts/issue-33537.rs # same
-rm src/test/ui/layout/valid_range_oob.rs # different ICE message
+rm tests/ui/mir/mir_misc_casts.rs # depends on deduplication of constants
+rm tests/ui/mir/mir_raw_fat_ptr.rs # same
+rm tests/ui/consts/issue-33537.rs # same
+rm tests/ui/layout/valid_range_oob.rs # different ICE message
 
 # doesn't work due to the way the rustc test suite is invoked.
 # should work when using ./x.py test the way it is intended
 # ============================================================
-rm -r src/test/run-make/emit-shared-files # requires the rustdoc executable in dist/bin/
-rm -r src/test/run-make/unstable-flag-required # same
-rm -r src/test/run-make/rustdoc-* # same
-rm -r src/test/run-make/issue-88756-default-output # same
-rm -r src/test/run-make/remap-path-prefix-dwarf # requires llvm-dwarfdump
-rm -r src/test/ui/consts/missing_span_in_backtrace.rs # expects sysroot source to be elsewhere
+rm -r tests/run-make/emit-shared-files # requires the rustdoc executable in dist/bin/
+rm -r tests/run-make/unstable-flag-required # same
+rm -r tests/run-make/rustdoc-* # same
+rm -r tests/run-make/issue-88756-default-output # same
+rm -r tests/run-make/remap-path-prefix-dwarf # requires llvm-dwarfdump
+rm -r tests/ui/consts/missing_span_in_backtrace.rs # expects sysroot source to be elsewhere
 
 # genuine bugs
 # ============
-rm src/test/incremental/spike-neg1.rs # errors out for some reason
-rm src/test/incremental/spike-neg2.rs # same
-rm src/test/ui/issues/issue-74564-if-expr-stack-overflow.rs # gives a stackoverflow before the backend runs
-rm src/test/ui/mir/ssa-analysis-regression-50041.rs # produces ICE
-rm src/test/ui/type-alias-impl-trait/assoc-projection-ice.rs # produces ICE
+rm tests/incremental/spike-neg1.rs # errors out for some reason
+rm tests/incremental/spike-neg2.rs # same
+rm tests/ui/issues/issue-74564-if-expr-stack-overflow.rs # gives a stackoverflow before the backend runs
+rm tests/ui/mir/ssa-analysis-regression-50041.rs # produces ICE
+rm tests/ui/type-alias-impl-trait/assoc-projection-ice.rs # produces ICE
 
-rm src/test/ui/simd/intrinsic/generic-reduction-pass.rs # simd_reduce_add_unordered doesn't accept an accumulator for integer vectors
+rm tests/ui/simd/intrinsic/generic-reduction-pass.rs # simd_reduce_add_unordered doesn't accept an accumulator for integer vectors
 
-rm src/test/ui/runtime/out-of-stack.rs # SIGSEGV instead of SIGABRT for some reason (#1301)
+rm tests/ui/runtime/out-of-stack.rs # SIGSEGV instead of SIGABRT for some reason (#1301)
 
 # bugs in the test suite
 # ======================
-rm src/test/ui/backtrace.rs # TODO warning
-rm src/test/ui/simple_global_asm.rs # TODO add needs-asm-support
-rm src/test/ui/test-attrs/test-type.rs # TODO panic message on stderr. correct stdout
+rm tests/ui/backtrace.rs # TODO warning
+rm tests/ui/simple_global_asm.rs # TODO add needs-asm-support
+rm tests/ui/test-attrs/test-type.rs # TODO panic message on stderr. correct stdout
 # not sure if this is actually a bug in the test suite, but the symbol list shows the function without leading _ for some reason
-rm -r src/test/run-make/native-link-modifier-bundle
-rm src/test/ui/process/nofile-limit.rs # TODO some AArch64 linking issue
-rm src/test/ui/dyn-star/dispatch-on-pin-mut.rs # TODO failed assertion in vtable::get_ptr_and_method_ref
+rm -r tests/run-make/native-link-modifier-bundle
+rm tests/ui/process/nofile-limit.rs # TODO some AArch64 linking issue
+rm tests/ui/dyn-star/dispatch-on-pin-mut.rs # TODO failed assertion in vtable::get_ptr_and_method_ref
 
-rm src/test/ui/stdio-is-blocking.rs # really slow with unoptimized libstd
+rm tests/ui/stdio-is-blocking.rs # really slow with unoptimized libstd
 
 echo "[TEST] rustc test suite"
-RUST_TEST_NOCAPTURE=1 COMPILETEST_FORCE_STAGE0=1 ./x.py test --stage 0 src/test/{codegen-units,run-make,run-pass-valgrind,ui,incremental}
+RUST_TEST_NOCAPTURE=1 COMPILETEST_FORCE_STAGE0=1 ./x.py test --stage 0 tests/{codegen-units,run-make,run-pass-valgrind,ui,incremental}
 popd
diff --git a/compiler/rustc_codegen_gcc/test.sh b/compiler/rustc_codegen_gcc/test.sh
index 8b390f95a4b..c5ffb763673 100755
--- a/compiler/rustc_codegen_gcc/test.sh
+++ b/compiler/rustc_codegen_gcc/test.sh
@@ -253,25 +253,25 @@ rustc = "$HOME/.rustup/toolchains/$rust_toolchain-$TARGET_TRIPLE/bin/rustc"
 EOF
 
     rustc -V | cut -d' ' -f3 | tr -d '('
-    git checkout $(rustc -V | cut -d' ' -f3 | tr -d '(') src/test
+    git checkout $(rustc -V | cut -d' ' -f3 | tr -d '(') tests
 
-    for test in $(rg -i --files-with-matches "//(\[\w+\])?~|// error-pattern:|// build-fail|// run-fail|-Cllvm-args" src/test/ui); do
+    for test in $(rg -i --files-with-matches "//(\[\w+\])?~|// error-pattern:|// build-fail|// run-fail|-Cllvm-args" tests/ui); do
       rm $test
     done
 
-    git checkout -- src/test/ui/issues/auxiliary/issue-3136-a.rs # contains //~ERROR, but shouldn't be removed
+    git checkout -- tests/ui/issues/auxiliary/issue-3136-a.rs # contains //~ERROR, but shouldn't be removed
 
-    rm -r src/test/ui/{abi*,extern/,panic-runtime/,panics/,unsized-locals/,proc-macro/,threads-sendsync/,thinlto/,borrowck/,test*,*lto*.rs} || true
-    for test in $(rg --files-with-matches "catch_unwind|should_panic|thread|lto" src/test/ui); do
+    rm -r tests/ui/{abi*,extern/,panic-runtime/,panics/,unsized-locals/,proc-macro/,threads-sendsync/,thinlto/,borrowck/,test*,*lto*.rs} || true
+    for test in $(rg --files-with-matches "catch_unwind|should_panic|thread|lto" tests/ui); do
       rm $test
     done
-    git checkout src/test/ui/type-alias-impl-trait/auxiliary/cross_crate_ice.rs
-    git checkout src/test/ui/type-alias-impl-trait/auxiliary/cross_crate_ice2.rs
+    git checkout tests/ui/type-alias-impl-trait/auxiliary/cross_crate_ice.rs
+    git checkout tests/ui/type-alias-impl-trait/auxiliary/cross_crate_ice2.rs
 
     RUSTC_ARGS="-Zpanic-abort-tests -Csymbol-mangling-version=v0 -Zcodegen-backend="$(pwd)"/../target/"$CHANNEL"/librustc_codegen_gcc."$dylib_ext" --sysroot "$(pwd)"/../build_sysroot/sysroot -Cpanic=abort"
 
     echo "[TEST] rustc test suite"
-    COMPILETEST_FORCE_STAGE0=1 ./x.py test --run always --stage 0 src/test/ui/ --rustc-args "$RUSTC_ARGS"
+    COMPILETEST_FORCE_STAGE0=1 ./x.py test --run always --stage 0 tests/ui/ --rustc-args "$RUSTC_ARGS"
 }
 
 function clean_ui_tests() {
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/post_drop_elaboration.rs b/compiler/rustc_const_eval/src/transform/check_consts/post_drop_elaboration.rs
index d4570c59889..cf4e875c91f 100644
--- a/compiler/rustc_const_eval/src/transform/check_consts/post_drop_elaboration.rs
+++ b/compiler/rustc_const_eval/src/transform/check_consts/post_drop_elaboration.rs
@@ -95,7 +95,7 @@ impl<'tcx> Visitor<'tcx> for CheckLiveDrops<'_, 'tcx> {
                 }
 
                 // Drop elaboration is not precise enough to accept code like
-                // `src/test/ui/consts/control-flow/drop-pass.rs`; e.g., when an `Option<Vec<T>>` is
+                // `tests/ui/consts/control-flow/drop-pass.rs`; e.g., when an `Option<Vec<T>>` is
                 // initialized with `None` and never changed, it still emits drop glue.
                 // Hence we additionally check the qualifs here to allow more code to pass.
                 if self.qualifs.needs_non_const_drop(self.ccx, dropped_place.local, location) {
diff --git a/compiler/rustc_hir_analysis/src/astconv/errors.rs b/compiler/rustc_hir_analysis/src/astconv/errors.rs
index e6465d641f1..5368dc0735b 100644
--- a/compiler/rustc_hir_analysis/src/astconv/errors.rs
+++ b/compiler/rustc_hir_analysis/src/astconv/errors.rs
@@ -267,7 +267,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
                 // segments, even though `trait_ref.path.segments` is of length `1`. Work
                 // around that bug here, even though it should be fixed elsewhere.
                 // This would otherwise cause an invalid suggestion. For an example, look at
-                // `src/test/ui/issues/issue-28344.rs` where instead of the following:
+                // `tests/ui/issues/issue-28344.rs` where instead of the following:
                 //
                 //   error[E0191]: the value of the associated type `Output`
                 //                 (from trait `std::ops::BitXor`) must be specified
diff --git a/compiler/rustc_hir_typeck/src/coercion.rs b/compiler/rustc_hir_typeck/src/coercion.rs
index 9e91a3f9076..a0e086bc261 100644
--- a/compiler/rustc_hir_typeck/src/coercion.rs
+++ b/compiler/rustc_hir_typeck/src/coercion.rs
@@ -13,7 +13,7 @@
 //! useful for freezing mut things (that is, when the expected type is &T
 //! but you have &mut T) and also for avoiding the linearity
 //! of mut things (when the expected is &mut T and you have &mut T). See
-//! the various `src/test/ui/coerce/*.rs` tests for
+//! the various `tests/ui/coerce/*.rs` tests for
 //! examples of where this is useful.
 //!
 //! ## Subtle note
diff --git a/compiler/rustc_hir_typeck/src/demand.rs b/compiler/rustc_hir_typeck/src/demand.rs
index 33fc7413a67..6c128d0aa1a 100644
--- a/compiler/rustc_hir_typeck/src/demand.rs
+++ b/compiler/rustc_hir_typeck/src/demand.rs
@@ -1855,7 +1855,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         let mut expectation = Some(expected_ty);
         while let hir::ExprKind::MethodCall(_, rcvr, ..) = expr.kind {
             // Getting to the root receiver and asserting it is a fn call let's us ignore cases in
-            // `src/test/ui/methods/issues/issue-90315.stderr`.
+            // `tests/ui/methods/issues/issue-90315.stderr`.
             expr = rcvr;
             // If we have more than one layer of calls, then the expected ty
             // cannot guide the method probe.
diff --git a/compiler/rustc_hir_typeck/src/fallback.rs b/compiler/rustc_hir_typeck/src/fallback.rs
index ac6b0924ab5..2cc7b357c0a 100644
--- a/compiler/rustc_hir_typeck/src/fallback.rs
+++ b/compiler/rustc_hir_typeck/src/fallback.rs
@@ -308,7 +308,7 @@ impl<'tcx> FnCtxt<'_, 'tcx> {
 
             if relationship.self_in_trait && relationship.output {
                 // This case falls back to () to ensure that the code pattern in
-                // src/test/ui/never_type/fallback-closure-ret.rs continues to
+                // tests/ui/never_type/fallback-closure-ret.rs continues to
                 // compile when never_type_fallback is enabled.
                 //
                 // This rule is not readily explainable from first principles,
diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
index 594a60c70a7..47c4b7d7431 100644
--- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
+++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs
@@ -670,8 +670,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         // Note: this check is pessimistic, as the inference type could be matched with something other
         // than the opaque type, but then we need a new `TypeRelation` just for this specific case and
         // can't re-use `sup` below.
-        // See src/test/ui/impl-trait/hidden-type-is-opaque.rs and
-        // src/test/ui/impl-trait/hidden-type-is-opaque-2.rs for examples that hit this path.
+        // See tests/ui/impl-trait/hidden-type-is-opaque.rs and
+        // tests/ui/impl-trait/hidden-type-is-opaque-2.rs for examples that hit this path.
         if formal_ret.has_infer_types() {
             for ty in ret_ty.walk() {
                 if let ty::subst::GenericArgKind::Type(ty) = ty.unpack()
diff --git a/compiler/rustc_hir_typeck/src/generator_interior/mod.rs b/compiler/rustc_hir_typeck/src/generator_interior/mod.rs
index e4ac91befac..7990d95310b 100644
--- a/compiler/rustc_hir_typeck/src/generator_interior/mod.rs
+++ b/compiler/rustc_hir_typeck/src/generator_interior/mod.rs
@@ -448,7 +448,7 @@ impl<'a, 'tcx> Visitor<'tcx> for InteriorVisitor<'a, 'tcx> {
         // the yield, even if it's not borrowed or referenced after the yield. Ideally this would
         // *only* happen for types with observable drop, not all types which wrap them, but that
         // doesn't match the behavior of MIR borrowck and causes ICEs. See the FIXME comment in
-        // src/test/ui/generator/drop-tracking-parent-expression.rs.
+        // tests/ui/generator/drop-tracking-parent-expression.rs.
         let scope = if self.drop_ranges.is_borrowed_temporary(expr)
             || ty.map_or(true, |ty| {
                 // Avoid ICEs in needs_drop.
diff --git a/compiler/rustc_hir_typeck/src/method/confirm.rs b/compiler/rustc_hir_typeck/src/method/confirm.rs
index a2c6e246610..7d2ba1fd09d 100644
--- a/compiler/rustc_hir_typeck/src/method/confirm.rs
+++ b/compiler/rustc_hir_typeck/src/method/confirm.rs
@@ -90,7 +90,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
         // If there is a `Self: Sized` bound and `Self` is a trait object, it is possible that
         // something which derefs to `Self` actually implements the trait and the caller
         // wanted to make a static dispatch on it but forgot to import the trait.
-        // See test `src/test/ui/issue-35976.rs`.
+        // See test `tests/ui/issue-35976.rs`.
         //
         // In that case, we'll error anyway, but we'll also re-run the search with all traits
         // in scope, and if we find another method which can be used, we'll output an
diff --git a/compiler/rustc_hir_typeck/src/method/probe.rs b/compiler/rustc_hir_typeck/src/method/probe.rs
index 02b4d5bb2fb..5d8383170f0 100644
--- a/compiler/rustc_hir_typeck/src/method/probe.rs
+++ b/compiler/rustc_hir_typeck/src/method/probe.rs
@@ -1713,7 +1713,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
     /// probe. This will result in a pending obligation so when more type-info is available we can
     /// make the final decision.
     ///
-    /// Example (`src/test/ui/method-two-trait-defer-resolution-1.rs`):
+    /// Example (`tests/ui/method-two-trait-defer-resolution-1.rs`):
     ///
     /// ```ignore (illustrative)
     /// trait Foo { ... }
diff --git a/compiler/rustc_hir_typeck/src/upvar.rs b/compiler/rustc_hir_typeck/src/upvar.rs
index a9347991e7f..e12a575d5ac 100644
--- a/compiler/rustc_hir_typeck/src/upvar.rs
+++ b/compiler/rustc_hir_typeck/src/upvar.rs
@@ -663,7 +663,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         // fields of some type, the observable drop order will remain the same as it previously
         // was even though we're dropping each capture individually.
         // See https://github.com/rust-lang/project-rfc-2229/issues/42 and
-        // `src/test/ui/closures/2229_closure_analysis/preserve_field_drop_order.rs`.
+        // `tests/ui/closures/2229_closure_analysis/preserve_field_drop_order.rs`.
         for (_, captures) in &mut root_var_min_capture_list {
             captures.sort_by(|capture1, capture2| {
                 for (p1, p2) in capture1.place.projections.iter().zip(&capture2.place.projections) {
diff --git a/compiler/rustc_infer/src/infer/combine.rs b/compiler/rustc_infer/src/infer/combine.rs
index 9a1c49c1aa6..77e38e47fcf 100644
--- a/compiler/rustc_infer/src/infer/combine.rs
+++ b/compiler/rustc_infer/src/infer/combine.rs
@@ -219,7 +219,7 @@ impl<'tcx> InferCtxt<'tcx> {
     ///
     /// As `3 + 4` contains `N` in its substs, this must not succeed.
     ///
-    /// See `src/test/ui/const-generics/occurs-check/` for more examples where this is relevant.
+    /// See `tests/ui/const-generics/occurs-check/` for more examples where this is relevant.
     #[instrument(level = "debug", skip(self))]
     fn unify_const_variable(
         &self,
diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs
index 5c3e9a2d5cc..66db1a2f928 100644
--- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs
+++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs
@@ -310,7 +310,7 @@ pub fn unexpected_hidden_region_diagnostic<'tcx>(
             // Ugh. This is a painful case: the hidden region is not one
             // that we can easily summarize or explain. This can happen
             // in a case like
-            // `src/test/ui/multiple-lifetimes/ordinary-bounds-unsuited.rs`:
+            // `tests/ui/multiple-lifetimes/ordinary-bounds-unsuited.rs`:
             //
             // ```
             // fn upper_bounds<'a, 'b>(a: Ordinary<'a>, b: Ordinary<'b>) -> impl Trait<'a, 'b> {
@@ -1395,7 +1395,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
     /// `swap_secondary_and_primary` is used to make projection errors in particular nicer by using
     /// the message in `secondary_span` as the primary label, and apply the message that would
     /// otherwise be used for the primary label on the `secondary_span` `Span`. This applies on
-    /// E0271, like `src/test/ui/issues/issue-39970.stderr`.
+    /// E0271, like `tests/ui/issues/issue-39970.stderr`.
     #[instrument(
         level = "debug",
         skip(self, diag, secondary_span, swap_secondary_and_primary, prefer_label)
diff --git a/compiler/rustc_mir_transform/src/unreachable_prop.rs b/compiler/rustc_mir_transform/src/unreachable_prop.rs
index 06deca2fffb..d4b1cfe4337 100644
--- a/compiler/rustc_mir_transform/src/unreachable_prop.rs
+++ b/compiler/rustc_mir_transform/src/unreachable_prop.rs
@@ -87,7 +87,7 @@ where
                 // unless otherwise is unreachable, in which case deleting a normal branch causes it to be merged with
                 // the otherwise, keeping its unreachable.
                 // This looses information about reachability causing worse codegen.
-                // For example (see src/test/codegen/match-optimizes-away.rs)
+                // For example (see tests/codegen/match-optimizes-away.rs)
                 //
                 // pub enum Two { A, B }
                 // pub fn identity(x: Two) -> Two {
diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs
index 8fe47d862e7..564cb1baa69 100644
--- a/compiler/rustc_privacy/src/lib.rs
+++ b/compiler/rustc_privacy/src/lib.rs
@@ -1755,7 +1755,7 @@ impl SearchInterfaceForPrivateItemsVisitor<'_> {
         // clauses that the compiler inferred. We only want to
         // consider the ones that the user wrote. This is important
         // for the inferred outlives rules; see
-        // `src/test/ui/rfc-2093-infer-outlives/privacy.rs`.
+        // `tests/ui/rfc-2093-infer-outlives/privacy.rs`.
         self.visit_predicates(self.tcx.explicit_predicates_of(self.item_def_id));
         self
     }
diff --git a/compiler/rustc_resolve/src/build_reduced_graph.rs b/compiler/rustc_resolve/src/build_reduced_graph.rs
index cf635996268..58f6fd2b006 100644
--- a/compiler/rustc_resolve/src/build_reduced_graph.rs
+++ b/compiler/rustc_resolve/src/build_reduced_graph.rs
@@ -514,7 +514,7 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
                             ModuleKind::Block => unreachable!(),
                         };
                         // HACK(eddyb) unclear how good this is, but keeping `$crate`
-                        // in `source` breaks `src/test/ui/imports/import-crate-var.rs`,
+                        // in `source` breaks `tests/ui/imports/import-crate-var.rs`,
                         // while the current crate doesn't have a valid `crate_name`.
                         if crate_name != kw::Empty {
                             // `crate_name` should not be interpreted as relative.
diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs
index 26757965c95..258d2e2d28c 100644
--- a/compiler/rustc_trait_selection/src/traits/coherence.rs
+++ b/compiler/rustc_trait_selection/src/traits/coherence.rs
@@ -749,7 +749,7 @@ impl<'tcx> TypeVisitor<'tcx> for OrphanChecker<'tcx> {
     ///
     /// This means that we can completely ignore constants during the orphan check.
     ///
-    /// See `src/test/ui/coherence/const-generics-orphan-check-ok.rs` for examples.
+    /// See `tests/ui/coherence/const-generics-orphan-check-ok.rs` for examples.
     ///
     /// [^1]: This might not hold for function pointers or trait objects in the future.
     /// As these should be quite rare as const arguments and especially rare as impl
diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs
index f7614997585..81966f3fcb2 100644
--- a/compiler/rustc_trait_selection/src/traits/project.rs
+++ b/compiler/rustc_trait_selection/src/traits/project.rs
@@ -282,7 +282,7 @@ fn project_and_unify_type<'cx, 'tcx>(
     };
     debug!(?normalized, ?obligations, "project_and_unify_type result");
     let actual = obligation.predicate.term;
-    // For an example where this is necessary see src/test/ui/impl-trait/nested-return-type2.rs
+    // For an example where this is necessary see tests/ui/impl-trait/nested-return-type2.rs
     // This allows users to omit re-mentioning all bounds on an associated type and just use an
     // `impl Trait` for the assoc type to add more bounds.
     let InferOk { value: actual, obligations: new } =
diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs
index 0e0a883d9f5..fec4047ff49 100644
--- a/compiler/rustc_trait_selection/src/traits/wf.rs
+++ b/compiler/rustc_trait_selection/src/traits/wf.rs
@@ -232,7 +232,7 @@ fn extend_cause_with_original_assoc_item_obligation<'tcx>(
             // The obligation comes not from the current `impl` nor the `trait` being implemented,
             // but rather from a "second order" obligation, where an associated type has a
             // projection coming from another associated type. See
-            // `src/test/ui/associated-types/point-at-type-on-obligation-failure.rs` and
+            // `tests/ui/associated-types/point-at-type-on-obligation-failure.rs` and
             // `traits-assoc-type-in-supertrait-bad.rs`.
             if let Some(ty::Alias(ty::Projection, projection_ty)) = proj.term.ty().map(|ty| ty.kind())
                 && let Some(&impl_item_id) =
@@ -640,7 +640,7 @@ impl<'tcx> WfPredicates<'tcx> {
                     // hidden type that is not actually well formed and
                     // can cause compiler crashes when the user abuses unsafe
                     // code to procure such a closure.
-                    // See src/test/ui/type-alias-impl-trait/wf_check_closures.rs
+                    // See tests/ui/type-alias-impl-trait/wf_check_closures.rs
                     let obligations = self.nominal_obligations(did, substs);
                     self.out.extend(obligations);
                 }
diff --git a/compiler/rustc_ty_utils/src/abi.rs b/compiler/rustc_ty_utils/src/abi.rs
index d1197774fe9..dc1dd1bfaf8 100644
--- a/compiler/rustc_ty_utils/src/abi.rs
+++ b/compiler/rustc_ty_utils/src/abi.rs
@@ -35,7 +35,7 @@ fn fn_sig_for_fn_abi<'tcx>(
             // HACK(davidtwco,eddyb): This is a workaround for polymorphization considering
             // parameters unused if they show up in the signature, but not in the `mir::Body`
             // (i.e. due to being inside a projection that got normalized, see
-            // `src/test/ui/polymorphization/normalized_sig_types.rs`), and codegen not keeping
+            // `tests/ui/polymorphization/normalized_sig_types.rs`), and codegen not keeping
             // track of a polymorphization `ParamEnv` to allow normalizing later.
             //
             // We normalize the `fn_sig` again after substituting at a later point.
diff --git a/library/std/src/sys/unix/process/process_unix/tests.rs b/library/std/src/sys/unix/process/process_unix/tests.rs
index e0e2d478fad..4c87f633a26 100644
--- a/library/std/src/sys/unix/process/process_unix/tests.rs
+++ b/library/std/src/sys/unix/process/process_unix/tests.rs
@@ -3,7 +3,7 @@ use crate::panic::catch_unwind;
 use crate::process::Command;
 
 // Many of the other aspects of this situation, including heap alloc concurrency
-// safety etc., are tested in src/test/ui/process/process-panic-after-fork.rs
+// safety etc., are tested in tests/ui/process/process-panic-after-fork.rs
 
 #[test]
 fn exitstatus_display_tests() {
diff --git a/rustfmt.toml b/rustfmt.toml
index aa0d4888f08..828d492a3d1 100644
--- a/rustfmt.toml
+++ b/rustfmt.toml
@@ -13,7 +13,7 @@ ignore = [
 
     # tests for now are not formatted, as they are sometimes pretty-printing constrained
     # (and generally rustfmt can move around comments in UI-testing incompatible ways)
-    "src/test",
+    "tests",
 
     # do not format submodules
     "library/backtrace",
diff --git a/src/bootstrap/README.md b/src/bootstrap/README.md
index 79c2eb31cda..8dce9e79e16 100644
--- a/src/bootstrap/README.md
+++ b/src/bootstrap/README.md
@@ -59,10 +59,10 @@ The script accepts commands, flags, and arguments to determine what to do:
   ./x.py test tidy
 
   # execute the UI test suite
-  ./x.py test src/test/ui
+  ./x.py test tests/ui
 
   # execute only some tests in the UI test suite
-  ./x.py test src/test/ui --test-args substring-of-test-name
+  ./x.py test tests/ui --test-args substring-of-test-name
 
   # execute tests in the standard library in stage0
   ./x.py test --stage 0 library/std
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index b54bf432621..52a83fa29c7 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -191,9 +191,9 @@ pub enum PathSet {
     /// A "suite" of paths.
     ///
     /// These can match as a path suffix (like `Set`), or as a prefix. For
-    /// example, a command-line value of `src/test/ui/abi/variadic-ffi.rs`
-    /// will match `src/test/ui`. A command-line value of `ui` would also
-    /// match `src/test/ui`.
+    /// example, a command-line value of `tests/ui/abi/variadic-ffi.rs`
+    /// will match `tests/ui`. A command-line value of `ui` would also
+    /// match `tests/ui`.
     Suite(TaskPath),
 }
 
diff --git a/src/bootstrap/builder/tests.rs b/src/bootstrap/builder/tests.rs
index 5f21d2b0067..d5fcd107502 100644
--- a/src/bootstrap/builder/tests.rs
+++ b/src/bootstrap/builder/tests.rs
@@ -78,7 +78,7 @@ macro_rules! rustc {
 #[test]
 fn test_valid() {
     // make sure multi suite paths are accepted
-    check_cli(["test", "src/test/ui/attr-start.rs", "src/test/ui/attr-shebang.rs"]);
+    check_cli(["test", "tests/ui/attr-start.rs", "tests/ui/attr-shebang.rs"]);
 }
 
 #[test]
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 6b211d3ec6e..68d1db0160a 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -1193,7 +1193,7 @@ impl Step for Sysroot {
             );
             if builder.config.rust_remap_debuginfo {
                 eprintln!(
-                    "warning: some `src/test/ui` tests will fail when lacking `{}`",
+                    "warning: some `tests/ui` tests will fail when lacking `{}`",
                     sysroot_lib_rustlib_src_rust.display(),
                 );
             }
diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py
index 31cc4aa57bb..0af329e7007 100755
--- a/src/bootstrap/configure.py
+++ b/src/bootstrap/configure.py
@@ -45,7 +45,7 @@ o("llvm-static-stdcpp", "llvm.static-libstdcpp", "statically link to libstdc++ f
 o("llvm-link-shared", "llvm.link-shared", "prefer shared linking to LLVM (llvm-config --link-shared)")
 o("rpath", "rust.rpath", "build rpaths into rustc itself")
 o("llvm-version-check", "llvm.version-check", "check if the LLVM version is supported, build anyway")
-o("codegen-tests", "rust.codegen-tests", "run the src/test/codegen tests")
+o("codegen-tests", "rust.codegen-tests", "run the tests/codegen tests")
 o("option-checking", None, "complain about unrecognized options in this configure script")
 o("ninja", "llvm.ninja", "build LLVM using the Ninja generator (for MSVC, requires building in the correct environment)")
 o("locked-deps", "build.locked-deps", "force Cargo.lock to be up to date")
diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs
index 2c6d201d18f..52c3dc0bf75 100644
--- a/src/bootstrap/flags.rs
+++ b/src/bootstrap/flags.rs
@@ -487,13 +487,13 @@ Arguments:
     This subcommand accepts a number of paths to test directories that
     should be compiled and run. For example:
 
-        ./x.py test src/test/ui
+        ./x.py test tests/ui
         ./x.py test library/std --test-args hash_map
         ./x.py test library/std --stage 0 --no-doc
-        ./x.py test src/test/ui --bless
-        ./x.py test src/test/ui --compare-mode chalk
+        ./x.py test tests/ui --bless
+        ./x.py test tests/ui --compare-mode chalk
 
-    Note that `test src/test/* --stage N` does NOT depend on `build compiler/rustc --stage N`;
+    Note that `test tests/* --stage N` does NOT depend on `build compiler/rustc --stage N`;
     just like `build library/std --stage N` it tests the compiler produced by the previous
     stage.
 
diff --git a/src/bootstrap/mk/Makefile.in b/src/bootstrap/mk/Makefile.in
index 5b2aba9aa2d..d54a21b9f16 100644
--- a/src/bootstrap/mk/Makefile.in
+++ b/src/bootstrap/mk/Makefile.in
@@ -58,7 +58,7 @@ prepare:
 	$(Q)$(BOOTSTRAP) build --stage 2 nonexistent/path/to/trigger/cargo/metadata
 
 TESTS_IN_2 := \
-	src/test/ui \
+	tests/ui \
 	src/tools/linkchecker
 
 ## MSVC native builders
@@ -72,7 +72,7 @@ ci-subset-2:
 ## MingW native builders
 
 TESTS_IN_MINGW_2 := \
-	src/test/ui
+	tests/ui
 
 ci-mingw-subset-1:
 	$(Q)$(CFG_SRC_DIR)/x test --stage 2 $(TESTS_IN_MINGW_2:%=--exclude %)
diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
index 89bb2b770f9..e0d1504c9c7 100644
--- a/src/bootstrap/native.rs
+++ b/src/bootstrap/native.rs
@@ -907,7 +907,7 @@ impl Step for TestHelpers {
     type Output = ();
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
-        run.path("src/test/auxiliary/rust_test_helpers.c")
+        run.path("tests/auxiliary/rust_test_helpers.c")
     }
 
     fn make_run(run: RunConfig<'_>) {
@@ -929,7 +929,7 @@ impl Step for TestHelpers {
             self.target
         };
         let dst = builder.test_helpers_out(target);
-        let src = builder.src.join("src/test/auxiliary/rust_test_helpers.c");
+        let src = builder.src.join("tests/auxiliary/rust_test_helpers.c");
         if up_to_date(&src, &dst.join("librust_test_helpers.a")) {
             return;
         }
@@ -958,7 +958,7 @@ impl Step for TestHelpers {
             .opt_level(0)
             .warnings(false)
             .debug(false)
-            .file(builder.src.join("src/test/auxiliary/rust_test_helpers.c"))
+            .file(builder.src.join("tests/auxiliary/rust_test_helpers.c"))
             .compile("rust_test_helpers");
     }
 }
diff --git a/src/bootstrap/setup.rs b/src/bootstrap/setup.rs
index ca4feac6fac..004601cb68b 100644
--- a/src/bootstrap/setup.rs
+++ b/src/bootstrap/setup.rs
@@ -144,7 +144,7 @@ pub fn setup(config: &Config, profile: Profile) {
         Profile::Tools => &[
             "check",
             "build",
-            "test src/test/rustdoc*",
+            "test tests/rustdoc*",
             "test src/tools/clippy",
             "test src/tools/miri",
             "test src/tools/rustfmt",
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index ea906be7e3a..159f2fba671 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -841,7 +841,7 @@ impl Step for RustdocJSStd {
     const ONLY_HOSTS: bool = true;
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
-        run.suite_path("src/test/rustdoc-js-std")
+        run.suite_path("tests/rustdoc-js-std")
     }
 
     fn make_run(run: RunConfig<'_>) {
@@ -860,10 +860,10 @@ impl Step for RustdocJSStd {
                 .arg("--doc-folder")
                 .arg(builder.doc_out(self.target))
                 .arg("--test-folder")
-                .arg(builder.src.join("src/test/rustdoc-js-std"));
+                .arg(builder.src.join("tests/rustdoc-js-std"));
             for path in &builder.paths {
                 if let Some(p) =
-                    util::is_valid_test_suite_arg(path, "src/test/rustdoc-js-std", builder)
+                    util::is_valid_test_suite_arg(path, "tests/rustdoc-js-std", builder)
                 {
                     if !p.ends_with(".js") {
                         eprintln!("A non-js file was given: `{}`", path.display());
@@ -879,7 +879,7 @@ impl Step for RustdocJSStd {
             });
             builder.run(&mut command);
         } else {
-            builder.info("No nodejs found, skipping \"src/test/rustdoc-js-std\" tests");
+            builder.info("No nodejs found, skipping \"tests/rustdoc-js-std\" tests");
         }
     }
 }
@@ -896,7 +896,7 @@ impl Step for RustdocJSNotStd {
     const ONLY_HOSTS: bool = true;
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
-        run.suite_path("src/test/rustdoc-js")
+        run.suite_path("tests/rustdoc-js")
     }
 
     fn make_run(run: RunConfig<'_>) {
@@ -911,11 +911,11 @@ impl Step for RustdocJSNotStd {
                 target: self.target,
                 mode: "js-doc-test",
                 suite: "rustdoc-js",
-                path: "src/test/rustdoc-js",
+                path: "tests/rustdoc-js",
                 compare_mode: None,
             });
         } else {
-            builder.info("No nodejs found, skipping \"src/test/rustdoc-js\" tests");
+            builder.info("No nodejs found, skipping \"tests/rustdoc-js\" tests");
         }
     }
 }
@@ -976,7 +976,7 @@ impl Step for RustdocGUI {
 
     fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
         let builder = run.builder;
-        let run = run.suite_path("src/test/rustdoc-gui");
+        let run = run.suite_path("tests/rustdoc-gui");
         run.lazy_default_condition(Box::new(move || {
             builder.config.nodejs.is_some()
                 && builder
@@ -1025,7 +1025,7 @@ impl Step for RustdocGUI {
         // We remove existing folder to be sure there won't be artifacts remaining.
         builder.clear_if_dirty(&out_dir, &builder.rustdoc(self.compiler));
 
-        let src_path = builder.build.src.join("src/test/rustdoc-gui/src");
+        let src_path = builder.build.src.join("tests/rustdoc-gui/src");
         // We generate docs for the libraries present in the rustdoc-gui's src folder.
         for entry in src_path.read_dir().expect("read_dir call failed") {
             if let Ok(entry) = entry {
@@ -1064,9 +1064,9 @@ impl Step for RustdocGUI {
             .arg("--doc-folder")
             .arg(out_dir.join("doc"))
             .arg("--tests-folder")
-            .arg(builder.build.src.join("src/test/rustdoc-gui"));
+            .arg(builder.build.src.join("tests/rustdoc-gui"));
         for path in &builder.paths {
-            if let Some(p) = util::is_valid_test_suite_arg(path, "src/test/rustdoc-gui", builder) {
+            if let Some(p) = util::is_valid_test_suite_arg(path, "tests/rustdoc-gui", builder) {
                 if !p.ends_with(".goml") {
                     eprintln!("A non-goml file was given: `{}`", path.display());
                     panic!("Cannot run rustdoc-gui tests");
@@ -1308,59 +1308,51 @@ macro_rules! test_definitions {
     };
 }
 
-default_test!(Ui { path: "src/test/ui", mode: "ui", suite: "ui" });
+default_test!(Ui { path: "tests/ui", mode: "ui", suite: "ui" });
 
 default_test!(RunPassValgrind {
-    path: "src/test/run-pass-valgrind",
+    path: "tests/run-pass-valgrind",
     mode: "run-pass-valgrind",
     suite: "run-pass-valgrind"
 });
 
-default_test!(MirOpt { path: "src/test/mir-opt", mode: "mir-opt", suite: "mir-opt" });
+default_test!(MirOpt { path: "tests/mir-opt", mode: "mir-opt", suite: "mir-opt" });
 
-default_test!(Codegen { path: "src/test/codegen", mode: "codegen", suite: "codegen" });
+default_test!(Codegen { path: "tests/codegen", mode: "codegen", suite: "codegen" });
 
 default_test!(CodegenUnits {
-    path: "src/test/codegen-units",
+    path: "tests/codegen-units",
     mode: "codegen-units",
     suite: "codegen-units"
 });
 
-default_test!(Incremental {
-    path: "src/test/incremental",
-    mode: "incremental",
-    suite: "incremental"
-});
+default_test!(Incremental { path: "tests/incremental", mode: "incremental", suite: "incremental" });
 
 default_test_with_compare_mode!(Debuginfo {
-    path: "src/test/debuginfo",
+    path: "tests/debuginfo",
     mode: "debuginfo",
     suite: "debuginfo",
     compare_mode: "split-dwarf"
 });
 
-host_test!(UiFullDeps { path: "src/test/ui-fulldeps", mode: "ui", suite: "ui-fulldeps" });
+host_test!(UiFullDeps { path: "tests/ui-fulldeps", mode: "ui", suite: "ui-fulldeps" });
 
-host_test!(Rustdoc { path: "src/test/rustdoc", mode: "rustdoc", suite: "rustdoc" });
-host_test!(RustdocUi { path: "src/test/rustdoc-ui", mode: "ui", suite: "rustdoc-ui" });
+host_test!(Rustdoc { path: "tests/rustdoc", mode: "rustdoc", suite: "rustdoc" });
+host_test!(RustdocUi { path: "tests/rustdoc-ui", mode: "ui", suite: "rustdoc-ui" });
 
-host_test!(RustdocJson {
-    path: "src/test/rustdoc-json",
-    mode: "rustdoc-json",
-    suite: "rustdoc-json"
-});
+host_test!(RustdocJson { path: "tests/rustdoc-json", mode: "rustdoc-json", suite: "rustdoc-json" });
 
-host_test!(Pretty { path: "src/test/pretty", mode: "pretty", suite: "pretty" });
+host_test!(Pretty { path: "tests/pretty", mode: "pretty", suite: "pretty" });
 
-default_test!(RunMake { path: "src/test/run-make", mode: "run-make", suite: "run-make" });
+default_test!(RunMake { path: "tests/run-make", mode: "run-make", suite: "run-make" });
 
 host_test!(RunMakeFullDeps {
-    path: "src/test/run-make-fulldeps",
+    path: "tests/run-make-fulldeps",
     mode: "run-make",
     suite: "run-make-fulldeps"
 });
 
-default_test!(Assembly { path: "src/test/assembly", mode: "assembly", suite: "assembly" });
+default_test!(Assembly { path: "tests/assembly", mode: "assembly", suite: "assembly" });
 
 #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
 struct Compiletest {
@@ -1472,7 +1464,7 @@ note: if you're sure you want to do this, please open an issue as to why. In the
             cmd.arg("--rust-demangler-path").arg(rust_demangler);
         }
 
-        cmd.arg("--src-base").arg(builder.src.join("src/test").join(suite));
+        cmd.arg("--src-base").arg(builder.src.join("tests").join(suite));
         cmd.arg("--build-base").arg(testdir(builder, compiler.host).join(suite));
         cmd.arg("--sysroot-base").arg(builder.sysroot(compiler));
         cmd.arg("--stage-id").arg(format!("stage{}-{}", compiler.stage, target));
@@ -1936,7 +1928,7 @@ impl Step for ErrorIndex {
     fn make_run(run: RunConfig<'_>) {
         // error_index_generator depends on librustdoc. Use the compiler that
         // is normally used to build rustdoc for other tests (like compiletest
-        // tests in src/test/rustdoc) so that it shares the same artifacts.
+        // tests in tests/rustdoc) so that it shares the same artifacts.
         let compiler = run.builder.compiler(run.builder.top_stage, run.builder.config.build);
         run.builder.ensure(ErrorIndex { compiler });
     }
@@ -2233,7 +2225,7 @@ impl Step for CrateRustdoc {
             builder.compiler(builder.top_stage, target)
         } else {
             // Use the previous stage compiler to reuse the artifacts that are
-            // created when running compiletest for src/test/rustdoc. If this used
+            // created when running compiletest for tests/rustdoc. If this used
             // `compiler`, then it would cause rustdoc to be built *again*, which
             // isn't really necessary.
             builder.compiler_for(builder.top_stage, target, target)
@@ -2349,7 +2341,7 @@ impl Step for CrateRustdocJsonTypes {
         let target = self.host;
 
         // Use the previous stage compiler to reuse the artifacts that are
-        // created when running compiletest for src/test/rustdoc. If this used
+        // created when running compiletest for tests/rustdoc. If this used
         // `compiler`, then it would cause rustdoc to be built *again*, which
         // isn't really necessary.
         let compiler = builder.compiler_for(builder.top_stage, target, target);
diff --git a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile
index 26eb69f2eae..34829adf79b 100644
--- a/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile
+++ b/src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile
@@ -48,7 +48,7 @@ RUN CC=gcc CFLAGS="-m32 -Wa,-mrelax-relocations=no" \
     rm -rf /build
 
 # FIXME: musl really shouldn't be linking libgcc_s.so, as it's linked to glibc,
-# but it's required by src/test/ui/proc-macro/crt-static.rs. Ubuntu:16.04 gcc-5
+# but it's required by tests/ui/proc-macro/crt-static.rs. Ubuntu:16.04 gcc-5
 # had libgcc_s.so as a symlink to the absolute libgcc_s.so.1, but now it's an
 # ld-script that expects to find libgcc_s.so.1 in the library search path.
 # See also https://github.com/rust-lang/rust/issues/82521
diff --git a/src/ci/docker/host-x86_64/dist-various-1/Dockerfile b/src/ci/docker/host-x86_64/dist-various-1/Dockerfile
index cd0f01faa1b..4576e6d4fa2 100644
--- a/src/ci/docker/host-x86_64/dist-various-1/Dockerfile
+++ b/src/ci/docker/host-x86_64/dist-various-1/Dockerfile
@@ -183,7 +183,7 @@ ENV RUST_CONFIGURE_ARGS \
       --disable-docs
 
 ENV SCRIPT \
-      python3 ../x.py --stage 2 test --host='' --target $RUN_MAKE_TARGETS src/test/run-make && \
+      python3 ../x.py --stage 2 test --host='' --target $RUN_MAKE_TARGETS tests/run-make && \
       python3 ../x.py dist --host='' --target $TARGETS
 
 # sccache
diff --git a/src/ci/docker/host-x86_64/i686-gnu/Dockerfile b/src/ci/docker/host-x86_64/i686-gnu/Dockerfile
index cb6559707d9..d9e58386256 100644
--- a/src/ci/docker/host-x86_64/i686-gnu/Dockerfile
+++ b/src/ci/docker/host-x86_64/i686-gnu/Dockerfile
@@ -27,6 +27,6 @@ ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu
 # this slow job.
 ENV SCRIPT python3 ../x.py --stage 2 test \
   --exclude src/bootstrap \
-  --exclude src/test/rustdoc-js \
+  --exclude tests/rustdoc-js \
   --exclude src/tools/error_index_generator \
   --exclude src/tools/linkchecker
diff --git a/src/ci/docker/host-x86_64/test-various/Dockerfile b/src/ci/docker/host-x86_64/test-various/Dockerfile
index cf4451f8b33..930f58baf02 100644
--- a/src/ci/docker/host-x86_64/test-various/Dockerfile
+++ b/src/ci/docker/host-x86_64/test-various/Dockerfile
@@ -59,16 +59,16 @@ ENV NO_OVERFLOW_CHECKS=1
 
 ENV WASM_TARGETS=wasm32-unknown-unknown
 ENV WASM_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $WASM_TARGETS \
-  src/test/run-make \
-  src/test/ui \
-  src/test/mir-opt \
-  src/test/codegen-units \
+  tests/run-make \
+  tests/ui \
+  tests/mir-opt \
+  tests/codegen-units \
   library/core
 
 ENV NVPTX_TARGETS=nvptx64-nvidia-cuda
 ENV NVPTX_SCRIPT python3 /checkout/x.py --stage 2 test --host='' --target $NVPTX_TARGETS \
-  src/test/run-make \
-  src/test/assembly
+  tests/run-make \
+  tests/assembly
 
 ENV MUSL_TARGETS=x86_64-unknown-linux-musl \
     CC_x86_64_unknown_linux_musl=x86_64-linux-musl-gcc \
diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile
index c2b002055a8..735d4d4dfcf 100644
--- a/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile
+++ b/src/ci/docker/host-x86_64/x86_64-gnu-debug/Dockerfile
@@ -46,4 +46,4 @@ ENV RUST_CONFIGURE_ARGS \
 
 ENV SCRIPT \
   python3 ../x.py --stage 2 build && \
-  python3 ../x.py --stage 2 test src/test/run-make-fulldeps --test-args clang
+  python3 ../x.py --stage 2 test tests/run-make-fulldeps --test-args clang
diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-13-stage1/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-13-stage1/Dockerfile
index 16976a9428e..bcbf58253b1 100644
--- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-13-stage1/Dockerfile
+++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-13-stage1/Dockerfile
@@ -45,5 +45,5 @@ ENV SCRIPT python2.7 ../x.py --stage 1 test --exclude src/tools/tidy && \
     # the PR is approved and tested for merging.
     # It will also detect tests lacking `// EMIT_MIR_FOR_EACH_BIT_WIDTH`,
     # despite having different output on 32-bit vs 64-bit targets.
-    python2.7 ../x.py --stage 1 test src/test/mir-opt \
+    python2.7 ../x.py --stage 1 test tests/mir-opt \
     --host='' --target=i686-unknown-linux-gnu
diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-13/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-13/Dockerfile
index 06f15bd1211..9fc9e9cbffb 100644
--- a/src/ci/docker/host-x86_64/x86_64-gnu-llvm-13/Dockerfile
+++ b/src/ci/docker/host-x86_64/x86_64-gnu-llvm-13/Dockerfile
@@ -56,14 +56,14 @@ ENV SCRIPT ../x.py --stage 2 test --exclude src/tools/tidy && \
            # the PR is approved and tested for merging.
            # It will also detect tests lacking `// EMIT_MIR_FOR_EACH_BIT_WIDTH`,
            # despite having different output on 32-bit vs 64-bit targets.
-           ../x --stage 2 test src/test/mir-opt \
+           ../x --stage 2 test tests/mir-opt \
                              --host='' --target=i686-unknown-linux-gnu && \
            # Run the UI test suite again, but in `--pass=check` mode
            #
            # This is intended to make sure that both `--pass=check` continues to
            # work.
            #
-           ../x.ps1 --stage 2 test src/test/ui --pass=check \
+           ../x.ps1 --stage 2 test tests/ui --pass=check \
                              --host='' --target=i686-unknown-linux-gnu && \
            # Run tidy at the very end, after all the other tests.
            python2.7 ../x.py --stage 2 test src/tools/tidy
diff --git a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile
index 58c0c5db1a5..85f2f84a44c 100644
--- a/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile
+++ b/src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile
@@ -84,5 +84,5 @@ ENV RUST_CONFIGURE_ARGS \
   --save-toolstates=/tmp/toolstate/toolstates.json
 
 ENV SCRIPT /tmp/checktools.sh ../x.py && \
-  NODE_PATH=`npm root -g` python3 ../x.py test src/test/rustdoc-gui --stage 2 \
+  NODE_PATH=`npm root -g` python3 ../x.py test tests/rustdoc-gui --stage 2 \
     --test-args "'--no-sandbox --jobs 1'"
diff --git a/src/ci/github-actions/ci.yml b/src/ci/github-actions/ci.yml
index d33396dcc80..d2a9264c84a 100644
--- a/src/ci/github-actions/ci.yml
+++ b/src/ci/github-actions/ci.yml
@@ -511,7 +511,7 @@ jobs:
 
           - name: x86_64-apple-1
             env: &env-x86_64-apple-tests
-              SCRIPT: ./x.py --stage 2 test --exclude src/test/ui --exclude src/test/rustdoc --exclude src/test/run-make-fulldeps
+              SCRIPT: ./x.py --stage 2 test --exclude tests/ui --exclude tests/rustdoc --exclude tests/run-make-fulldeps
               RUST_CONFIGURE_ARGS: --build=x86_64-apple-darwin --enable-sanitizers --enable-profiler --set rust.jemalloc --set llvm.ninja=false
               RUSTC_RETRY_LINKER_ON_SEGFAULT: 1
               MACOSX_DEPLOYMENT_TARGET: 10.8
@@ -523,7 +523,7 @@ jobs:
 
           - name: x86_64-apple-2
             env:
-              SCRIPT: ./x.py --stage 2 test src/test/ui src/test/rustdoc src/test/run-make-fulldeps
+              SCRIPT: ./x.py --stage 2 test tests/ui tests/rustdoc tests/run-make-fulldeps
               <<: *env-x86_64-apple-tests
             <<: *job-macos-xl
 
diff --git a/src/ci/scripts/should-skip-this.sh b/src/ci/scripts/should-skip-this.sh
index a8a1899317f..85d77225380 100755
--- a/src/ci/scripts/should-skip-this.sh
+++ b/src/ci/scripts/should-skip-this.sh
@@ -27,7 +27,7 @@ if [[ -n "${CI_ONLY_WHEN_SUBMODULES_CHANGED-}" ]]; then
         # that breaks Miri.
         echo "Tool subtrees were updated"
     elif ! (git diff --quiet "$BASE_COMMIT" -- \
-             src/test/rustdoc-gui \
+             tests/rustdoc-gui \
              src/librustdoc \
              src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile \
              src/ci/docker/host-x86_64/x86_64-gnu-tools/browser-ui-test.version \
diff --git a/src/doc/rustc/src/platform-support/fuchsia.md b/src/doc/rustc/src/platform-support/fuchsia.md
index 95c242cc161..29e70129a62 100644
--- a/src/doc/rustc/src/platform-support/fuchsia.md
+++ b/src/doc/rustc/src/platform-support/fuchsia.md
@@ -705,7 +705,7 @@ Where `${RUST_SRC_PATH}/install` is the `prefix` set in `config.toml` and
 
 Once our environment is started, we can run our tests using `x.py` as usual. The
 test runner script will run the compiled tests on an emulated Fuchsia device. To
-run the full `src/test/ui` test suite:
+run the full `tests/ui` test suite:
 
 ```sh
 ( \
@@ -713,7 +713,7 @@ run the full `src/test/ui` test suite:
     ./x.py                                                                    \
     --config config.toml                                                      \
     --stage=2                                                                 \
-    test src/test/ui                                                          \
+    test tests/ui                                                             \
     --target x86_64-unknown-fuchsia                                           \
     --run=always --jobs 1                                                     \
     --test-args --target-rustcflags                                           \
diff --git a/src/doc/unstable-book/src/compiler-flags/codegen-backend.md b/src/doc/unstable-book/src/compiler-flags/codegen-backend.md
index 3c0cd32fae1..67634be6993 100644
--- a/src/doc/unstable-book/src/compiler-flags/codegen-backend.md
+++ b/src/doc/unstable-book/src/compiler-flags/codegen-backend.md
@@ -12,7 +12,7 @@ backend. The library must be of crate type `dylib` and must contain a function
 named `__rustc_codegen_backend` with a signature of `fn() -> Box<dyn rustc_codegen_ssa::traits::CodegenBackend>`.
 
 ## Example
-See also the [`hotplug_codegen_backend`](https://github.com/rust-lang/rust/tree/master/src/test/run-make-fulldeps/hotplug_codegen_backend) test
+See also the [`hotplug_codegen_backend`](https://github.com/rust-lang/rust/tree/master/tests/run-make-fulldeps/hotplug_codegen_backend) test
 for a full example.
 
 ```rust,ignore (partial-example)
diff --git a/src/doc/unstable-book/src/language-features/plugin.md b/src/doc/unstable-book/src/language-features/plugin.md
index 56fe9a31bfe..dfbb468d4df 100644
--- a/src/doc/unstable-book/src/language-features/plugin.md
+++ b/src/doc/unstable-book/src/language-features/plugin.md
@@ -33,7 +33,7 @@ of a library.
 Plugins can extend [Rust's lint
 infrastructure](../../reference/attributes/diagnostics.md#lint-check-attributes) with
 additional checks for code style, safety, etc. Now let's write a plugin
-[`lint-plugin-test.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs)
+[`lint-plugin-test.rs`](https://github.com/rust-lang/rust/blob/master/tests/ui-fulldeps/auxiliary/lint-plugin-test.rs)
 that warns about any item named `lintme`.
 
 ```rust,ignore (requires-stage-2)
diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css
index 91bc63f83b6..b2fa6e82acc 100644
--- a/src/librustdoc/html/static/css/rustdoc.css
+++ b/src/librustdoc/html/static/css/rustdoc.css
@@ -707,7 +707,7 @@ h2.small-section-header > .anchor {
 
 /*  In most contexts we use `overflow-wrap: anywhere` to ensure that we can wrap
 	as much as needed on mobile (see
-	src/test/rustdoc-gui/type-declaration-overflow.goml for an example of why
+	tests/rustdoc-gui/type-declaration-overflow.goml for an example of why
 	this matters). The `anywhere` value means:
 
 	"Soft wrap opportunities introduced by the word break are considered when
diff --git a/src/tools/clippy/tests/ui/crashes/ice-6254.rs b/src/tools/clippy/tests/ui/crashes/ice-6254.rs
index a2a60a16915..8af60890390 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-6254.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-6254.rs
@@ -1,4 +1,4 @@
-// originally from ./src/test/ui/pattern/usefulness/consts-opaque.rs
+// originally from ./tests/ui/pattern/usefulness/consts-opaque.rs
 // panicked at 'assertion failed: rows.iter().all(|r| r.len() == v.len())',
 // compiler/rustc_mir_build/src/thir/pattern/_match.rs:2030:5
 
diff --git a/src/tools/clippy/tests/ui/crashes/ice-6255.rs b/src/tools/clippy/tests/ui/crashes/ice-6255.rs
index bd4a81d98e2..ccde6aa2b0f 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-6255.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-6255.rs
@@ -1,4 +1,4 @@
-// originally from rustc ./src/test/ui/macros/issue-78325-inconsistent-resolution.rs
+// originally from rustc ./tests/ui/macros/issue-78325-inconsistent-resolution.rs
 // inconsistent resolution for a macro
 
 macro_rules! define_other_core {
diff --git a/src/tools/clippy/tests/ui/crashes/ice-6256.rs b/src/tools/clippy/tests/ui/crashes/ice-6256.rs
index 67308263dad..f9ee3e058c1 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-6256.rs
+++ b/src/tools/clippy/tests/ui/crashes/ice-6256.rs
@@ -1,4 +1,4 @@
-// originally from rustc ./src/test/ui/regions/issue-78262.rs
+// originally from rustc ./tests/ui/regions/issue-78262.rs
 // ICE: to get the signature of a closure, use substs.as_closure().sig() not fn_sig()
 #![allow(clippy::upper_case_acronyms)]
 
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
index a4f1167bf9d..a5f5eb447da 100644
--- a/src/tools/compiletest/src/common.rs
+++ b/src/tools/compiletest/src/common.rs
@@ -240,7 +240,7 @@ pub struct Config {
     pub mode: Mode,
 
     /// The test suite (essentially which directory is running, but without the
-    /// directory prefix such as src/test)
+    /// directory prefix such as tests)
     pub suite: String,
 
     /// The debugger to use in debuginfo mode. Unset otherwise.
diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs
index 91c701a5ddd..2aea30870ff 100644
--- a/src/tools/compiletest/src/main.rs
+++ b/src/tools/compiletest/src/main.rs
@@ -774,7 +774,7 @@ fn make_test_name(
     revision: Option<&String>,
 ) -> test::TestName {
     // Print the name of the file, relative to the repository root.
-    // `src_base` looks like `/path/to/rust/src/test/ui`
+    // `src_base` looks like `/path/to/rust/tests/ui`
     let root_directory = config.src_base.parent().unwrap().parent().unwrap().parent().unwrap();
     let path = testpaths.file.strip_prefix(root_directory).unwrap();
     let debugger = match config.debugger {
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 7e48dd20660..a16ab11e2f9 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -2102,9 +2102,7 @@ impl<'test> TestCx<'test> {
                 .parent()
                 .unwrap() // chop off `ui`
                 .parent()
-                .unwrap() // chop off `test`
-                .parent()
-                .unwrap(); // chop off `src`
+                .unwrap(); // chop off `tests`
             args.push(src.join("src/etc/wasm32-shim.js").display().to_string());
         }
 
@@ -2932,7 +2930,7 @@ impl<'test> TestCx<'test> {
 
     fn run_rmake_test(&self) {
         let cwd = env::current_dir().unwrap();
-        let src_root = self.config.src_base.parent().unwrap().parent().unwrap().parent().unwrap();
+        let src_root = self.config.src_base.parent().unwrap().parent().unwrap();
         let src_root = cwd.join(&src_root);
 
         let tmpdir = cwd.join(self.output_base_name());
@@ -3548,8 +3546,8 @@ impl<'test> TestCx<'test> {
         normalize_path(parent_dir, "$DIR");
 
         let source_bases = &[
-            // Source base on the current filesystem (calculated as parent of `src/test/$suite`):
-            Some(self.config.src_base.parent().unwrap().parent().unwrap().parent().unwrap().into()),
+            // Source base on the current filesystem (calculated as parent of `tests/$suite`):
+            Some(self.config.src_base.parent().unwrap().parent().unwrap().into()),
             // Source base on the sysroot (from the src components downloaded by `download-rustc`):
             Some(self.config.sysroot_base.join("lib").join("rustlib").join("src").join("rust")),
             // Virtual `/rustc/$sha` remapped paths (if `remap-debuginfo` is enabled):
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/macro_expansion_tests/mbe/meta_syntax.rs b/src/tools/rust-analyzer/crates/hir-def/src/macro_expansion_tests/mbe/meta_syntax.rs
index 8aff784087c..7e7b4004421 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/macro_expansion_tests/mbe/meta_syntax.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/macro_expansion_tests/mbe/meta_syntax.rs
@@ -94,7 +94,7 @@ macro_rules! m2 { () => ( ${invalid()} ) }
 
 #[test]
 fn test_rustc_issue_57597() {
-    // <https://github.com/rust-lang/rust/blob/master/src/test/ui/issues/issue-57597.rs>
+    // <https://github.com/rust-lang/rust/blob/master/tests/ui/issues/issue-57597.rs>
     check(
         r#"
 macro_rules! m0 { ($($($i:ident)?)+) => {}; }
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs b/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
index 64dd2bb5f2d..f0c3690962a 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
@@ -3624,7 +3624,7 @@ of a library.
 Plugins can extend [Rust's lint
 infrastructure](../../reference/attributes/diagnostics.md#lint-check-attributes) with
 additional checks for code style, safety, etc. Now let's write a plugin
-[`lint-plugin-test.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs)
+[`lint-plugin-test.rs`](https://github.com/rust-lang/rust/blob/master/tests/ui-fulldeps/auxiliary/lint-plugin-test.rs)
 that warns about any item named `lintme`.
 
 ```rust,ignore (requires-stage-2)
diff --git a/src/tools/rustdoc-gui/tester.js b/src/tools/rustdoc-gui/tester.js
index 554b2f81fa3..2f0ca1ec3d0 100644
--- a/src/tools/rustdoc-gui/tester.js
+++ b/src/tools/rustdoc-gui/tester.js
@@ -262,7 +262,7 @@ async function main(argv) {
             console.log("");
             console.log(
                 "`browser-ui-test` crashed unexpectedly. Please try again with adding `--test-args \
---no-sandbox` at the end. For example: `x.py test src/test/rustdoc-gui --test-args --no-sandbox`");
+--no-sandbox` at the end. For example: `x.py test tests/rustdoc-gui --test-args --no-sandbox`");
             console.log("");
         }
     };
diff --git a/src/tools/rustfmt/tests/source/issue-2445.rs b/src/tools/rustfmt/tests/source/issue-2445.rs
index 84ce6e647b8..deef429dbee 100644
--- a/src/tools/rustfmt/tests/source/issue-2445.rs
+++ b/src/tools/rustfmt/tests/source/issue-2445.rs
@@ -1,6 +1,6 @@
 test!(RunPassPretty {
             // comment
-    path: "src/test/run-pass/pretty",
+    path: "tests/run-pass/pretty",
     mode: "pretty",
     suite: "run-pass",
     default: false,
@@ -9,7 +9,7 @@ test!(RunPassPretty {
 
 test!(RunPassPretty {
             // comment
-    path: "src/test/run-pass/pretty",
+    path: "tests/run-pass/pretty",
     mode: "pretty",
     suite: "run-pass",
     default: false,
diff --git a/src/tools/rustfmt/tests/target/issue-2445.rs b/src/tools/rustfmt/tests/target/issue-2445.rs
index 1bc7752fd16..463c5d49576 100644
--- a/src/tools/rustfmt/tests/target/issue-2445.rs
+++ b/src/tools/rustfmt/tests/target/issue-2445.rs
@@ -1,6 +1,6 @@
 test!(RunPassPretty {
     // comment
-    path: "src/test/run-pass/pretty",
+    path: "tests/run-pass/pretty",
     mode: "pretty",
     suite: "run-pass",
     default: false,
@@ -9,7 +9,7 @@ test!(RunPassPretty {
 
 test!(RunPassPretty {
     // comment
-    path: "src/test/run-pass/pretty",
+    path: "tests/run-pass/pretty",
     mode: "pretty",
     suite: "run-pass",
     default: false,
diff --git a/src/tools/tidy/src/debug_artifacts.rs b/src/tools/tidy/src/debug_artifacts.rs
index 9880a32ad0c..0dd9c1e160c 100644
--- a/src/tools/tidy/src/debug_artifacts.rs
+++ b/src/tools/tidy/src/debug_artifacts.rs
@@ -1,14 +1,12 @@
 //! Tidy check to prevent creation of unnecessary debug artifacts while running tests.
 
 use crate::walk::{filter_dirs, walk};
-use std::path::{Path, PathBuf};
+use std::path::Path;
 
 const GRAPHVIZ_POSTFLOW_MSG: &str = "`borrowck_graphviz_postflow` attribute in test";
 
-pub fn check(path: &Path, bad: &mut bool) {
-    let test_dir: PathBuf = path.join("test");
-
-    walk(&test_dir, &mut filter_dirs, &mut |entry, contents| {
+pub fn check(test_dir: &Path, bad: &mut bool) {
+    walk(test_dir, &mut filter_dirs, &mut |entry, contents| {
         let filename = entry.path();
         let is_rust = filename.extension().map_or(false, |ext| ext == "rs");
         if !is_rust {
diff --git a/src/tools/tidy/src/edition.rs b/src/tools/tidy/src/edition.rs
index 8a7c4460dc7..8172e3d292b 100644
--- a/src/tools/tidy/src/edition.rs
+++ b/src/tools/tidy/src/edition.rs
@@ -11,7 +11,10 @@ fn is_edition_2021(mut line: &str) -> bool {
 pub fn check(path: &Path, bad: &mut bool) {
     walk(
         path,
-        &mut |path| filter_dirs(path) || path.ends_with("src/test"),
+        &mut |path| {
+            filter_dirs(path)
+                || (path.ends_with("tests") && path.join("COMPILER_TESTS.md").exists())
+        },
         &mut |entry, contents| {
             let file = entry.path();
             let filename = file.file_name().unwrap();
diff --git a/src/tools/tidy/src/error_codes.rs b/src/tools/tidy/src/error_codes.rs
index 9aacc07e0ab..ac8b5f6834c 100644
--- a/src/tools/tidy/src/error_codes.rs
+++ b/src/tools/tidy/src/error_codes.rs
@@ -8,7 +8,7 @@
 //!   - The explanation is expected to contain a `doctest` that fails with the correct error code. (`EXEMPT_FROM_DOCTEST` *currently* bypasses this check)
 //!   - Note that other stylistic conventions for markdown files are checked in the `style.rs` tidy check.
 //!
-//! 3. We check that the error code has a UI test in `src/test/ui/error-codes/`.
+//! 3. We check that the error code has a UI test in `tests/ui/error-codes/`.
 //!   - We ensure that there is both a `Exxxx.rs` file and a corresponding `Exxxx.stderr` file.
 //!   - We also ensure that the error code is used in the tests.
 //!   - *Currently*, it is possible to opt-out of this check with the `EXEMPTED_FROM_TEST` constant.
@@ -24,7 +24,7 @@ use crate::walk::{filter_dirs, walk, walk_many};
 
 const ERROR_CODES_PATH: &str = "compiler/rustc_error_codes/src/error_codes.rs";
 const ERROR_DOCS_PATH: &str = "compiler/rustc_error_codes/src/error_codes/";
-const ERROR_TESTS_PATH: &str = "src/test/ui/error-codes/";
+const ERROR_TESTS_PATH: &str = "tests/ui/error-codes/";
 
 // Error codes that (for some reason) can't have a doctest in their explanation. Error codes are still expected to provide a code example, even if untested.
 const IGNORE_DOCTEST_CHECK: &[&str] =
@@ -270,14 +270,14 @@ fn check_error_codes_tests(
         if !test_path.exists() && !IGNORE_UI_TEST_CHECK.contains(&code.as_str()) {
             verbose_print!(
                 verbose,
-                "warning: Error code `{code}` needs to have at least one UI test in the `src/test/ui/error-codes/` directory`!"
+                "warning: Error code `{code}` needs to have at least one UI test in the `tests/error-codes/` directory`!"
             );
             continue;
         }
         if IGNORE_UI_TEST_CHECK.contains(&code.as_str()) {
             if test_path.exists() {
                 errors.push(format!(
-                    "Error code `{code}` has a UI test in `src/test/ui/error-codes/{code}.rs`, it shouldn't be listed in `EXEMPTED_FROM_TEST`!"
+                    "Error code `{code}` has a UI test in `tests/ui/error-codes/{code}.rs`, it shouldn't be listed in `EXEMPTED_FROM_TEST`!"
                 ));
             }
             continue;
diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs
index f10ecf5f201..af92e6eb863 100644
--- a/src/tools/tidy/src/features.rs
+++ b/src/tools/tidy/src/features.rs
@@ -82,6 +82,7 @@ pub fn collect_lib_features(base_src_path: &Path) -> Features {
 
 pub fn check(
     src_path: &Path,
+    tests_path: &Path,
     compiler_path: &Path,
     lib_path: &Path,
     bad: &mut bool,
@@ -95,10 +96,10 @@ pub fn check(
 
     walk_many(
         &[
-            &src_path.join("test/ui"),
-            &src_path.join("test/ui-fulldeps"),
-            &src_path.join("test/rustdoc-ui"),
-            &src_path.join("test/rustdoc"),
+            &tests_path.join("ui"),
+            &tests_path.join("ui-fulldeps"),
+            &tests_path.join("rustdoc-ui"),
+            &tests_path.join("rustdoc"),
         ],
         &mut filter_dirs,
         &mut |entry, contents| {
@@ -480,7 +481,7 @@ fn map_lib_features(
 ) {
     walk(
         base_src_path,
-        &mut |path| filter_dirs(path) || path.ends_with("src/test"),
+        &mut |path| filter_dirs(path) || path.ends_with("tests"),
         &mut |entry, contents| {
             let file = entry.path();
             let filename = file.file_name().unwrap().to_string_lossy();
diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs
index a5685ba7c94..2a4853b37be 100644
--- a/src/tools/tidy/src/main.rs
+++ b/src/tools/tidy/src/main.rs
@@ -25,6 +25,7 @@ fn main() {
             .expect("concurrency must be a number");
 
     let src_path = root_path.join("src");
+    let tests_path = root_path.join("tests");
     let library_path = root_path.join("library");
     let compiler_path = root_path.join("compiler");
     let librustdoc_path = src_path.join("librustdoc");
@@ -68,16 +69,16 @@ fn main() {
             }
         }
 
-        check!(target_specific_tests, &src_path);
+        check!(target_specific_tests, &tests_path);
 
         // Checks that are done on the cargo workspace.
         check!(deps, &root_path, &cargo);
         check!(extdeps, &root_path);
 
         // Checks over tests.
-        check!(debug_artifacts, &src_path);
-        check!(ui_tests, &src_path);
-        check!(mir_opt_tests, &src_path, bless);
+        check!(debug_artifacts, &tests_path);
+        check!(ui_tests, &tests_path);
+        check!(mir_opt_tests, &tests_path, bless);
 
         // Checks that only make sense for the compiler.
         check!(error_codes, &root_path, &[&compiler_path, &librustdoc_path], verbose);
@@ -88,6 +89,7 @@ fn main() {
 
         // Checks that need to be done for both the compiler and std libraries.
         check!(unit_tests, &src_path);
+        check!(unit_tests, &tests_path);
         check!(unit_tests, &compiler_path);
         check!(unit_tests, &library_path);
 
@@ -96,14 +98,17 @@ fn main() {
         }
 
         check!(style, &src_path);
+        check!(style, &tests_path);
         check!(style, &compiler_path);
         check!(style, &library_path);
 
         check!(edition, &src_path);
         check!(edition, &compiler_path);
         check!(edition, &library_path);
+        check!(edition, &tests_path);
 
         check!(alphabetical, &src_path);
+        check!(alphabetical, &tests_path);
         check!(alphabetical, &compiler_path);
         check!(alphabetical, &library_path);
 
@@ -113,7 +118,14 @@ fn main() {
             drain_handles(&mut handles);
 
             let mut flag = false;
-            let r = features::check(&src_path, &compiler_path, &library_path, &mut flag, verbose);
+            let r = features::check(
+                &src_path,
+                &tests_path,
+                &compiler_path,
+                &library_path,
+                &mut flag,
+                verbose,
+            );
             if flag {
                 bad.store(true, Ordering::Relaxed);
             }
diff --git a/src/tools/tidy/src/mir_opt_tests.rs b/src/tools/tidy/src/mir_opt_tests.rs
index 018573284ea..2a9dcac2e8d 100644
--- a/src/tools/tidy/src/mir_opt_tests.rs
+++ b/src/tools/tidy/src/mir_opt_tests.rs
@@ -6,7 +6,7 @@ use std::path::{Path, PathBuf};
 fn check_unused_files(path: &Path, bless: bool, bad: &mut bool) {
     let mut rs_files = Vec::<PathBuf>::new();
     let mut output_files = HashSet::<PathBuf>::new();
-    let files = walkdir::WalkDir::new(&path.join("test/mir-opt")).into_iter();
+    let files = walkdir::WalkDir::new(&path.join("mir-opt")).into_iter();
 
     for file in files.filter_map(Result::ok).filter(|e| e.file_type().is_file()) {
         let filepath = file.path();
@@ -41,7 +41,7 @@ fn check_unused_files(path: &Path, bless: bool, bad: &mut bool) {
 }
 
 fn check_dash_files(path: &Path, bless: bool, bad: &mut bool) {
-    for file in walkdir::WalkDir::new(&path.join("test/mir-opt"))
+    for file in walkdir::WalkDir::new(&path.join("mir-opt"))
         .into_iter()
         .filter_map(Result::ok)
         .filter(|e| e.file_type().is_file())
diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs
index b293efdc585..5c4ba869364 100644
--- a/src/tools/tidy/src/style.rs
+++ b/src/tools/tidy/src/style.rs
@@ -246,7 +246,7 @@ pub fn check(path: &Path, bad: &mut bool) {
             // This list should ideally be sourced from rustfmt.toml but we don't want to add a toml
             // parser to tidy.
             !file.ancestors().any(|a| {
-                a.ends_with("src/test") ||
+                (a.ends_with("tests") && a.join("COMPILER_TESTS.md").exists()) ||
                     a.ends_with("src/doc/book")
             });
 
@@ -324,9 +324,10 @@ pub fn check(path: &Path, bad: &mut bool) {
 
             if trimmed.contains("dbg!")
                 && !trimmed.starts_with("//")
-                && !file
-                    .ancestors()
-                    .any(|a| a.ends_with("src/test") || a.ends_with("library/alloc/tests"))
+                && !file.ancestors().any(|a| {
+                    (a.ends_with("tests") && a.join("COMPILER_TESTS.md").exists())
+                        || a.ends_with("library/alloc/tests")
+                })
                 && filename != "tests.rs"
             {
                 suppressible_tidy_err!(
diff --git a/src/tools/tidy/src/target_specific_tests.rs b/src/tools/tidy/src/target_specific_tests.rs
index 8ba25705666..d7a157672cf 100644
--- a/src/tools/tidy/src/target_specific_tests.rs
+++ b/src/tools/tidy/src/target_specific_tests.rs
@@ -35,9 +35,8 @@ struct RevisionInfo<'a> {
 }
 
 pub fn check(path: &Path, bad: &mut bool) {
-    let tests = path.join("test");
     crate::walk::walk(
-        &tests,
+        path,
         &mut |path| path.extension().map(|p| p == "rs") == Some(false),
         &mut |entry, content| {
             let file = entry.path().display();
diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs
index 166d09fa8b0..806e84025c4 100644
--- a/src/tools/tidy/src/ui_tests.rs
+++ b/src/tools/tidy/src/ui_tests.rs
@@ -13,13 +13,13 @@ const ROOT_ENTRY_LIMIT: usize = 939;
 const ISSUES_ENTRY_LIMIT: usize = 1998;
 
 fn check_entries(path: &Path, bad: &mut bool) {
-    for dir in Walk::new(&path.join("test/ui")) {
+    for dir in Walk::new(&path.join("ui")) {
         if let Ok(entry) = dir {
             if entry.file_type().map(|ft| ft.is_dir()).unwrap_or(false) {
                 let dir_path = entry.path();
                 // Use special values for these dirs.
-                let is_root = path.join("test/ui") == dir_path;
-                let is_issues_dir = path.join("test/ui/issues") == dir_path;
+                let is_root = path.join("ui") == dir_path;
+                let is_issues_dir = path.join("ui/issues") == dir_path;
                 let limit = if is_root {
                     ROOT_ENTRY_LIMIT
                 } else if is_issues_dir {
@@ -53,7 +53,7 @@ fn check_entries(path: &Path, bad: &mut bool) {
 
 pub fn check(path: &Path, bad: &mut bool) {
     check_entries(&path, bad);
-    for path in &[&path.join("test/ui"), &path.join("test/ui-fulldeps")] {
+    for path in &[&path.join("ui"), &path.join("ui-fulldeps")] {
         crate::walk::walk_no_read(path, &mut |_| false, &mut |entry| {
             let file_path = entry.path();
             if let Some(ext) = file_path.extension() {
diff --git a/src/tools/tidy/src/unit_tests.rs b/src/tools/tidy/src/unit_tests.rs
index 2c23b6ebc75..27f36c85561 100644
--- a/src/tools/tidy/src/unit_tests.rs
+++ b/src/tools/tidy/src/unit_tests.rs
@@ -22,7 +22,7 @@ pub fn check(root_path: &Path, bad: &mut bool) {
         let file_name = path.file_name().unwrap_or_default();
         if path.is_dir() {
             filter_dirs(path)
-                || path.ends_with("src/test")
+                || path.ends_with("tests")
                 || path.ends_with("src/doc")
                 || (file_name == "tests" || file_name == "benches") && !is_core(path)
         } else {
diff --git a/tests/assembly/target-feature-multiple.rs b/tests/assembly/target-feature-multiple.rs
index 18d896e86b2..5c5d93863d7 100644
--- a/tests/assembly/target-feature-multiple.rs
+++ b/tests/assembly/target-feature-multiple.rs
@@ -14,7 +14,7 @@
 // > LLVM ERROR: Cannot select: 0x7f00f400c010: i32,i32,ch = X86ISD::RDSEED 0x7f00f400bfa8:2
 // > In function: foo
 //
-// See also src/test/codegen/target-feature-overrides.rs
+// See also tests/codegen/target-feature-overrides.rs
 #![feature(no_core, lang_items, link_llvm_intrinsics, abi_unadjusted)]
 #![crate_type = "lib"]
 #![no_core]
diff --git a/tests/codegen/match-optimized.rs b/tests/codegen/match-optimized.rs
index 36402cc7353..520c46a0d57 100644
--- a/tests/codegen/match-optimized.rs
+++ b/tests/codegen/match-optimized.rs
@@ -42,7 +42,7 @@ pub enum E2 {
 }
 
 // For optimized code we produce a switch with an unreachable target as the `otherwise` so LLVM
-// knows the possible values. Compare with `src/test/codegen/match-unoptimized.rs`.
+// knows the possible values. Compare with `tests/codegen/match-unoptimized.rs`.
 
 // CHECK-LABEL: @exhaustive_match_2
 #[no_mangle]
diff --git a/tests/codegen/match-unoptimized.rs b/tests/codegen/match-unoptimized.rs
index be40b29e3d3..78ea4f9b409 100644
--- a/tests/codegen/match-unoptimized.rs
+++ b/tests/codegen/match-unoptimized.rs
@@ -9,7 +9,7 @@ pub enum E2 {
 }
 
 // For unoptimized code we produce a `br` instead of a `switch`. Compare with
-// `src/test/codegen/match-optimized.rs`
+// `tests/codegen/match-optimized.rs`
 
 // CHECK-LABEL: @exhaustive_match_2
 #[no_mangle]
diff --git a/tests/codegen/target-feature-overrides.rs b/tests/codegen/target-feature-overrides.rs
index 4be77e36e76..1bebf66f0df 100644
--- a/tests/codegen/target-feature-overrides.rs
+++ b/tests/codegen/target-feature-overrides.rs
@@ -4,7 +4,7 @@
 // [COMPAT] compile-flags: -Ctarget-feature=+avx2,+avx
 // [INCOMPAT] compile-flags: -Ctarget-feature=-avx2,-avx
 
-// See also src/test/assembly/target-feature-multiple.rs
+// See also tests/assembly/target-feature-multiple.rs
 #![feature(no_core, lang_items)]
 #![crate_type = "lib"]
 #![no_core]
diff --git a/tests/mir-opt/remove_never_const.rs b/tests/mir-opt/remove_never_const.rs
index 16095cfdd7d..160cc955534 100644
--- a/tests/mir-opt/remove_never_const.rs
+++ b/tests/mir-opt/remove_never_const.rs
@@ -1,6 +1,6 @@
 // This was originally a regression test for #66975 - ensure that we do not generate never typed
 // consts in codegen. We also have tests for this that catches the error, see
-// src/test/ui/consts/const-eval/index-out-of-bounds-never-type.rs.
+// tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs.
 
 // Force generation of optimized mir for functions that do not reach codegen.
 // compile-flags: --emit mir,link
diff --git a/tests/pretty/block-comment-wchar.pp b/tests/pretty/block-comment-wchar.pp
index 8c8580b07c2..9d64fb4156c 100644
--- a/tests/pretty/block-comment-wchar.pp
+++ b/tests/pretty/block-comment-wchar.pp
@@ -1,6 +1,6 @@
 // This is meant as a test case for Issue 3961.
 //
-// Test via: rustc -Zunpretty normal src/test/pretty/block-comment-wchar.rs
+// Test via: rustc -Zunpretty normal tests/pretty/block-comment-wchar.rs
 // ignore-tidy-cr
 // ignore-tidy-tab
 // pp-exact:block-comment-wchar.pp
diff --git a/tests/pretty/block-comment-wchar.rs b/tests/pretty/block-comment-wchar.rs
index e0606e49752..c042ea68590 100644
--- a/tests/pretty/block-comment-wchar.rs
+++ b/tests/pretty/block-comment-wchar.rs
@@ -1,6 +1,6 @@
 // This is meant as a test case for Issue 3961.
 //
-// Test via: rustc -Zunpretty normal src/test/pretty/block-comment-wchar.rs
+// Test via: rustc -Zunpretty normal tests/pretty/block-comment-wchar.rs
 // ignore-tidy-cr
 // ignore-tidy-tab
 // pp-exact:block-comment-wchar.pp
diff --git a/tests/run-make-fulldeps/alloc-no-oom-handling/Makefile b/tests/run-make-fulldeps/alloc-no-oom-handling/Makefile
index 735d91bd27c..87f74c69c79 100644
--- a/tests/run-make-fulldeps/alloc-no-oom-handling/Makefile
+++ b/tests/run-make-fulldeps/alloc-no-oom-handling/Makefile
@@ -1,4 +1,4 @@
 include ../tools.mk
 
 all:
-	$(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../../library/alloc/src/lib.rs --cfg no_global_oom_handling
+	$(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/alloc/src/lib.rs --cfg no_global_oom_handling
diff --git a/tests/run-make-fulldeps/alloc-no-rc/Makefile b/tests/run-make-fulldeps/alloc-no-rc/Makefile
index 5f7ae70fa02..9824b17e6c2 100644
--- a/tests/run-make-fulldeps/alloc-no-rc/Makefile
+++ b/tests/run-make-fulldeps/alloc-no-rc/Makefile
@@ -1,4 +1,4 @@
 include ../tools.mk
 
 all:
-	$(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../../library/alloc/src/lib.rs --cfg no_rc
+	$(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/alloc/src/lib.rs --cfg no_rc
diff --git a/tests/run-make-fulldeps/alloc-no-sync/Makefile b/tests/run-make-fulldeps/alloc-no-sync/Makefile
index 6a258a2ddfd..04ec4c7d8bc 100644
--- a/tests/run-make-fulldeps/alloc-no-sync/Makefile
+++ b/tests/run-make-fulldeps/alloc-no-sync/Makefile
@@ -1,4 +1,4 @@
 include ../tools.mk
 
 all:
-	$(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../../library/alloc/src/lib.rs --cfg no_sync
+	$(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/alloc/src/lib.rs --cfg no_sync
diff --git a/tests/run-make-fulldeps/core-no-fp-fmt-parse/Makefile b/tests/run-make-fulldeps/core-no-fp-fmt-parse/Makefile
index ec05ebea555..837664d92b9 100644
--- a/tests/run-make-fulldeps/core-no-fp-fmt-parse/Makefile
+++ b/tests/run-make-fulldeps/core-no-fp-fmt-parse/Makefile
@@ -1,4 +1,4 @@
 include ../tools.mk
 
 all:
-	$(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../../library/core/src/lib.rs --cfg no_fp_fmt_parse
+	$(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/core/src/lib.rs --cfg no_fp_fmt_parse
diff --git a/tests/run-make-fulldeps/obtain-borrowck/Makefile b/tests/run-make-fulldeps/obtain-borrowck/Makefile
index 223993125c8..212d0f67d00 100644
--- a/tests/run-make-fulldeps/obtain-borrowck/Makefile
+++ b/tests/run-make-fulldeps/obtain-borrowck/Makefile
@@ -4,7 +4,7 @@ include ../tools.mk
 # together with the borrow checker information.
 
 # How to run this
-# $ ./x.py test src/test/run-make-fulldeps/obtain-borrowck
+# $ ./x.py test tests/run-make-fulldeps/obtain-borrowck
 
 DRIVER_BINARY := "$(TMPDIR)"/driver
 SYSROOT := $(shell $(RUSTC) --print sysroot)
diff --git a/tests/run-make/coverage/compiletest-ignore-dir b/tests/run-make/coverage/compiletest-ignore-dir
index b533b272d38..470ff996098 100644
--- a/tests/run-make/coverage/compiletest-ignore-dir
+++ b/tests/run-make/coverage/compiletest-ignore-dir
@@ -1,3 +1,3 @@
 # Directory "coverage" supports the tests at prefix ../coverage-*
 
-# Use ./x.py [options] test src/test/run-make/coverage to run all related tests.
+# Use ./x.py [options] test tests/run-make/coverage to run all related tests.
diff --git a/tests/run-make/repr128-dwarf/Makefile b/tests/run-make/repr128-dwarf/Makefile
index a840e3ee6d8..2b03c22c0d0 100644
--- a/tests/run-make/repr128-dwarf/Makefile
+++ b/tests/run-make/repr128-dwarf/Makefile
@@ -1,5 +1,5 @@
 # ignore-windows
-# This test should be replaced with one in src/test/debuginfo once GDB or LLDB support 128-bit
+# This test should be replaced with one in tests/debuginfo once GDB or LLDB support 128-bit
 # enums.
 
 include ../../run-make-fulldeps/tools.mk
diff --git a/tests/run-make/static-pie/Makefile b/tests/run-make/static-pie/Makefile
index e71770636ee..f4e6adf1b18 100644
--- a/tests/run-make/static-pie/Makefile
+++ b/tests/run-make/static-pie/Makefile
@@ -5,7 +5,7 @@ include ../../run-make-fulldeps/tools.mk
 # ignore-gnux32
 
 # How to manually run this
-# $ ./x.py test --target x86_64-unknown-linux-[musl,gnu] src/test/run-make/static-pie
+# $ ./x.py test --target x86_64-unknown-linux-[musl,gnu] tests/run-make/static-pie
 
 all: test-clang test-gcc
 
diff --git a/tests/run-make/thumb-none-cortex-m/Makefile b/tests/run-make/thumb-none-cortex-m/Makefile
index aa046af95da..3065141c08a 100644
--- a/tests/run-make/thumb-none-cortex-m/Makefile
+++ b/tests/run-make/thumb-none-cortex-m/Makefile
@@ -2,7 +2,7 @@ include ../../run-make-fulldeps/tools.mk
 
 # How to run this
 # $ ./x.py clean
-# $ ./x.py test --target thumbv6m-none-eabi,thumbv7m-none-eabi src/test/run-make
+# $ ./x.py test --target thumbv6m-none-eabi,thumbv7m-none-eabi tests/run-make
 
 # Supported targets:
 # - thumbv6m-none-eabi (Bare Cortex-M0, M0+, M1)
diff --git a/tests/run-make/thumb-none-qemu/Makefile b/tests/run-make/thumb-none-qemu/Makefile
index 328758d41ba..a1c2ba12cd0 100644
--- a/tests/run-make/thumb-none-qemu/Makefile
+++ b/tests/run-make/thumb-none-qemu/Makefile
@@ -4,7 +4,7 @@ include ../../run-make-fulldeps/tools.mk
 
 # How to run this
 # $ ./x.py clean
-# $ ./x.py test --target thumbv7m-none-eabi src/test/run-make
+# $ ./x.py test --target thumbv7m-none-eabi tests/run-make
 
 # For cargo setting
 export RUSTC := $(RUSTC_ORIGINAL)
diff --git a/tests/rustdoc-gui/README.md b/tests/rustdoc-gui/README.md
index d9854e2e715..1126a72ab67 100644
--- a/tests/rustdoc-gui/README.md
+++ b/tests/rustdoc-gui/README.md
@@ -11,14 +11,14 @@ You can find more information and its documentation in its [repository][browser-
 If you need to have more information on the tests run, you can use `--test-args`:
 
 ```bash
-$ ./x.py test src/test/rustdoc-gui --stage 1 --test-args --debug
+$ ./x.py test tests/rustdoc-gui --stage 1 --test-args --debug
 ```
 
 If you don't want to run in headless mode (helpful to debug sometimes), you can use
 `--no-headless`:
 
 ```bash
-$ ./x.py test src/test/rustdoc-gui --stage 1 --test-args --no-headless
+$ ./x.py test tests/rustdoc-gui --stage 1 --test-args --no-headless
 ```
 
 To see the supported options, use `--help`.
@@ -27,7 +27,7 @@ Important to be noted: if the chromium instance crashes when you run it, you mig
 use `--no-sandbox` to make it work:
 
 ```bash
-$ ./x.py test src/test/rustdoc-gui --stage 1 --test-args --no-sandbox
+$ ./x.py test tests/rustdoc-gui --stage 1 --test-args --no-sandbox
 ```
 
 [browser-ui-test]: https://github.com/GuillaumeGomez/browser-UI-test/
diff --git a/tests/rustdoc-ui/cfg-test.rs b/tests/rustdoc-ui/cfg-test.rs
index d4ca9258587..d40b9283735 100644
--- a/tests/rustdoc-ui/cfg-test.rs
+++ b/tests/rustdoc-ui/cfg-test.rs
@@ -1,6 +1,6 @@
 // check-pass
 // compile-flags:--test --test-args --test-threads=1
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 
 // Crates like core have doctests gated on `cfg(not(test))` so we need to make
diff --git a/tests/rustdoc-ui/check-cfg-test.rs b/tests/rustdoc-ui/check-cfg-test.rs
index 626cc838704..920432276cb 100644
--- a/tests/rustdoc-ui/check-cfg-test.rs
+++ b/tests/rustdoc-ui/check-cfg-test.rs
@@ -1,7 +1,7 @@
 // check-pass
 // compile-flags: --test --nocapture --check-cfg=values(feature,"test") -Z unstable-options
-// normalize-stderr-test: "src/test/rustdoc-ui" -> "$$DIR"
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stderr-test: "tests/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 
 /// The doctest will produce a warning because feature invalid is unexpected
diff --git a/tests/rustdoc-ui/coverage/basic.stdout b/tests/rustdoc-ui/coverage/basic.stdout
index 3c602b3da4c..545662f0f3d 100644
--- a/tests/rustdoc-ui/coverage/basic.stdout
+++ b/tests/rustdoc-ui/coverage/basic.stdout
@@ -1,7 +1,7 @@
 +-------------------------------------+------------+------------+------------+------------+
 | File                                | Documented | Percentage |   Examples | Percentage |
 +-------------------------------------+------------+------------+------------+------------+
-| ...est/rustdoc-ui/coverage/basic.rs |          7 |      50.0% |          0 |       0.0% |
+| ...sts/rustdoc-ui/coverage/basic.rs |          7 |      50.0% |          0 |       0.0% |
 +-------------------------------------+------------+------------+------------+------------+
 | Total                               |          7 |      50.0% |          0 |       0.0% |
 +-------------------------------------+------------+------------+------------+------------+
diff --git a/tests/rustdoc-ui/coverage/empty.stdout b/tests/rustdoc-ui/coverage/empty.stdout
index 890a7d56e16..d486825287b 100644
--- a/tests/rustdoc-ui/coverage/empty.stdout
+++ b/tests/rustdoc-ui/coverage/empty.stdout
@@ -1,7 +1,7 @@
 +-------------------------------------+------------+------------+------------+------------+
 | File                                | Documented | Percentage |   Examples | Percentage |
 +-------------------------------------+------------+------------+------------+------------+
-| ...est/rustdoc-ui/coverage/empty.rs |          0 |       0.0% |          0 |       0.0% |
+| ...sts/rustdoc-ui/coverage/empty.rs |          0 |       0.0% |          0 |       0.0% |
 +-------------------------------------+------------+------------+------------+------------+
 | Total                               |          0 |       0.0% |          0 |       0.0% |
 +-------------------------------------+------------+------------+------------+------------+
diff --git a/tests/rustdoc-ui/coverage/enums.stdout b/tests/rustdoc-ui/coverage/enums.stdout
index 64c012c1f66..bb224aac8c0 100644
--- a/tests/rustdoc-ui/coverage/enums.stdout
+++ b/tests/rustdoc-ui/coverage/enums.stdout
@@ -1,7 +1,7 @@
 +-------------------------------------+------------+------------+------------+------------+
 | File                                | Documented | Percentage |   Examples | Percentage |
 +-------------------------------------+------------+------------+------------+------------+
-| ...est/rustdoc-ui/coverage/enums.rs |          6 |      75.0% |          0 |       0.0% |
+| ...sts/rustdoc-ui/coverage/enums.rs |          6 |      75.0% |          0 |       0.0% |
 +-------------------------------------+------------+------------+------------+------------+
 | Total                               |          6 |      75.0% |          0 |       0.0% |
 +-------------------------------------+------------+------------+------------+------------+
diff --git a/tests/rustdoc-ui/coverage/exotic.stdout b/tests/rustdoc-ui/coverage/exotic.stdout
index 27798b81310..bd894898cc4 100644
--- a/tests/rustdoc-ui/coverage/exotic.stdout
+++ b/tests/rustdoc-ui/coverage/exotic.stdout
@@ -1,7 +1,7 @@
 +-------------------------------------+------------+------------+------------+------------+
 | File                                | Documented | Percentage |   Examples | Percentage |
 +-------------------------------------+------------+------------+------------+------------+
-| ...st/rustdoc-ui/coverage/exotic.rs |          3 |     100.0% |          0 |       0.0% |
+| ...ts/rustdoc-ui/coverage/exotic.rs |          3 |     100.0% |          0 |       0.0% |
 +-------------------------------------+------------+------------+------------+------------+
 | Total                               |          3 |     100.0% |          0 |       0.0% |
 +-------------------------------------+------------+------------+------------+------------+
diff --git a/tests/rustdoc-ui/coverage/private.stdout b/tests/rustdoc-ui/coverage/private.stdout
index 37a0f5187b5..b9981c7c50a 100644
--- a/tests/rustdoc-ui/coverage/private.stdout
+++ b/tests/rustdoc-ui/coverage/private.stdout
@@ -1,7 +1,7 @@
 +-------------------------------------+------------+------------+------------+------------+
 | File                                | Documented | Percentage |   Examples | Percentage |
 +-------------------------------------+------------+------------+------------+------------+
-| ...t/rustdoc-ui/coverage/private.rs |          4 |      57.1% |          0 |       0.0% |
+| ...s/rustdoc-ui/coverage/private.rs |          4 |      57.1% |          0 |       0.0% |
 +-------------------------------------+------------+------------+------------+------------+
 | Total                               |          4 |      57.1% |          0 |       0.0% |
 +-------------------------------------+------------+------------+------------+------------+
diff --git a/tests/rustdoc-ui/coverage/traits.stdout b/tests/rustdoc-ui/coverage/traits.stdout
index 5053d02090c..0c7857cf29c 100644
--- a/tests/rustdoc-ui/coverage/traits.stdout
+++ b/tests/rustdoc-ui/coverage/traits.stdout
@@ -1,7 +1,7 @@
 +-------------------------------------+------------+------------+------------+------------+
 | File                                | Documented | Percentage |   Examples | Percentage |
 +-------------------------------------+------------+------------+------------+------------+
-| ...st/rustdoc-ui/coverage/traits.rs |          8 |      88.9% |          0 |       0.0% |
+| ...ts/rustdoc-ui/coverage/traits.rs |          8 |      88.9% |          0 |       0.0% |
 +-------------------------------------+------------+------------+------------+------------+
 | Total                               |          8 |      88.9% |          0 |       0.0% |
 +-------------------------------------+------------+------------+------------+------------+
diff --git a/tests/rustdoc-ui/display-output.rs b/tests/rustdoc-ui/display-output.rs
index ec27a9f6ba3..23bc54e3cde 100644
--- a/tests/rustdoc-ui/display-output.rs
+++ b/tests/rustdoc-ui/display-output.rs
@@ -3,7 +3,7 @@
 // check-pass
 // edition:2018
 // compile-flags:--test --test-args=--show-output
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 
 /// ```
diff --git a/tests/rustdoc-ui/doc-comment-multi-line-attr.rs b/tests/rustdoc-ui/doc-comment-multi-line-attr.rs
index 97259f782bd..db674e229fc 100644
--- a/tests/rustdoc-ui/doc-comment-multi-line-attr.rs
+++ b/tests/rustdoc-ui/doc-comment-multi-line-attr.rs
@@ -1,6 +1,6 @@
 // Regression test for #97440: Multiline inner attribute triggers ICE during doctest
 // compile-flags:--test
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // check-pass
 
diff --git a/tests/rustdoc-ui/doc-comment-multi-line-cfg-attr.rs b/tests/rustdoc-ui/doc-comment-multi-line-cfg-attr.rs
index b2a8133c90e..6ce3cb9fc07 100644
--- a/tests/rustdoc-ui/doc-comment-multi-line-cfg-attr.rs
+++ b/tests/rustdoc-ui/doc-comment-multi-line-cfg-attr.rs
@@ -1,5 +1,5 @@
 // compile-flags:--test
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // check-pass
 
diff --git a/tests/rustdoc-ui/doc-test-doctest-feature.rs b/tests/rustdoc-ui/doc-test-doctest-feature.rs
index 0b79aaece8a..88cf44e643b 100644
--- a/tests/rustdoc-ui/doc-test-doctest-feature.rs
+++ b/tests/rustdoc-ui/doc-test-doctest-feature.rs
@@ -1,6 +1,6 @@
 // check-pass
 // compile-flags:--test
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 
 // Make sure `cfg(doctest)` is set when finding doctests but not inside
diff --git a/tests/rustdoc-ui/doc-test-rustdoc-feature.rs b/tests/rustdoc-ui/doc-test-rustdoc-feature.rs
index bf334c67eca..dc72a485764 100644
--- a/tests/rustdoc-ui/doc-test-rustdoc-feature.rs
+++ b/tests/rustdoc-ui/doc-test-rustdoc-feature.rs
@@ -1,6 +1,6 @@
 // check-pass
 // compile-flags:--test
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 
 #![feature(doc_cfg)]
diff --git a/tests/rustdoc-ui/doctest-multiline-crate-attribute.rs b/tests/rustdoc-ui/doctest-multiline-crate-attribute.rs
index a30472ac56b..260f5a7a64f 100644
--- a/tests/rustdoc-ui/doctest-multiline-crate-attribute.rs
+++ b/tests/rustdoc-ui/doctest-multiline-crate-attribute.rs
@@ -1,5 +1,5 @@
 // compile-flags:--test --test-args=--test-threads=1
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // check-pass
 
diff --git a/tests/rustdoc-ui/doctest-output.rs b/tests/rustdoc-ui/doctest-output.rs
index 2670fa57201..303f7689698 100644
--- a/tests/rustdoc-ui/doctest-output.rs
+++ b/tests/rustdoc-ui/doctest-output.rs
@@ -1,7 +1,7 @@
 // edition:2018
 // aux-build:extern_macros.rs
 // compile-flags:--test --test-args=--test-threads=1
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // check-pass
 
diff --git a/tests/rustdoc-ui/failed-doctest-compile-fail.rs b/tests/rustdoc-ui/failed-doctest-compile-fail.rs
index 6f2ff5d703a..4dfca600f16 100644
--- a/tests/rustdoc-ui/failed-doctest-compile-fail.rs
+++ b/tests/rustdoc-ui/failed-doctest-compile-fail.rs
@@ -2,7 +2,7 @@
 // adapted to use that, and that normalize line can go away
 
 // compile-flags:--test
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // failure-status: 101
 
diff --git a/tests/rustdoc-ui/failed-doctest-extra-semicolon-on-item.rs b/tests/rustdoc-ui/failed-doctest-extra-semicolon-on-item.rs
index 16d737106ea..03a5b9d5d84 100644
--- a/tests/rustdoc-ui/failed-doctest-extra-semicolon-on-item.rs
+++ b/tests/rustdoc-ui/failed-doctest-extra-semicolon-on-item.rs
@@ -2,7 +2,7 @@
 // adapted to use that, and that normalize line can go away
 
 // compile-flags:--test
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // failure-status: 101
 
diff --git a/tests/rustdoc-ui/failed-doctest-missing-codes.rs b/tests/rustdoc-ui/failed-doctest-missing-codes.rs
index 57b70b478e6..66a229a0c75 100644
--- a/tests/rustdoc-ui/failed-doctest-missing-codes.rs
+++ b/tests/rustdoc-ui/failed-doctest-missing-codes.rs
@@ -2,7 +2,7 @@
 // adapted to use that, and that normalize line can go away
 
 // compile-flags:--test
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // failure-status: 101
 
diff --git a/tests/rustdoc-ui/failed-doctest-output-windows.rs b/tests/rustdoc-ui/failed-doctest-output-windows.rs
index 4cd9993d8d5..456a9e68f20 100644
--- a/tests/rustdoc-ui/failed-doctest-output-windows.rs
+++ b/tests/rustdoc-ui/failed-doctest-output-windows.rs
@@ -7,7 +7,7 @@
 
 // compile-flags:--test --test-args --test-threads=1
 // rustc-env:RUST_BACKTRACE=0
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // failure-status: 101
 
diff --git a/tests/rustdoc-ui/failed-doctest-output.rs b/tests/rustdoc-ui/failed-doctest-output.rs
index 42de954d052..77647f8eca9 100644
--- a/tests/rustdoc-ui/failed-doctest-output.rs
+++ b/tests/rustdoc-ui/failed-doctest-output.rs
@@ -7,7 +7,7 @@
 
 // compile-flags:--test --test-args --test-threads=1
 // rustc-env:RUST_BACKTRACE=0
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // failure-status: 101
 
diff --git a/tests/rustdoc-ui/failed-doctest-should-panic.rs b/tests/rustdoc-ui/failed-doctest-should-panic.rs
index 2b8bb31686f..c134f80064d 100644
--- a/tests/rustdoc-ui/failed-doctest-should-panic.rs
+++ b/tests/rustdoc-ui/failed-doctest-should-panic.rs
@@ -2,7 +2,7 @@
 // adapted to use that, and that normalize line can go away
 
 // compile-flags:--test
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // failure-status: 101
 
diff --git a/tests/rustdoc-ui/issue-80992.rs b/tests/rustdoc-ui/issue-80992.rs
index 8983439bb64..80ff225b879 100644
--- a/tests/rustdoc-ui/issue-80992.rs
+++ b/tests/rustdoc-ui/issue-80992.rs
@@ -1,6 +1,6 @@
 // check-pass
 // compile-flags:--test
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 
 pub fn test() -> Result<(), ()> {
diff --git a/tests/rustdoc-ui/issue-81662-shortness.rs b/tests/rustdoc-ui/issue-81662-shortness.rs
index 27a21a313bc..8a90813b31d 100644
--- a/tests/rustdoc-ui/issue-81662-shortness.rs
+++ b/tests/rustdoc-ui/issue-81662-shortness.rs
@@ -1,5 +1,5 @@
 // compile-flags:--test --error-format=short
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // failure-status: 101
 
diff --git a/tests/rustdoc-ui/issue-91134.rs b/tests/rustdoc-ui/issue-91134.rs
index d2ff3a25226..42703ee4d79 100644
--- a/tests/rustdoc-ui/issue-91134.rs
+++ b/tests/rustdoc-ui/issue-91134.rs
@@ -1,7 +1,7 @@
 // compile-flags: --test --crate-name=empty_fn --extern=empty_fn --test-args=--test-threads=1
 // aux-build:empty-fn.rs
 // check-pass
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // edition:2021
 
diff --git a/tests/rustdoc-ui/no-run-flag.rs b/tests/rustdoc-ui/no-run-flag.rs
index da1672c4a6e..181730eb416 100644
--- a/tests/rustdoc-ui/no-run-flag.rs
+++ b/tests/rustdoc-ui/no-run-flag.rs
@@ -2,7 +2,7 @@
 
 // check-pass
 // compile-flags:-Z unstable-options --test --no-run --test-args=--test-threads=1
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 
 /// ```
diff --git a/tests/rustdoc-ui/nocapture-fail.rs b/tests/rustdoc-ui/nocapture-fail.rs
index 7706bd1f3e3..9a3fb592c63 100644
--- a/tests/rustdoc-ui/nocapture-fail.rs
+++ b/tests/rustdoc-ui/nocapture-fail.rs
@@ -1,7 +1,7 @@
 // check-pass
 // compile-flags:--test -Zunstable-options --nocapture
-// normalize-stderr-test: "src/test/rustdoc-ui" -> "$$DIR"
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stderr-test: "tests/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 
 /// ```compile_fail
diff --git a/tests/rustdoc-ui/nocapture.rs b/tests/rustdoc-ui/nocapture.rs
index 321f5ca08ed..3eb38f2fb3b 100644
--- a/tests/rustdoc-ui/nocapture.rs
+++ b/tests/rustdoc-ui/nocapture.rs
@@ -1,6 +1,6 @@
 // check-pass
 // compile-flags:--test -Zunstable-options --nocapture
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 
 /// ```
diff --git a/tests/rustdoc-ui/run-directory.rs b/tests/rustdoc-ui/run-directory.rs
index 0d432c1e699..bbceaaf824f 100644
--- a/tests/rustdoc-ui/run-directory.rs
+++ b/tests/rustdoc-ui/run-directory.rs
@@ -4,7 +4,7 @@
 // check-pass
 // [correct]compile-flags:--test --test-run-directory={{src-base}} -Zunstable-options
 // [incorrect]compile-flags:--test --test-run-directory={{src-base}}/coverage -Zunstable-options
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 
 /// ```
diff --git a/tests/rustdoc-ui/test-no_std.rs b/tests/rustdoc-ui/test-no_std.rs
index ee919985e7a..51abf1c7217 100644
--- a/tests/rustdoc-ui/test-no_std.rs
+++ b/tests/rustdoc-ui/test-no_std.rs
@@ -1,5 +1,5 @@
 // compile-flags:--test
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // check-pass
 
diff --git a/tests/rustdoc-ui/test-type.rs b/tests/rustdoc-ui/test-type.rs
index 882da5c2503..7f5a8f3fc41 100644
--- a/tests/rustdoc-ui/test-type.rs
+++ b/tests/rustdoc-ui/test-type.rs
@@ -1,6 +1,6 @@
 // compile-flags: --test --test-args=--test-threads=1
 // check-pass
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 
 /// ```
diff --git a/tests/rustdoc-ui/unparseable-doc-test.rs b/tests/rustdoc-ui/unparseable-doc-test.rs
index 0cff8cd9a33..f0a56a91bf5 100644
--- a/tests/rustdoc-ui/unparseable-doc-test.rs
+++ b/tests/rustdoc-ui/unparseable-doc-test.rs
@@ -1,5 +1,5 @@
 // compile-flags: --test
-// normalize-stdout-test: "src/test/rustdoc-ui" -> "$$DIR"
+// normalize-stdout-test: "tests/rustdoc-ui" -> "$$DIR"
 // normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"
 // failure-status: 101
 // rustc-env: RUST_BACKTRACE=0
diff --git a/tests/ui/abi/homogenous-floats-target-feature-mixup.rs b/tests/ui/abi/homogenous-floats-target-feature-mixup.rs
index d7f5e19219e..4600bd090cc 100644
--- a/tests/ui/abi/homogenous-floats-target-feature-mixup.rs
+++ b/tests/ui/abi/homogenous-floats-target-feature-mixup.rs
@@ -1,7 +1,7 @@
 // This test check that even if we mixup target feature of function with homogenous floats,
 // the abi is sound and still produce the right answer.
 //
-// This is basically the same test as src/test/ui/simd/target-feature-mixup.rs but for floats and
+// This is basically the same test as tests/ui/simd/target-feature-mixup.rs but for floats and
 // without #[repr(simd)]
 
 // run-pass
diff --git a/tests/ui/cfg/assume-incomplete-release/auxiliary/ver-cfg-rel.rs b/tests/ui/cfg/assume-incomplete-release/auxiliary/ver-cfg-rel.rs
index 6787527027e..067c620f5fe 100644
--- a/tests/ui/cfg/assume-incomplete-release/auxiliary/ver-cfg-rel.rs
+++ b/tests/ui/cfg/assume-incomplete-release/auxiliary/ver-cfg-rel.rs
@@ -8,7 +8,7 @@ use proc_macro::{TokenStream, TokenTree as Tt};
 use std::str::FromStr;
 
 // String containing the current version number of the tip, i.e. "1.41.2"
-static VERSION_NUMBER: &str = include_str!("../../../../../version");
+static VERSION_NUMBER: &str = include_str!("../../../../../src/version");
 
 #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
 struct Version {
diff --git a/tests/ui/crate-loading/crateresolve1.rs b/tests/ui/crate-loading/crateresolve1.rs
index f5477f244dd..61a1ee263ed 100644
--- a/tests/ui/crate-loading/crateresolve1.rs
+++ b/tests/ui/crate-loading/crateresolve1.rs
@@ -6,7 +6,7 @@
 // normalize-stderr-test: "\\\?\\" -> ""
 // normalize-stderr-test: "(lib)?crateresolve1-([123])\.[a-z]+" -> "libcrateresolve1-$2.somelib"
 
-// NOTE: This test is duplicated at `src/test/ui/error-codes/E0464.rs`.
+// NOTE: This test is duplicated at `tests/ui/error-codes/E0464.rs`.
 
 extern crate crateresolve1;
 //~^ ERROR multiple candidates for `rlib` dependency `crateresolve1` found
diff --git a/tests/ui/error-codes/E0464.rs b/tests/ui/error-codes/E0464.rs
index 554f1ce72d9..47717fbd508 100644
--- a/tests/ui/error-codes/E0464.rs
+++ b/tests/ui/error-codes/E0464.rs
@@ -6,7 +6,7 @@
 // normalize-stderr-test: "\\\?\\" -> ""
 // normalize-stderr-test: "(lib)?crateresolve1-([123])\.[a-z]+" -> "libcrateresolve1-$2.somelib"
 
-// NOTE: This test is duplicated from `src/test/ui/crate-loading/crateresolve1.rs`.
+// NOTE: This test is duplicated from `tests/ui/crate-loading/crateresolve1.rs`.
 
 extern crate crateresolve1;
 //~^ ERROR multiple candidates for `rlib` dependency `crateresolve1` found
diff --git a/tests/ui/error-codes/E0711.rs b/tests/ui/error-codes/E0711.rs
index 7d2044a7da2..7b1a217bdec 100644
--- a/tests/ui/error-codes/E0711.rs
+++ b/tests/ui/error-codes/E0711.rs
@@ -1,4 +1,4 @@
-// copied from: src/test/ui/feature-gates/stability-attribute-consistency.rs
+// copied from: tests/ui/feature-gates/stability-attribute-consistency.rs
 
 #![feature(staged_api)]
 
diff --git a/tests/ui/functions-closures/closure-expected-type/README.md b/tests/ui/functions-closures/closure-expected-type/README.md
index 11d2c9b7fb7..0b749040a0e 100644
--- a/tests/ui/functions-closures/closure-expected-type/README.md
+++ b/tests/ui/functions-closures/closure-expected-type/README.md
@@ -5,4 +5,4 @@ inputs. This investigation was kicked off by #38714, which revealed
 some pretty deep flaws in the ad-hoc way that we were doing things
 before.
 
-See also `src/test/ui/closure-expected-type`.
+See also `tests/ui/closure-expected-type`.
diff --git a/tests/ui/generator/drop-control-flow.rs b/tests/ui/generator/drop-control-flow.rs
index d383680002f..c6efda9541f 100644
--- a/tests/ui/generator/drop-control-flow.rs
+++ b/tests/ui/generator/drop-control-flow.rs
@@ -18,7 +18,7 @@ impl !Send for NonSend {}
 
 fn assert_send<T: Send>(_: T) {}
 
-// This test case is reduced from src/test/ui/drop/dynamic-drop-async.rs
+// This test case is reduced from tests/ui/drop/dynamic-drop-async.rs
 fn one_armed_if(arg: bool) {
     let _ = || {
         let arr = [Ptr];
diff --git a/tests/ui/generator/print/generator-print-verbose-1.rs b/tests/ui/generator/print/generator-print-verbose-1.rs
index fe0687722b0..89124ad7289 100644
--- a/tests/ui/generator/print/generator-print-verbose-1.rs
+++ b/tests/ui/generator/print/generator-print-verbose-1.rs
@@ -1,6 +1,6 @@
 // compile-flags: -Zverbose
 
-// Same as: src/test/ui/generator/issue-68112.stderr
+// Same as: tests/ui/generator/issue-68112.stderr
 
 #![feature(generators, generator_trait)]
 
diff --git a/tests/ui/hashmap/hashmap-memory.rs b/tests/ui/hashmap/hashmap-memory.rs
index 2031196ab21..87f8b6ad573 100644
--- a/tests/ui/hashmap/hashmap-memory.rs
+++ b/tests/ui/hashmap/hashmap-memory.rs
@@ -90,5 +90,5 @@ mod map_reduce {
 
 pub fn main() {
     map_reduce::map_reduce(
-        vec!["../src/test/run-pass/hashmap-memory.rs".to_string()]);
+        vec!["../tests/run-pass/hashmap-memory.rs".to_string()]);
 }
diff --git a/tests/ui/intrinsics/intrinsic-unreachable.rs b/tests/ui/intrinsics/intrinsic-unreachable.rs
index da1a32d58ea..73dd71d482f 100644
--- a/tests/ui/intrinsics/intrinsic-unreachable.rs
+++ b/tests/ui/intrinsics/intrinsic-unreachable.rs
@@ -3,7 +3,7 @@
 
 use std::intrinsics;
 
-// See also src/test/run-make/intrinsic-unreachable.
+// See also tests/run-make/intrinsic-unreachable.
 
 unsafe fn f(x: usize) -> usize {
     match x {
diff --git a/tests/ui/let-else/let-else-bindings.rs b/tests/ui/let-else/let-else-bindings.rs
index 7d2cad978fc..53ac398b8f5 100644
--- a/tests/ui/let-else/let-else-bindings.rs
+++ b/tests/ui/let-else/let-else-bindings.rs
@@ -1,5 +1,5 @@
 // run-pass
-// adapted from src/test/ui/binding/if-let.rs
+// adapted from tests/ui/binding/if-let.rs
 
 #![allow(dead_code)]
 
diff --git a/tests/ui/save-analysis/issue-89066.rs b/tests/ui/save-analysis/issue-89066.rs
index 2873f5237d4..c65e2d73fad 100644
--- a/tests/ui/save-analysis/issue-89066.rs
+++ b/tests/ui/save-analysis/issue-89066.rs
@@ -1,7 +1,7 @@
 // compile-flags: -Zsave-analysis
 
 // Check that this does not ICE.
-// Stolen from src/test/ui/const-generics/generic_arg_infer/infer-arg-test.rs
+// Stolen from tests/ui/const-generics/generic_arg_infer/infer-arg-test.rs
 
 #![feature(generic_arg_infer)]
 
diff --git a/triagebot.toml b/triagebot.toml
index bee0371d36e..a3eec63e368 100644
--- a/triagebot.toml
+++ b/triagebot.toml
@@ -120,12 +120,12 @@ trigger_files = [
     "src/rustdoc-json-types",
 
     # Tests
-    "src/test/rustdoc",
-    "src/test/rustdoc-ui",
-    "src/test/rustdoc-gui",
-    "src/test/rustdoc-js",
-    "src/test/rustdoc-js-std",
-    "src/test/rustdoc-json",
+    "tests/rustdoc",
+    "tests/rustdoc-ui",
+    "tests/rustdoc-gui",
+    "tests/rustdoc-js",
+    "tests/rustdoc-js-std",
+    "tests/rustdoc-json",
 
     # Internal tooling
     "src/etc/htmldocck.py",
@@ -143,7 +143,7 @@ exclude_labels = [
 trigger_files = [
     "src/librustdoc/json/",
     "src/rustdoc-json-types",
-    "src/test/rustdoc-json",
+    "tests/rustdoc-json",
     "src/tools/jsondocck",
     "src/tools/jsondoclint",
 ]
@@ -154,7 +154,7 @@ trigger_files = [
     "compiler",
 
     # Tests
-    "src/test/ui",
+    "tests/ui",
 ]
 exclude_labels = [
     "T-*",
@@ -601,7 +601,7 @@ fallback = [
 "/src/llvm-project" =                        ["@cuviper"]
 "/src/rustdoc-json-types" =                  ["rustdoc"]
 "/src/stage0.json" =                         ["bootstrap"]
-"/src/test/ui" =                             ["compiler"]
+"/tests/ui" =                                ["compiler"]
 "/src/tools/cargo" =                         ["@ehuss", "@joshtriplett"]
 "/src/tools/compiletest" =                   ["bootstrap"]
 "/src/tools/linkchecker" =                   ["@ehuss"]