@@ -1158,13 +1158,10 @@ impl<T> Binders<T> {
1158
1158
1159
1159
/// Skips the binder and returns the "bound" value. This is a
1160
1160
/// risky thing to do because it's easy to get confused about
1161
- /// De Bruijn indices and the like. It is usually better to
1162
- /// discharge the binder using `no_bound_vars` or something
1163
- /// like that. `skip_binder` is only valid when you are either
1164
- /// extracting data that has nothing to do with bound vars, you
1165
- /// are doing some sort of test that does not involve bound
1166
- /// regions, or you are being very careful about your depth
1167
- /// accounting.
1161
+ /// De Bruijn indices and the like. `skip_binder` is only valid
1162
+ /// when you are either extracting data that has nothing to
1163
+ /// do with bound vars, or you are being very careful about
1164
+ /// your depth accounting.
1168
1165
///
1169
1166
/// Some examples where `skip_binder` is reasonable:
1170
1167
///
@@ -1174,6 +1171,9 @@ impl<T> Binders<T> {
1174
1171
& self . value
1175
1172
}
1176
1173
1174
+ /// Converts `&Binders<T>` to `Binders<&T>`. Produces new `Binders`
1175
+ /// with cloned quantifiers containing a reference to the original
1176
+ /// value, leaving the original in place.
1177
1177
pub fn as_ref ( & self ) -> Binders < & T > {
1178
1178
Binders {
1179
1179
binders : self . binders . clone ( ) ,
@@ -1219,27 +1219,6 @@ impl<T> Binders<T> {
1219
1219
}
1220
1220
}
1221
1221
1222
- /// Unwraps and returns the value within, but only if it contains
1223
- /// no vars bound by this binder. (In other words, if this binder --
1224
- /// and indeed any enclosing binder -- doesn't bind anything at
1225
- /// all.) Otherwise, returns `None`.
1226
- ///
1227
- /// (One could imagine having a method that just unwraps a single
1228
- /// binder, but permits late-bound vars bound by enclosing
1229
- /// binders, but that would require adjusting the debruijn
1230
- /// indices, and given the shallow binding structure we often use,
1231
- /// would not be that useful.)
1232
- pub fn no_bound_vars < I : Interner > ( & self , interner : & I ) -> Option < & T >
1233
- where
1234
- T : Visit < I > ,
1235
- {
1236
- if self . skip_binders ( ) . has_free_vars ( interner) {
1237
- None
1238
- } else {
1239
- Some ( self . skip_binders ( ) )
1240
- }
1241
- }
1242
-
1243
1222
pub fn len ( & self ) -> usize {
1244
1223
self . binders . len ( )
1245
1224
}
0 commit comments