mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-30 20:17:50 +00:00
![]() 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 |
||
---|---|---|
.. | ||
auxiliary | ||
do-not-ice-on-invalid-lifetime.rs | ||
do-not-ice-on-invalid-lifetime.stderr | ||
empty-struct.rs | ||
empty-struct.stderr | ||
failures.rs | ||
failures.stderr | ||
field-references-param.rs | ||
invalid-const.rs | ||
invalid-const.stderr | ||
non-exhaustive-ctor.disabled.stderr | ||
non-exhaustive-ctor.enabled.fixed | ||
non-exhaustive-ctor.enabled.stderr | ||
non-exhaustive-ctor.rs | ||
post-mono.direct.stderr | ||
post-mono.indirect.stderr | ||
post-mono.rs | ||
support.rs | ||
use-normalized-ty-for-default-struct-value.rs | ||
visibility.rs | ||
visibility.stderr |