rust/compiler/rustc_expand/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
..
mbe Rename ast::TokenKind::Not as ast::TokenKind::Bang. 2025-03-03 09:26:13 +11:00
base.rs Implment #[cfg] and #[cfg_attr] in where clauses 2025-03-01 22:02:46 +08:00
build.rs Rollup merge of #136107 - dingxiangfei2009:coerce-pointee-wellformed, r=compiler-errors 2025-02-11 02:53:42 +01:00
config.rs Rename ast::TokenKind::Not as ast::TokenKind::Bang. 2025-03-03 09:26:13 +11:00
errors.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
expand.rs Keep items around even if builtin macros on them fail to parse 2025-03-11 12:05:02 +00:00
lib.rs Revert "Use workspace lints for crates in compiler/ #138084" 2025-03-10 18:12:47 +08:00
mbe.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
module.rs Reject macro calls inside of #![crate_name] 2025-02-15 16:47:30 +01:00
placeholders.rs Implment #[cfg] and #[cfg_attr] in where clauses 2025-03-01 22:02:46 +08:00
proc_macro_server.rs Rename ast::TokenKind::Not as ast::TokenKind::Bang. 2025-03-03 09:26:13 +11:00
proc_macro.rs Greatly simplify lifetime captures in edition 2024 2025-02-22 22:24:52 +00:00