rust/tests
Samuel Tardieu 9663da39d2
Run UI tests in edition 2024 mode (#14602)
The `ui_test` package runs test in edition 2021 mode by default. This PR
switches our tests to edition 2024. The commits progressively make our
test suite compatible with both edition 2021 and edition 2024, then
switches the testing mode to edition 2024, which is compatible with what
`cargo dev lint` also uses by default.

The changes are (without functionality changes in tests):
- Add `unsafe` when [calling unsafe constructs inside `unsafe
fn`](https://doc.rust-lang.org/edition-guide/rust-2024/unsafe-op-in-unsafe-fn.html),
to [unsafe
attributes](https://doc.rust-lang.org/edition-guide/rust-2024/unsafe-attributes.html),
and to [`extern`
blocks](https://doc.rust-lang.org/edition-guide/rust-2024/unsafe-extern.html).
- Use stricter reference patterns to accomodate with the [new match
ergonomics
rules](https://doc.rust-lang.org/edition-guide/rust-2024/match-ergonomics.html).
- Add some `use<>` markers where required to keep the same semantics
under the [new RPIT lifetime
rules](https://doc.rust-lang.org/edition-guide/rust-2024/rpit-lifetime-capture.html).

Some other changes ensure that non-regression tests are still enforced:
- Add edition 2021 specific tests when switching rules would make some
explicitly tested constructs untested, or when the test require using
the older [temporary tail expression scoping
rules](https://doc.rust-lang.org/edition-guide/rust-2024/temporary-tail-expr-scope.html).
- In `misnamed_getters`, check that getters containing an `unsafe` block
(for example a getter on an `Union` field) trigger the lint.

The last commit switches the default edition for running UI tests to
edition 2024.

changelog: [`misnamed_getters`]: getters containing an `unsafe` block
are also linted
2025-04-15 18:37:41 +00:00
..
test_utils
ui Run UI tests in edition 2024 mode (#14602) 2025-04-15 18:37:41 +00:00
ui-cargo Merge commit '9f9a822509' into clippy-subtree-update 2025-02-28 23:27:09 +01:00
ui-internal Merge commit '1e5237f4a5' into clippy-subtree-update 2025-03-20 22:34:29 +01:00
ui-toml Add unsafe markers to accomodate edition 2024 rules 2025-04-15 20:33:01 +02:00
workspace_test Merge commit 'cb806113e0' into clippy-subtree-update 2024-08-08 19:13:50 +02:00
check-fmt.rs Merge commit 'cb806113e0' into clippy-subtree-update 2024-08-08 19:13:50 +02:00
clippy.toml Fix situations identified by collapsible_if new hits 2025-03-25 19:50:24 +01:00
compile-test.rs Run UI tests with edition 2024 by default 2025-04-15 20:33:01 +02:00
config-metadata.rs Merge commit 'a109190d70' into clippy-subtree-update 2024-10-18 13:44:06 +02:00
dogfood.rs dogfood: run with -D clippy::dbg_macro 2025-04-10 07:38:16 +02:00
headers.rs
integration.rs Merge commit 'cb806113e0' into clippy-subtree-update 2024-08-08 19:13:50 +02:00
lint_message_convention.rs Merge commit '1e5237f4a5' into clippy-subtree-update 2025-03-20 22:34:29 +01:00
missing-test-files.rs Merge commit '51d49c1ae2' into clippy-subtree-update 2025-01-28 19:33:54 +01:00
versioncheck.rs Clippy: skip check_host_compiler check in rustc testsuite 2025-02-28 23:27:22 +01:00
workspace.rs