1
Fork 0
rust/compiler/rustc_resolve/src
Jubilee b3d7c1483d
Rollup merge of #137913 - compiler-errors:struct-field-default-generic, r=BoxyUwU
Allow struct field default values to reference struct's generics

Right now, the default field value feature (https://github.com/rust-lang/rust/issues/132162) lowers anon consts whose types may reference ADT params that the const doesn't inherit.

This PR fixes this, so that these defaults can reference ADTs' generics, and sets the `generics_of` parenting up correctly.

There doesn't seem to be a good reason not to support this, since the anon const has a well-defined type from the field, and the anon const doesn't interact with the type system like generic parameter defaults do.

r? `````@boxyuwu````` or reassign

I could also make this into an error if this seems problematic (https://github.com/rust-lang/rust/compare/master...compiler-errors:rust:default-field-value-implicit-param?expand=1)...... but I'd rather make this work and register an open question on the tracking issue about validating that this is well-vetted.

Fixes #137896
2025-03-04 19:37:01 -08:00
..
late Do not recover missing lifetime with random in-scope lifetime 2025-03-03 05:57:55 +00: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 Rollup merge of #132388 - frank-king:feature/where-cfg, r=petrochenkov 2025-03-03 10:40:56 +01: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 Rollup merge of #137913 - compiler-errors:struct-field-default-generic, r=BoxyUwU 2025-03-04 19:37:01 -08:00
lib.rs Introduce feature(generic_const_parameter_types) 2025-02-28 20:43:15 +00: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