Skip to content

Commit 37c48b0

Browse files
committed
Apply some edits from review to try to clarify things.
1 parent 74d46dd commit 37c48b0

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/doc/src/reference/semver.md

+6-5
Original file line numberDiff line numberDiff line change
@@ -213,22 +213,23 @@ crates should be avoided.
213213

214214
It is a breaking change to change the alignment, layout, or size of a type that was previously well-defined.
215215

216-
In general, nominal types that use the [the default representation] do not have a well-defined alignment, layout, or size.
216+
In general, types that use the [the default representation] do not have a well-defined alignment, layout, or size.
217217
The compiler is free to alter the alignment or layout, so code should not make any assumptions about it.
218218

219219
> **Note**: It may be possible for external crates to break if they make assumptions about the alignment, layout, or size of a type even if it is not well-defined.
220220
> This is not considered a SemVer breaking change since those assumptions should not be made.
221221
222222
Some examples of changes that are not a breaking change are (assuming no other rules in this guide are violated):
223223

224-
* Adding, removing, or changing fields of a default representation struct, union, or enum.
225-
* Adding variants to a default representation enum.
224+
* Adding, removing, or changing fields of a default representation struct, union, or enum in such a way that the change follows the other rules in this guide (for example, using `non_exhaustive` to allow those changes, or changes to private fields that are already private).
225+
* Adding variants to a default representation enum, if the enum uses `non_exhaustive`.
226226
This may change the alignment or size of the enumeration, but those are not well-defined.
227227
* Adding, removing, or changing private fields of a `repr(C)` struct, union, or enum.
228228
Note that this may be a breaking change since it may change the size and alignment of the type.
229229
Care should be taken in this case.
230+
Adding private fields can only be done if there are already other private fields, or it is `non_exhaustive`.
230231
Public fields may be added if there are private fields, or it is `non_exhaustive`, and the addition does not alter the layout of the other fields.
231-
* Adding variants to a `repr(C)` enum.
232+
* Adding variants to a `repr(C)` enum, if the enum uses `non_exhastive`.
232233
Note that this may be a breaking change since it may change the size and alignment of the type.
233234
Care should be taken in this case.
234235
* Adding `repr(C)` to a default representation struct, union, or enum.
@@ -237,7 +238,7 @@ Some examples of changes that are not a breaking change are (assuming no other r
237238

238239
Nominal types that use the [`repr` attribute] can be said to have an alignment and layout that is defined in some way that code may make some assumptions about that may break as a result of changing that type.
239240

240-
Some examples of changes that are a breaking change are:
241+
Some examples of a breaking change are:
241242

242243
* Adding `repr(packed)` to a struct or union.
243244

0 commit comments

Comments
 (0)