From c29c212f8dc80e40f099b6dbc9da3111177ba7bf Mon Sep 17 00:00:00 2001 From: Kyle Matsuda Date: Fri, 26 May 2023 14:10:58 -0600 Subject: [PATCH] Add documentation on skip_binder on how to get &T from &EarlyBinder --- compiler/rustc_middle/src/ty/subst.rs | 3 +++ 1 file changed, 3 insertions(+) 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 @@ pub fn rebind(&self, value: U) -> EarlyBinder { /// arguments of an `FnSig`). Otherwise, consider using /// [`subst_identity`](EarlyBinder::subst_identity). /// + /// To skip the binder on `x: &EarlyBinder` 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 {