about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src
diff options
context:
space:
mode:
authorJubilee <workingjubilee@gmail.com>2025-06-17 00:28:17 -0700
committerGitHub <noreply@github.com>2025-06-17 00:28:17 -0700
commitd4f23cdc915a74741e301df41c5eece2d8c78c5e (patch)
treed604e1e0da31675d1cbfffd03683bc34d33e2cf9 /compiler/rustc_codegen_llvm/src
parentf2e9e2afacb6599c2ec3b0fe00427700a24425eb (diff)
parent2dd9cc113067113453efcff722e3a5c0893a6244 (diff)
downloadrust-d4f23cdc915a74741e301df41c5eece2d8c78c5e.tar.gz
rust-d4f23cdc915a74741e301df41c5eece2d8c78c5e.zip
Rollup merge of #142570 - jieyouxu:disunion, r=estebank
Reject union default field values

Fixes rust-lang/rust#142555.

The [`default_field_values` RFC][rfc] does not specify that default field values may be used on `union`s, and it's not clear how default field values may be used with `union`s without an design extension to the RFC. So, for now, reject trying to use default field values with `union`s.

### Review notes

- The first commit adds the `union` with default field values test case to `tests/ui/structs/default-field-values/failures.rs`, where `union`s with default field values are currently accepted.
- The second commit rejects trying to supply default field values to `union` definitions.
- When `default_field_values` feature gate is disabled, we show the feature gate error when the user tries to write `union`s with default field values. When the feature gate is enabled, we reject this usage with
   > unions cannot have default field values

``@rustbot`` label: +F-default_field_values

[rfc]: https://rust-lang.github.io/rfcs/3681-default-field-values.html
Diffstat (limited to 'compiler/rustc_codegen_llvm/src')
0 files changed, 0 insertions, 0 deletions