rust/compiler/rustc_builtin_macros/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
..
assert Implement .use keyword as an alias of clone 2025-03-06 17:58:32 -03:00
deriving Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
format_foreign Rustfmt 2025-02-08 22:12:13 +00:00
alloc_error_handler.rs Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
asm.rs parse_format optimize import use 2025-01-28 19:33:00 +01:00
assert.rs Speed up Parser::expected_token_types. 2024-12-19 16:05:41 +11:00
autodiff.rs Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
cfg_accessible.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
cfg_eval.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
cfg.rs Speed up Parser::expected_token_types. 2024-12-19 16:05:41 +11:00
cmdline_attrs.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
compile_error.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
concat_bytes.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
concat_idents.rs Rollup merge of #134161 - nnethercote:overhaul-token-cursors, r=spastorino 2024-12-18 22:56:53 +08:00
concat.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
contracts.rs Fix imports, remove attrs for unused_* 2025-02-10 20:15:30 +00:00
define_opaque.rs Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
derive.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
edition_panic.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
env.rs Rustfmt 2025-02-08 22:12:13 +00:00
errors.rs switch #[cfg(not(llvm_enzyme))] to cfg!(llvm_enzyme) 2025-02-27 19:32:30 +05:30
format_foreign.rs Simplify printf and shell format suggestions 2025-03-06 13:55:05 -08:00
format.rs Simplify printf and shell format suggestions 2025-03-06 13:55:05 -08:00
global_allocator.rs Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
lib.rs Auto merge of #128440 - oli-obk:defines, r=lcnr 2025-03-11 18:13:31 +00:00
log_syntax.rs Adjust some pubs. 2024-04-26 13:29:20 +10:00
pattern_type.rs Add a TyPat in the AST to reuse the generic arg lowering logic 2025-02-11 08:51:05 +00:00
proc_macro_harness.rs Rustfmt 2025-02-08 22:12:13 +00:00
source_util.rs tree-wide: parallel: Fully removed all Lrc, replaced with Arc 2025-02-03 13:25:57 +03:00
standard_library_imports.rs span: add a "future" edition 2025-02-24 14:35:30 +00:00
test_harness.rs Implement #[define_opaque] attribute for functions. 2025-03-11 12:05:02 +00:00
test.rs Rustfmt 2025-02-08 22:12:13 +00:00
trace_macros.rs Rollup merge of #134161 - nnethercote:overhaul-token-cursors, r=spastorino 2024-12-18 22:56:53 +08:00
util.rs Account for format_args in HiddenUnicodeCodepoints lint 2024-12-31 05:03:22 +00:00