Use header IDs

This commit is contained in:
Eric Huss 2023-08-17 18:21:54 -07:00
parent a2b36f6937
commit 5dc86dc5f8

View File

@ -275,8 +275,7 @@ Some examples of breaking changes are:
[`std::mem::transmute`]: ../../std/mem/fn.transmute.html [`std::mem::transmute`]: ../../std/mem/fn.transmute.html
[`UnsafeCell`]: ../../std/cell/struct.UnsafeCell.html#memory-layout [`UnsafeCell`]: ../../std/cell/struct.UnsafeCell.html#memory-layout
<a id="repr-c-private-change"></a> #### Minor: `repr(C)` add, remove, or change a private field {#repr-c-private-change}
#### Minor: `repr(C)` add, remove, or change a private field
It is usually safe to add, remove, or change a private field of a `repr(C)` struct, union, or enum, assuming it follows the other guidelines in this guide (see [struct-add-private-field-when-public](#struct-add-private-field-when-public), [struct-add-public-field-when-no-private](#struct-add-public-field-when-no-private), [struct-private-fields-with-private](#struct-private-fields-with-private), [enum-fields-new](#enum-fields-new)). It is usually safe to add, remove, or change a private field of a `repr(C)` struct, union, or enum, assuming it follows the other guidelines in this guide (see [struct-add-private-field-when-public](#struct-add-private-field-when-public), [struct-add-public-field-when-no-private](#struct-add-public-field-when-no-private), [struct-private-fields-with-private](#struct-private-fields-with-private), [enum-fields-new](#enum-fields-new)).
@ -318,8 +317,7 @@ fn main() {
} }
``` ```
<a id="repr-c-enum-variant-new"></a> #### Minor: `repr(C)` add enum variant {#repr-c-enum-variant-new}
#### Minor: `repr(C)` add enum variant
It is usually safe to add variants to a `repr(C)` enum, if the enum uses `non_exhastive`. It is usually safe to add variants to a `repr(C)` enum, if the enum uses `non_exhastive`.
See [enum-variant-new](#enum-variant-new) for more discussion. See [enum-variant-new](#enum-variant-new) for more discussion.
@ -359,8 +357,7 @@ fn main() {
} }
``` ```
<a id="repr-c-add"></a> #### Minor: Adding `repr(C)` to a default representation {#repr-c-add}
#### Minor: Adding `repr(C)` to a default representation
It is safe to add `repr(C)` to a struct, union, or enum with [the default representation]. It is safe to add `repr(C)` to a struct, union, or enum with [the default representation].
This is safe because users should not make assumptions about the alignment, layout, or size of types with with the default representation. This is safe because users should not make assumptions about the alignment, layout, or size of types with with the default representation.
@ -390,8 +387,7 @@ fn main() {
} }
``` ```
<a id="repr-int-enum-add"></a> #### Minor: Adding `repr(<int>)` to an enum {#repr-int-enum-add}
#### Minor: Adding `repr(<int>)` to an enum
It is safe to add `repr(<int>)` [primitive representation] to an enum with [the default representation]. It is safe to add `repr(<int>)` [primitive representation] to an enum with [the default representation].
This is safe because users should not make assumptions about the alignment, layout, or size of an enum with the default representation. This is safe because users should not make assumptions about the alignment, layout, or size of an enum with the default representation.
@ -423,8 +419,7 @@ fn main() {
} }
``` ```
<a id="repr-transparent-add"></a> #### Minor: Adding `repr(transparent)` to a default representation struct or enum {#repr-transparent-add}
#### Minor: Adding `repr(transparent)` to a default representation struct or enum
It is safe to add `repr(transparent)` to a struct or enum with [the default representation]. It is safe to add `repr(transparent)` to a struct or enum with [the default representation].
This is safe because users should not make assumptions about the alignment, layout, or size of a struct or enum with the default representation. This is safe because users should not make assumptions about the alignment, layout, or size of a struct or enum with the default representation.
@ -450,8 +445,7 @@ fn main() {
} }
``` ```
<a id="repr-packed-add"></a> #### Major: Adding `repr(packed)` to a struct or union {#repr-packed-add}
#### Major: Adding `repr(packed)` to a struct or union
It is a breaking change to add `repr(packed)` to a struct or union. It is a breaking change to add `repr(packed)` to a struct or union.
Making a type `repr(packed)` makes changes that can break code, such as being invalid to take a reference to a field, or causing truncation of disjoint closure captures. Making a type `repr(packed)` makes changes that can break code, such as being invalid to take a reference to a field, or causing truncation of disjoint closure captures.
@ -510,8 +504,7 @@ fn main() {
} }
``` ```
<a id="repr-align-add"></a> #### Major: Adding `repr(align)` to a struct, union, or enum {#repr-align-add}
#### Major: Adding `repr(align)` to a struct, union, or enum
It is a breaking change to add `repr(align)` to a struct, union, or enum. It is a breaking change to add `repr(align)` to a struct, union, or enum.
Making a type `repr(align)` would break any use of that type in a `repr(packed)` type because that combination is not allowed. Making a type `repr(align)` would break any use of that type in a `repr(packed)` type because that combination is not allowed.
@ -550,8 +543,7 @@ fn main() {
} }
``` ```
<a id="repr-packed-remove"></a> #### Major: Removing `repr(packed)` from a struct or union {#repr-packed-remove}
#### Major: Removing `repr(packed)` from a struct or union
It is a breaking change to remove `repr(packed)` from a struct or union. It is a breaking change to remove `repr(packed)` from a struct or union.
This may change the alignment or layout that extern crates are relying on. This may change the alignment or layout that extern crates are relying on.
@ -633,8 +625,7 @@ fn main() {
} }
``` ```
<a id="repr-packed-n-change"></a> #### Major: Changing the value N of `repr(packed(N))` if that changes the alignment or layout {#repr-packed-n-change}
#### Major: Changing the value N of `repr(packed(N))` if that changes the alignment or layout
It is a breaking change to change the value of N of `repr(packed(N))` if that changes the alignment or layout. It is a breaking change to change the value of N of `repr(packed(N))` if that changes the alignment or layout.
This may change the alignment or layout that external crates are relying on. This may change the alignment or layout that external crates are relying on.
@ -672,8 +663,7 @@ fn main() {
} }
``` ```
<a id="repr-align-n-change"></a> #### Major: Changing the value N of `repr(align(N))` if that changes the alignment {#repr-align-n-change}
#### Major: Changing the value N of `repr(align(N))` if that changes the alignment
It is a breaking change to change the value `N` of `repr(align(N))` if that changes the alignment. It is a breaking change to change the value `N` of `repr(align(N))` if that changes the alignment.
This may change the alignment that external crates are relying on. This may change the alignment that external crates are relying on.
@ -713,8 +703,7 @@ fn main() {
} }
``` ```
<a id="repr-align-remove"></a> #### Major: Removing `repr(align)` from a struct, union, or enum {#repr-align-remove}
#### Major: Removing `repr(align)` from a struct, union, or enum
It is a breaking change to remove `repr(align)` from a struct, union, or enum, if their layout was well-defined. It is a breaking change to remove `repr(align)` from a struct, union, or enum, if their layout was well-defined.
This may change the alignment or layout that external crates are relying on. This may change the alignment or layout that external crates are relying on.
@ -752,8 +741,7 @@ fn main() {
} }
``` ```
<a id="repr-c-shuffle"></a> #### Major: Changing the order of public fields of a `repr(C)` type {#repr-c-shuffle}
#### Major: Changing the order of public fields of a `repr(C)` type
It is a breaking change to change the order of public fields of a `repr(C)` type. It is a breaking change to change the order of public fields of a `repr(C)` type.
External crates may be relying on the specific ordering of the fields. External crates may be relying on the specific ordering of the fields.
@ -807,8 +795,7 @@ fn main() {
# } # }
``` ```
<a id="repr-c-remove"></a> #### Major: Removing `repr(C)` from a struct, union, or enum {#repr-c-remove}
#### Major: Removing `repr(C)` from a struct, union, or enum
It is a breaking change to remove `repr(C)` from a struct, union, or enum. It is a breaking change to remove `repr(C)` from a struct, union, or enum.
External crates may be relying on the specific layout of the type. External crates may be relying on the specific layout of the type.
@ -862,8 +849,7 @@ fn main() {
# } # }
``` ```
<a id="repr-int-enum-remove"></a> #### Major: Removing `repr(<int>)` from an enum {#repr-int-enum-remove}
#### Major: Removing `repr(<int>)` from an enum
It is a breaking change to remove `repr(<int>)` from an enum. It is a breaking change to remove `repr(<int>)` from an enum.
External crates may be assuming that the discriminant is a specific size. External crates may be assuming that the discriminant is a specific size.
@ -899,8 +885,7 @@ fn main() {
} }
``` ```
<a id="repr-int-enum-change"></a> #### Major: Changing the primitive representation of a `repr(<int>)` enum {#repr-int-enum-change}
#### Major: Changing the primitive representation of a `repr(<int>)` enum
It is a breaking change to change the primitive representation of a `repr(<int>)` enum. It is a breaking change to change the primitive representation of a `repr(<int>)` enum.
External crates may be assuming that the discriminant is a specific size. External crates may be assuming that the discriminant is a specific size.
@ -936,8 +921,7 @@ fn main() {
} }
``` ```
<a id="repr-transparent-remove"></a> #### Major: Removing `repr(transparent)` from a struct or enum {#repr-transparent-remove}
#### Major: Removing `repr(transparent)` from a struct or enum
It is a breaking change to remove `repr(transparent)` from a struct or enum. It is a breaking change to remove `repr(transparent)` from a struct or enum.
External crates may be relying on the type having the alignment, layout, or size of the transparent field. External crates may be relying on the type having the alignment, layout, or size of the transparent field.