99
99
Binders :: empty ( & Interner , value. shifted_in_from ( DebruijnIndex :: ONE ) )
100
100
}
101
101
102
- impl < T : TypeWalk > Binders < T > {
103
- /// Substitutes all variables.
104
- pub fn substitute ( self , interner : & Interner , subst : & Substitution ) -> T {
105
- let ( value, binders) = self . into_value_and_skipped_binders ( ) ;
106
- assert_eq ! ( subst. len( interner) , binders. len( interner) ) ;
107
- value. subst_bound_vars ( subst)
108
- }
109
- }
110
-
111
102
pub fn make_only_type_binders < T > ( num_vars : usize , value : T ) -> Binders < T > {
112
103
Binders :: new (
113
104
VariableKinds :: from_iter (
@@ -120,31 +111,11 @@ pub fn make_only_type_binders<T>(num_vars: usize, value: T) -> Binders<T> {
120
111
}
121
112
122
113
impl TraitRef {
123
- pub fn self_type_parameter ( & self , interner : & Interner ) -> & Ty {
124
- & self . substitution . at ( interner, 0 ) . assert_ty_ref ( interner)
125
- }
126
-
127
114
pub fn hir_trait_id ( & self ) -> TraitId {
128
115
from_chalk_trait_id ( self . trait_id )
129
116
}
130
117
}
131
118
132
- impl WhereClause {
133
- pub fn is_implemented ( & self ) -> bool {
134
- matches ! ( self , WhereClause :: Implemented ( _) )
135
- }
136
-
137
- pub fn trait_ref ( & self , db : & dyn HirDatabase ) -> Option < TraitRef > {
138
- match self {
139
- WhereClause :: Implemented ( tr) => Some ( tr. clone ( ) ) ,
140
- WhereClause :: AliasEq ( AliasEq { alias : AliasTy :: Projection ( proj) , .. } ) => {
141
- Some ( proj. trait_ref ( db) )
142
- }
143
- WhereClause :: AliasEq ( _) => None ,
144
- }
145
- }
146
- }
147
-
148
119
impl < T > Canonical < T > {
149
120
pub fn new ( value : T , kinds : impl IntoIterator < Item = TyVariableKind > ) -> Self {
150
121
let kinds = kinds. into_iter ( ) . map ( |tk| {
0 commit comments