@@ -130,16 +130,11 @@ impl OverloadedCallType {
130
130
131
131
fn from_method_id ( tcx : & ty:: ctxt , method_id : ast:: DefId )
132
132
-> OverloadedCallType {
133
- let method_descriptor =
134
- match tcx. impl_or_trait_items . borrow_mut ( ) . find ( & method_id) {
135
- Some ( & ty:: MethodTraitItem ( ref method_descriptor) ) => {
136
- ( * method_descriptor) . clone ( )
137
- }
138
- None => {
139
- tcx. sess . bug ( "overloaded call method wasn't in method \
140
- map")
141
- }
142
- } ;
133
+ let method_descriptor = match ty:: impl_or_trait_item ( tcx, method_id) {
134
+ ty:: MethodTraitItem ( ref method_descriptor) => {
135
+ ( * method_descriptor) . clone ( )
136
+ }
137
+ } ;
143
138
let impl_id = match method_descriptor. container {
144
139
ty:: TraitContainer ( _) => {
145
140
tcx. sess . bug ( "statically resolved overloaded call method \
@@ -157,14 +152,27 @@ impl OverloadedCallType {
157
152
OverloadedCallType :: from_trait_id ( tcx, trait_ref. def_id )
158
153
}
159
154
155
+ fn from_unboxed_closure ( tcx : & ty:: ctxt , closure_did : ast:: DefId )
156
+ -> OverloadedCallType {
157
+ let trait_did =
158
+ tcx. unboxed_closures
159
+ . borrow ( )
160
+ . find ( & closure_did)
161
+ . expect ( "OverloadedCallType::from_unboxed_closure: didn't \
162
+ find closure id")
163
+ . kind
164
+ . trait_did ( tcx) ;
165
+ OverloadedCallType :: from_trait_id ( tcx, trait_did)
166
+ }
167
+
160
168
fn from_method_origin ( tcx : & ty:: ctxt , origin : & MethodOrigin )
161
169
-> OverloadedCallType {
162
170
match * origin {
163
171
MethodStatic ( def_id) => {
164
172
OverloadedCallType :: from_method_id ( tcx, def_id)
165
173
}
166
174
MethodStaticUnboxedClosure ( def_id) => {
167
- OverloadedCallType :: from_method_id ( tcx, def_id)
175
+ OverloadedCallType :: from_unboxed_closure ( tcx, def_id)
168
176
}
169
177
MethodParam ( ref method_param) => {
170
178
OverloadedCallType :: from_trait_id ( tcx, method_param. trait_id )
0 commit comments