about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-05-29 04:49:42 +0200
committerGitHub <noreply@github.com>2025-05-29 04:49:42 +0200
commit1c46b4a4a9f5a3adfc2d6522caca435e78d2da33 (patch)
tree84834821bb91725bb7021b5ad64b63c8c7ef4fea
parent6bf4224f6873e870215acc34656619e8f9f86d32 (diff)
parent7aef56d9b938a0df077c346007921497c092fdc9 (diff)
downloadrust-1c46b4a4a9f5a3adfc2d6522caca435e78d2da33.tar.gz
rust-1c46b4a4a9f5a3adfc2d6522caca435e78d2da33.zip
Rollup merge of #141612 - jhpratt:phantom-docs, r=tgross35
Call out possibility of invariant result in variance markers

ref https://github.com/rust-lang/rust/issues/135806#issuecomment-2766191535
-rw-r--r--library/core/src/marker/variance.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/library/core/src/marker/variance.rs b/library/core/src/marker/variance.rs
index 235f8a3bb79..f9638fea225 100644
--- a/library/core/src/marker/variance.rs
+++ b/library/core/src/marker/variance.rs
@@ -131,6 +131,8 @@ phantom_lifetime! {
     ///
     /// [1]: https://doc.rust-lang.org/stable/reference/subtyping.html#variance
     ///
+    /// Note: If `'a` is otherwise contravariant or invariant, the resulting type is invariant.
+    ///
     /// ## Layout
     ///
     /// For all `'a`, the following are guaranteed:
@@ -146,6 +148,8 @@ phantom_lifetime! {
     ///
     /// [1]: https://doc.rust-lang.org/stable/reference/subtyping.html#variance
     ///
+    /// Note: If `'a` is otherwise covariant or invariant, the resulting type is invariant.
+    ///
     /// ## Layout
     ///
     /// For all `'a`, the following are guaranteed:
@@ -180,6 +184,8 @@ phantom_type! {
     ///
     /// [1]: https://doc.rust-lang.org/stable/reference/subtyping.html#variance
     ///
+    /// Note: If `T` is otherwise contravariant or invariant, the resulting type is invariant.
+    ///
     /// ## Layout
     ///
     /// For all `T`, the following are guaranteed:
@@ -196,6 +202,8 @@ phantom_type! {
     ///
     /// [1]: https://doc.rust-lang.org/stable/reference/subtyping.html#variance
     ///
+    /// Note: If `T` is otherwise covariant or invariant, the resulting type is invariant.
+    ///
     /// ## Layout
     ///
     /// For all `T`, the following are guaranteed: