only free lifetimes may get erased

This commit is contained in:
lcnr 2023-11-17 11:03:40 +00:00
parent ee5ef3aac9
commit 3b0e1d23b7

View File

@ -1132,10 +1132,12 @@ impl<T> fmt::Debug for Discriminant<T> {
/// ///
/// [Reference]: ../../reference/items/enumerations.html#custom-discriminant-values-for-fieldless-enumerations /// [Reference]: ../../reference/items/enumerations.html#custom-discriminant-values-for-fieldless-enumerations
/// ///
/// The value of a [`Discriminant<T>`] is independent of any *lifetimes* in `T`. As such, reading /// The value of a [`Discriminant<T>`] is independent of any *free lifetimes* in `T`. As such,
/// or writing a `Discriminant<Foo<'a>>` as a `Discriminant<Foo<'b>>` (whether via [`transmute`] or /// reading or writing a `Discriminant<Foo<'a>>` as a `Discriminant<Foo<'b>>` (whether via
/// otherwise) is always sound. Note that this is **not** true for other kinds of generic /// [`transmute`] or otherwise) is always sound. Note that this is **not** true for other kinds
/// parameters; `Discriminant<Foo<A>>` and `Discriminant<Foo<B>>` might be incompatible. /// of generic parameters and for higher-ranked lifetimes; `Discriminant<Foo<A>>` and
/// `Discriminant<Foo<B>>` as well as `Discriminant<Bar<dyn for<'a> Trait<'a>>>` and
/// `Discriminant<Bar<dyn Trait<'static>>>` may be incompatible.
/// ///
/// # Examples /// # Examples
/// ///