Skip to content

Commit

Permalink
Clarify what it means "to document" a transparent type.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Jul 12, 2023
1 parent 047d5d9 commit e347888
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/doc/src/reference/semver.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ In some cases, types with a `repr` attribute may not have an alignment, layout,
In these cases, it may be safe to make changes to the types, though care should be exercised.
For example, types with private fields that do not otherwise document their alignment, layout, or size guarantees cannot be relied upon by external crates since the public API does not fully define the alignment, layout, or size of the type.

A common example where a type with *private* fields is well-defined is a type with a single private field with a generic type, using `repr(transparent)`, and which is documented as being transparent to the generic type.
A common example where a type with *private* fields is well-defined is a type with a single private field with a generic type, using `repr(transparent)`,
and the prose of the documentation discusses that it is transparent to the generic type.
For example, see [`UnsafeCell`].

[the default representation]: ../../reference/type-layout.html#the-default-representation
Expand Down

0 comments on commit e347888

Please sign in to comment.