Skip to content

Commit

Permalink
Merge #434
Browse files Browse the repository at this point in the history
434: Disallow non-copy types in union types r=Dajamante a=Veykril

cc #141

Co-authored-by: Lukas Wirth <[email protected]>
  • Loading branch information
bors-ferrocene[bot] and Veykril authored Aug 7, 2023
2 parents ff73e42 + 7004823 commit b169ee0
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/types-and-traits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -805,12 +805,33 @@ Union Types
.. rubric:: Legality Rules

:dp:`fls_nskmnzq95yqm`
A :t:`union type` is an :t:`abstract data type` similar to a :t:`C`-like union.
A :t:`union type` is an :t:`abstract data type` that is a sum of other
:t:`types`.

:dp:`fls_1caus8ybmfli`
The :t:`name` of a :t:`union field` shall be unique within the related
:s:`RecordStructDeclaration`.

:dp:`fls_ZJG2Q6lJYXhY`
The :t:`type` of a :t:`union field` shall be either:

* :dp:`fls_hLTnHnZuaHve`
A :t:`copy type`, or

* :dp:`fls_JWgSckDtN13c`
A :t:`mutable reference type`, or

* :dp:`fls_sXZknxozJxtC`
:std:`core::mem::ManuallyDrop`, or

* :dp:`fls_vgNK01SXacnx`
A :t:`tuple type` whose :t:`[tuple field]s`' :t:`[type]s` are all valid
:t:`union field` :t:`[type]s`, or

* :dp:`fls_bQhh3zHAKjSu`
An :t:`array type` whose :t:`element type` is a valid :t:`union field`
:t:`[type]s`.

.. rubric:: Examples

.. code-block:: rust
Expand Down

0 comments on commit b169ee0

Please sign in to comment.