about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKyle Matsuda <kyle.yoshio.matsuda@gmail.com>2023-05-26 14:10:58 -0600
committerKyle Matsuda <kyle.yoshio.matsuda@gmail.com>2023-05-28 10:44:53 -0600
commitc29c212f8dc80e40f099b6dbc9da3111177ba7bf (patch)
treefcdf663ff6faf9841b0735c3b058e9ff305f593c
parentc40e9cc7ca3001cfd6098d1c2f6bf4e009920358 (diff)
downloadrust-c29c212f8dc80e40f099b6dbc9da3111177ba7bf.tar.gz
rust-c29c212f8dc80e40f099b6dbc9da3111177ba7bf.zip
Add documentation on skip_binder on how to get &T from &EarlyBinder<T>
-rw-r--r--compiler/rustc_middle/src/ty/subst.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/subst.rs b/compiler/rustc_middle/src/ty/subst.rs
index 5422ee7db32..8691a3070bc 100644
--- a/compiler/rustc_middle/src/ty/subst.rs
+++ b/compiler/rustc_middle/src/ty/subst.rs
@@ -586,6 +586,9 @@ impl<T> EarlyBinder<T> {
     /// arguments of an `FnSig`). Otherwise, consider using
     /// [`subst_identity`](EarlyBinder::subst_identity).
     ///
+    /// To skip the binder on `x: &EarlyBinder<T>` to obtain `&T`, leverage
+    /// [`EarlyBinder::as_ref`](EarlyBinder::as_ref): `x.as_ref().skip_binder()`.
+    ///
     /// See also [`Binder::skip_binder`](super::Binder::skip_binder), which is
     /// the analogous operation on [`super::Binder`].
     pub fn skip_binder(self) -> T {