ruff/crates/ruff_python_semantic/src
liam ebfb33c30b
[ruff] Extend FA102 with listed PEP 585-compatible APIs (#20659)
Resolves https://github.com/astral-sh/ruff/issues/20512

This PR expands FA102’s preview coverage to flag every
PEP 585-compatible API that breaks without from `from __future__ import
annotations`, including `collections.abc`. The rule now treats asyncio
futures, pathlib-style queues, weakref containers, shelve proxies, and
the full `collections.abc` family as generics once preview mode is
enabled.

Stable behavior is unchanged; the broader matching runs behind
`is_future_required_preview_generics_enabled`, letting us vet the new
diagnostics before marking them as stable.

I've also added a snapshot test that covers all of the newly supported
types.

Check out
https://docs.python.org/3/library/stdtypes.html#standard-generic-classes
for a list of commonly used PEP 585-compatible APIs.
2025-10-03 09:45:32 -04:00
..
analyze [ruff] Extend FA102 with listed PEP 585-compatible APIs (#20659) 2025-10-03 09:45:32 -04:00
cfg Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
model [ty] AST garbage collection (#18482) 2025-06-13 08:40:11 -04:00
binding.rs Add a ScopeKind for the __class__ cell (#20048) 2025-08-26 09:49:08 -04:00
branches.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
context.rs Remove separate ReferenceContext enum (#4631) 2023-05-24 15:12:38 +00:00
definition.rs [ty] Make Module a Salsa ingredient 2025-07-23 09:46:40 -04:00
globals.rs [ty] AST garbage collection (#18482) 2025-06-13 08:40:11 -04:00
imports.rs Update Rust toolchain to 1.89 (#19807) 2025-08-07 18:21:50 +02:00
lib.rs Control flow graph: setup (#17064) 2025-04-01 05:53:42 -05:00
model.rs [ruff] Fix minor typos in doc comments (#20623) 2025-09-29 08:56:23 +02:00
nodes.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
reference.rs Switch to Rust 2024 edition (#18129) 2025-05-16 13:25:28 +02:00
scope.rs Add a ScopeKind for the __class__ cell (#20048) 2025-08-26 09:49:08 -04:00
star_import.rs Make ImportFrom level just a u32 (#11170) 2024-04-26 20:38:35 -06:00