rust/compiler/rustc_resolve/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
..
late Rollup merge of #138115 - compiler-errors:static-typo, r=BoxyUwU 2025-03-07 10:02:27 +01:00
build_reduced_graph.rs Implment #[cfg] and #[cfg_attr] in where clauses 2025-03-01 22:02:46 +08:00
check_unused.rs Run clippy --fix for unnecessary_map_or lint 2025-01-19 19:15:00 +00:00
def_collector.rs Pass Option<Symbol> to def_path_data/create_def methods. 2025-03-07 20:53:00 +11:00
diagnostics.rs Introduce feature(generic_const_parameter_types) 2025-02-28 20:43:15 +00:00
effective_visibilities.rs rustc_resolve: reduce rightwards drift with let..else 👉💨 2025-01-21 13:42:32 +00:00
errors.rs Introduce feature(generic_const_parameter_types) 2025-02-28 20:43:15 +00:00
ident.rs Introduce feature(generic_const_parameter_types) 2025-02-28 20:43:15 +00:00
imports.rs Rollup merge of #137529 - klensy:unused3, r=lcnr 2025-02-26 04:15:04 +01:00
late.rs Implement #[define_opaque] attribute for functions. 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
macros.rs Introduce new-style attribute parsers for several attributes 2025-02-24 14:31:17 +01:00
rustdoc.rs rustdoc: improve refdef handling in the unresolved link lint 2025-02-15 12:21:35 -07:00