@@ -115,67 +115,67 @@ fn lookup_vtable(fcx: @fn_ctxt, isc: resolve::iscopes, sp: span,
115
115
for list:: each( isc) |impls| {
116
116
/* For each impl in scope... */
117
117
for vec:: each( * impls) |im| {
118
- // im = one specific impl
119
- // find the iface that im implements (if any)
120
- let of_ty = alt ty:: impl_iface ( tcx, im. did ) {
121
- some ( of_ty) { of_ty }
122
- _ { cont; }
123
- } ;
118
+ // im = one specific impl
119
+ // find the iface that im implements (if any)
120
+ let of_ty = alt ty:: impl_iface ( tcx, im. did ) {
121
+ some ( of_ty) { of_ty }
122
+ _ { cont; }
123
+ } ;
124
124
125
- // it must have the same id as the expected one
126
- alt ty:: get ( of_ty) . struct {
127
- ty:: ty_iface ( id, _) if id != iface_id { cont; }
128
- _ { /* ok */ }
129
- }
125
+ // it must have the same id as the expected one
126
+ alt ty:: get ( of_ty) . struct {
127
+ ty:: ty_iface ( id, _) if id != iface_id { cont; }
128
+ _ { /* ok */ }
129
+ }
130
130
131
- // check whether the type unifies with the type
132
- // that the impl is for, and continue if not
133
- let { substs: substs , ty: for_ty } =
134
- impl_self_ty ( fcx, im. did ) ;
135
- let im_bs = ty:: lookup_item_type ( tcx, im. did ) . bounds ;
136
- alt fcx. mk_subty ( ty, for_ty) {
137
- result:: err ( _) { cont; }
138
- result:: ok ( ( ) ) { }
139
- }
131
+ // check whether the type unifies with the type
132
+ // that the impl is for, and continue if not
133
+ let { substs: substs , ty: for_ty } =
134
+ impl_self_ty ( fcx, im. did ) ;
135
+ let im_bs = ty:: lookup_item_type ( tcx, im. did ) . bounds ;
136
+ alt fcx. mk_subty ( ty, for_ty) {
137
+ result:: err ( _) { cont; }
138
+ result:: ok ( ( ) ) { }
139
+ }
140
140
141
- // check that desired iface type unifies
142
- #debug ( "(checking vtable) @2 relating iface ty %s to \
143
- of_ty %s",
144
- fcx. infcx . ty_to_str ( iface_ty) ,
145
- fcx. infcx . ty_to_str ( of_ty) ) ;
146
- let of_ty = ty:: subst ( tcx, substs, of_ty) ;
147
- relate_iface_tys ( fcx, sp, iface_ty, of_ty) ;
141
+ // check that desired iface type unifies
142
+ #debug ( "(checking vtable) @2 relating iface ty %s to \
143
+ of_ty %s",
144
+ fcx. infcx . ty_to_str ( iface_ty) ,
145
+ fcx. infcx . ty_to_str ( of_ty) ) ;
146
+ let of_ty = ty:: subst ( tcx, substs, of_ty) ;
147
+ relate_iface_tys ( fcx, sp, iface_ty, of_ty) ;
148
148
149
- // recursively process the bounds
150
- let iface_tps = iface_substs. tps ;
151
- let substs_f = fixup_substs ( fcx, sp, iface_id, substs) ;
152
- connect_iface_tps ( fcx, sp, substs_f. tps ,
153
- iface_tps, im. did ) ;
154
- let subres = lookup_vtables ( fcx, isc, sp,
155
- im_bs, substs_f, false ) ;
156
- vec:: push ( found,
157
- vtable_static ( im. did , substs_f. tps , subres) ) ;
158
- }
149
+ // recursively process the bounds
150
+ let iface_tps = iface_substs. tps ;
151
+ let substs_f = fixup_substs ( fcx, sp, iface_id, substs) ;
152
+ connect_iface_tps ( fcx, sp, substs_f. tps ,
153
+ iface_tps, im. did ) ;
154
+ let subres = lookup_vtables ( fcx, isc, sp,
155
+ im_bs, substs_f, false ) ;
156
+ vec:: push ( found,
157
+ vtable_static ( im. did , substs_f. tps , subres) ) ;
158
+ }
159
159
160
- alt found. len ( ) {
161
- 0 u { /* fallthrough */ }
162
- 1 u { ret found[ 0 ] ; }
163
- _ {
164
- fcx. ccx . tcx . sess . span_err (
165
- sp, "multiple applicable methods in scope" ) ;
166
- ret found[ 0 ] ;
167
- }
168
- }
160
+ alt found. len ( ) {
161
+ 0 u { /* fallthrough */ }
162
+ 1 u { ret found[ 0 ] ; }
163
+ _ {
164
+ fcx. ccx . tcx . sess . span_err (
165
+ sp, "multiple applicable methods in scope" ) ;
166
+ ret found[ 0 ] ;
167
+ }
169
168
}
170
- }
171
169
}
172
-
173
- tcx. sess . span_fatal (
174
- sp, "failed to find an implementation of interface " +
175
- ty_to_str ( tcx, iface_ty) + " for " +
176
- ty_to_str ( tcx, ty) ) ;
170
+ }
177
171
}
178
172
173
+ tcx. sess . span_fatal (
174
+ sp, "failed to find an implementation of interface " +
175
+ ty_to_str ( tcx, iface_ty) + " for " +
176
+ ty_to_str ( tcx, ty) ) ;
177
+ }
178
+
179
179
fn fixup_ty ( fcx : @fn_ctxt , sp : span , ty : ty:: t ) -> ty:: t {
180
180
let tcx = fcx. ccx . tcx ;
181
181
alt infer:: resolve_deep ( fcx. infcx , ty, force_all) {
0 commit comments