-
Notifications
You must be signed in to change notification settings - Fork 390
Commit 6e593bf
authored
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.htmlFile tree
Expand file treeCollapse file tree
0 file changed
+0
-0
lines changedFilter options
Expand file treeCollapse file tree
0 file changed
+0
-0
lines changed
0 commit comments