Skip to content

Commit 97dcd63

Browse files
lcnrMark-Simulacrum
authored andcommitted
only free lifetimes may get erased
1 parent f0444a5 commit 97dcd63

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

library/core/src/mem/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,10 +1126,12 @@ impl<T> fmt::Debug for Discriminant<T> {
11261126
///
11271127
/// [Reference]: ../../reference/items/enumerations.html#custom-discriminant-values-for-fieldless-enumerations
11281128
///
1129-
/// The value of a [`Discriminant<T>`] is independent of any *lifetimes* in `T`. As such, reading
1130-
/// or writing a `Discriminant<Foo<'a>>` as a `Discriminant<Foo<'b>>` (whether via [`transmute`] or
1131-
/// otherwise) is always sound. Note that this is **not** true for other kinds of generic
1132-
/// parameters; `Discriminant<Foo<A>>` and `Discriminant<Foo<B>>` might be incompatible.
1129+
/// The value of a [`Discriminant<T>`] is independent of any *free lifetimes* in `T`. As such,
1130+
/// reading or writing a `Discriminant<Foo<'a>>` as a `Discriminant<Foo<'b>>` (whether via
1131+
/// [`transmute`] or otherwise) is always sound. Note that this is **not** true for other kinds
1132+
/// of generic parameters and for higher-ranked lifetimes; `Discriminant<Foo<A>>` and
1133+
/// `Discriminant<Foo<B>>` as well as `Discriminant<Bar<dyn for<'a> Trait<'a>>>` and
1134+
/// `Discriminant<Bar<dyn Trait<'static>>>` may be incompatible.
11331135
///
11341136
/// # Examples
11351137
///

0 commit comments

Comments
 (0)