File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -1118,6 +1118,11 @@ impl<T> fmt::Debug for Discriminant<T> {
1118
1118
///
1119
1119
/// [Reference]: ../../reference/items/enumerations.html#custom-discriminant-values-for-fieldless-enumerations
1120
1120
///
1121
+ /// The value of a [`Discriminant<T>`] is independent of any *lifetimes* in `T`. As such, reading
1122
+ /// or writing a `Discriminant<Foo<'a>>` as a `Discriminant<Foo<'b>>` (whether via [`transmute`] or
1123
+ /// otherwise) is always sound. Note that this is **not** true for other kinds of generic
1124
+ /// parameters; `Discriminant<Foo<A>>` and `Discriminant<Foo<B>>` might be incompatible.
1125
+ ///
1121
1126
/// # Examples
1122
1127
///
1123
1128
/// This can be used to compare enums that carry data, while disregarding
You can’t perform that action at this time.
0 commit comments