rust/compiler/rustc_ty_utils/src
bors 6650252439 Auto merge of #128440 - oli-obk:defines, r=lcnr
Add `#[define_opaques]` attribute and require it for all type-alias-impl-trait sites that register a hidden type

Instead of relying on the signature of items to decide whether they are constraining an opaque type, the opaque types that the item constrains must be explicitly listed.

A previous version of this PR used an actual attribute, but had to keep the resolved `DefId`s in a side table.

Now we just lower to fields in the AST that have no surface syntax, instead a builtin attribute macro fills in those fields where applicable.

Note that for convenience referencing opaque types in associated types from associated methods on the same impl will not require an attribute. If that causes problems `#[defines()]` can be used to overwrite the default of searching for opaques in the signature.

One wart of this design is that closures and static items do not have generics. So since I stored the opaques in the generics of functions, consts and methods, I would need to add a custom field to closures and statics to track this information. During a T-types discussion we decided to just not do this for now.

fixes #131298
2025-03-11 18:13:31 +00:00
..
layout rename BackendRepr::Vector → SimdVector 2025-02-28 17:17:45 +01:00
abi.rs compiler: use is_rustic_abi in ty_utils 2025-03-04 19:57:51 -08:00
assoc.rs Make synthetic RPITIT assoc ty name handling more rigorous. 2025-03-07 20:59:45 +11:00
common_traits.rs Account for UseCloned on expr_use_visitor 2025-03-06 17:58:34 -03:00
consts.rs Implement .use keyword as an alias of clone 2025-03-06 17:58:32 -03:00
errors.rs Implement .use keyword as an alias of clone 2025-03-06 17:58:32 -03:00
implied_bounds.rs Greatly simplify lifetime captures in edition 2024 2025-02-22 22:24:52 +00:00
instance.rs Delete tuple unsizing 2025-02-27 10:26:33 +00:00
layout.rs Move coroutine layout logic to rustc_abi 2025-03-08 16:16:23 +01:00
lib.rs Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
needs_drop.rs Greatly simplify lifetime captures in edition 2024 2025-02-22 22:24:52 +00:00
opaque_types.rs Error on define_opaques entries without any opaques actually referenced 2025-03-11 12:05:02 +00:00
representability.rs rename BitSet to DenseBitSet 2025-01-11 11:34:01 +00:00
sig_types.rs Make fewer crates depend on rustc_ast_ir 2025-02-19 07:06:54 +00:00
structural_match.rs TypingMode 🤔 2024-10-29 17:01:24 +01:00
ty.rs Rollup merge of #136968 - oli-obk:bye-bye, r=compiler-errors 2025-03-09 10:34:47 +01:00