@@ -95,6 +95,7 @@ use middle::typeck::check::regionmanip::replace_bound_regions_in_fn_sig;
95
95
use util:: common:: indenter;
96
96
use util:: ppaux:: Repr ;
97
97
98
+ use std:: cell:: RefCell ;
98
99
use std:: hashmap:: HashSet ;
99
100
use std:: result;
100
101
use std:: vec;
@@ -132,7 +133,7 @@ pub fn lookup(
132
133
check_traits : CheckTraitsFlag , // Whether we check traits only.
133
134
autoderef_receiver : AutoderefReceiverFlag )
134
135
-> Option < method_map_entry > {
135
- let impl_dups = @mut HashSet :: new ( ) ;
136
+ let impl_dups = @RefCell :: new ( HashSet :: new ( ) ) ;
136
137
let lcx = LookupContext {
137
138
fcx : fcx,
138
139
expr : expr,
@@ -174,7 +175,7 @@ pub struct LookupContext<'a> {
174
175
callee_id : NodeId ,
175
176
m_name : ast:: Name ,
176
177
supplied_tps : & ' a [ ty:: t ] ,
177
- impl_dups : @mut HashSet < DefId > ,
178
+ impl_dups : @RefCell < HashSet < DefId > > ,
178
179
inherent_candidates : @mut ~[ Candidate ] ,
179
180
extension_candidates : @mut ~[ Candidate ] ,
180
181
deref_args : check:: DerefArgs ,
@@ -540,8 +541,11 @@ impl<'a> LookupContext<'a> {
540
541
fn push_candidates_from_impl ( & self ,
541
542
candidates : & mut ~[ Candidate ] ,
542
543
impl_info : & ty:: Impl ) {
543
- if !self . impl_dups . insert ( impl_info. did ) {
544
- return ; // already visited
544
+ {
545
+ let mut impl_dups = self . impl_dups . borrow_mut ( ) ;
546
+ if !impl_dups. get ( ) . insert ( impl_info. did ) {
547
+ return ; // already visited
548
+ }
545
549
}
546
550
debug ! ( "push_candidates_from_impl: {} {} {}" ,
547
551
token:: interner_get( self . m_name) ,
0 commit comments