@@ -194,7 +194,6 @@ impl<'self> LookupContext<'self> {
194
194
self . push_inherent_candidates ( self_ty) ;
195
195
self . push_extension_candidates ( ) ;
196
196
197
- let mut enum_dids = ~[ ] ;
198
197
let mut self_ty = self_ty;
199
198
let mut autoderefs = 0 ;
200
199
loop {
@@ -236,7 +235,7 @@ impl<'self> LookupContext<'self> {
236
235
}
237
236
238
237
// Otherwise, perform autoderef.
239
- match self . deref ( self_ty, & mut enum_dids ) {
238
+ match self . deref ( self_ty) {
240
239
None => { break ; }
241
240
Some ( ty) => {
242
241
self_ty = ty;
@@ -248,20 +247,8 @@ impl<'self> LookupContext<'self> {
248
247
self . search_for_autosliced_method ( self_ty, autoderefs)
249
248
}
250
249
251
- pub fn deref ( & self , ty : ty:: t , enum_dids : & mut ~ [ ast :: def_id ] )
250
+ pub fn deref ( & self , ty : ty:: t )
252
251
-> Option < ty:: t > {
253
- match ty:: get ( ty) . sty {
254
- ty_enum( did, _) => {
255
- // Watch out for newtype'd enums like "enum t = @T".
256
- // See discussion in typeck::check::do_autoderef().
257
- if enum_dids. iter ( ) . any ( |x| x == & did) {
258
- return None ;
259
- }
260
- enum_dids. push ( did) ;
261
- }
262
- _ => { }
263
- }
264
-
265
252
match ty:: deref ( self . tcx ( ) , ty, false ) {
266
253
None => None ,
267
254
Some ( t) => {
@@ -285,7 +272,6 @@ impl<'self> LookupContext<'self> {
285
272
* we'll want to find the inherent impls for `C`.
286
273
*/
287
274
288
- let mut enum_dids = ~[ ] ;
289
275
let mut self_ty = self_ty;
290
276
loop {
291
277
match get ( self_ty) . sty {
@@ -314,7 +300,7 @@ impl<'self> LookupContext<'self> {
314
300
// n.b.: Generally speaking, we only loop if we hit the
315
301
// fallthrough case in the match above. The exception
316
302
// would be newtype enums.
317
- self_ty = match self . deref ( self_ty, & mut enum_dids ) {
303
+ self_ty = match self . deref ( self_ty) {
318
304
None => { return ; }
319
305
Some ( ty) => { ty }
320
306
}
0 commit comments