rust/tests
Samuel Tardieu ebbbbebf2d
Replace all item identification utils (#15682)
This introduces a new way of identifying items/paths using extension
traits with a composable set of functions rather than unique functions
for various combinations of starting points and target items. Altogether
this is a set of five traits:

* `MaybeTypeckRes`: Allows both `LateContext` and `TypeckResults` to be
used for type-dependent lookup. The implementation here will avoid ICEs
by returning `None` when debug assertions are disabled. With assertions
this will assert that we don't silently lookup anything from a different
body than the current one and that a definition actually exists.
* `HasHirId`: Simply a convenience to allow not typing `.hir_id` at call
sites.
* `MaybeQPath`: This is the old `MaybePath`. Extension functions for
type-dependent path lookups exist here. A lot of these functions aren't
used in the current PR, but what they accomplish is done in various
places I haven't cleaned up yet.
* `MaybeResPath`: Like `MaybeQPath`, but only does non-type-dependent
lookup (`QPath::Resolved`).
* `MaybeDef`: Extension functions for identifying the current definition
and accessing properties. Implemented for several types for convenience.

`MaybeDef` is implemented for `Option` to allow chaining methods
together. e.g.
`cx.ty_based_def(e).opt_parent(cx).opt_impl_ty(cx).is_diag_item(..)`
would chaining `and_then` or `if let` on every step. `MaybeQPath` and
`MaybeResPath` are also implemented for `Option` for the same reason.

`ty_based_def` is just a shorter name for `type_dependent_def`. I'm not
really attached to it, but it's nice that it's a little shorter.

changelog: none
2025-10-11 07:03:12 +00:00
..
test_utils
ui Replace all item identification utils (#15682) 2025-10-11 07:03:12 +00:00
ui-cargo module_style: refactor and don't lint mod tagged with path attr 2025-09-18 02:58:16 -04:00
ui-internal Merge commit 'e9b70454e4' into clippy-subtree-update 2025-09-04 18:27:27 -04:00
ui-toml Check structs and enums for use_self 2025-10-09 18:23:12 -05:00
workspace_test
check-fmt.rs
clippy.toml
compile-test.rs Use expect for lint warnings 2025-10-06 20:17:12 -04:00
config-consistency.rs Merge commit 'e9b70454e4' into clippy-subtree-update 2025-09-04 18:27:27 -04:00
config-metadata.rs
dogfood.rs Merge commit 'c5dbd1de07' into clippy-subtree-update 2025-06-27 12:20:57 +02:00
integration.rs
lint_message_convention.rs
missing-test-files.rs Apply cfg(bootstrap) replacement 2025-09-26 19:09:23 -04:00
no-profile-in-cargo-toml.rs Merge commit '20ce69b9a6' into clippy-subtree-update 2025-09-18 17:21:44 +02:00
symbols-used.rs Use expect for lint warnings 2025-10-06 20:17:12 -04:00
versioncheck.rs Merge commit 'c5dbd1de07' into clippy-subtree-update 2025-06-27 12:20:57 +02:00
workspace.rs